[Reproducible-commits] [misc] 01/01: These normalizers are now part of strip-nondetermism.
Chris Lamb
chris at chris-lamb.co.uk
Sun Aug 14 17:53:55 UTC 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository misc.
commit 3cab3e07c0d85759e1a993b81eb0fb2dc6d0c953
Author: Chris Lamb <lamby at debian.org>
Date: Sun Aug 14 18:53:51 2016 +0100
These normalizers are now part of strip-nondetermism.
---
normalizers/normalize_ar.pl | 82 ---------------------------------------------
normalizers/normalize_ar.py | 78 ------------------------------------------
2 files changed, 160 deletions(-)
diff --git a/normalizers/normalize_ar.pl b/normalizers/normalize_ar.pl
deleted file mode 100755
index 1ac4d2b..0000000
--- a/normalizers/normalize_ar.pl
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/perl -w
-# normalize_ar: remove non-deterministic attributes of ar archives
-# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
-# Copyright © 2014 Niko Tyni <ntyni at debian.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Some code borrowed from ArFile
-# Copyright (C) 2007 Stefano Zacchiroli <zack at debian.org>
-# Copyright (C) 2007 Filippo Giunchedi <filippo at debian.org>
-
-use strict;
-
-use Fcntl q/SEEK_SET/;
-
-my $GLOBAL_HEADER = "!<arch>\n";
-my $GLOBAL_HEADER_LENGTH = length $GLOBAL_HEADER;
-
-my $FILE_HEADER_LENGTH = 60;
-my $FILE_MAGIC = "`\n";
-
-my $buf;
-
-die("Usage: $0 <file>\n") if !@ARGV;
-my $file = shift;
-
-open(F, '+<', $file)
- or die("failed to open $file for read+write: $!");
-
-read F, $buf, $GLOBAL_HEADER_LENGTH;
-die("Unable to find global header") if $buf ne $GLOBAL_HEADER;
-
-while (1) {
- my $file_header_start = tell F;
- my $count = read F, $buf, $FILE_HEADER_LENGTH;
- die "reading $file failed: $!" if !defined $count;
- last if $count == 0;
-
- # http://en.wikipedia.org/wiki/Ar_(Unix)
- #from to Name Format
- #0 15 File name ASCII
- #16 27 File modification date Decimal
- #28 33 Owner ID Decimal
- #34 39 Group ID Decimal
- #40 47 File mode Octal
- #48 57 File size in bytes Decimal
- #58 59 File magic \140\012
-
- # FIXME: is this correct?
- last if $count == 1 and eof(F) and $buf eq "\n";
-
- die "Incorrect header length"
- if length $buf != $FILE_HEADER_LENGTH;
- die "Incorrect file magic"
- if substr($buf, 58, length($FILE_MAGIC)) ne $FILE_MAGIC;
-
- my $file_size = substr($buf, 48, 10);
- seek F, $file_header_start + 16, SEEK_SET;
-
- # mtime
- syswrite F, sprintf("%-12d", 0);
- # owner
- syswrite F, sprintf("%-6d", 0);
- # group
- syswrite F, sprintf("%-6d", 0);
- # file mode
- syswrite F, sprintf("%-8o", 0644);
-
- # move to next member
- seek F, $file_header_start + $FILE_HEADER_LENGTH + $file_size, SEEK_SET;
-}
diff --git a/normalizers/normalize_ar.py b/normalizers/normalize_ar.py
deleted file mode 100755
index 15d6e3f..0000000
--- a/normalizers/normalize_ar.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-#
-# normalize_ar: remove non-deterministic attributes of ar archives
-# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Some code borrowed from ArFile
-# Copyright (C) 2007 Stefano Zacchiroli <zack at debian.org>
-# Copyright (C) 2007 Filippo Giunchedi <filippo at debian.org>
-
-GLOBAL_HEADER = "!<arch>\n"
-GLOBAL_HEADER_LENGTH = len(GLOBAL_HEADER)
-
-FILE_HEADER_LENGTH = 60
-FILE_MAGIC = "`\n"
-
-import os
-import sys
-
-def main():
- f = open(sys.argv[1], "r+b")
-
- buf = f.read(GLOBAL_HEADER_LENGTH)
- if buf != GLOBAL_HEADER:
- raise Exception, "Unable to find global header"
-
- while True:
- file_header_start = f.tell()
- buf = f.read(FILE_HEADER_LENGTH)
- if not buf:
- break
-
- # http://en.wikipedia.org/wiki/Ar_(Unix)
- #from to Name Format
- #0 15 File name ASCII
- #16 27 File modification date Decimal
- #28 33 Owner ID Decimal
- #34 39 Group ID Decimal
- #40 47 File mode Octal
- #48 57 File size in bytes Decimal
- #58 59 File magic \140\012
-
- # sanity checks
- if len(buf) < FILE_HEADER_LENGTH:
- raise IOError, "Incorrect header length"
-
- if buf[58:60] != FILE_MAGIC:
- raise IOError, "Incorrect file magic"
-
- file_size = int(buf[48:58])
-
- f.seek(file_header_start + 16, os.SEEK_SET)
- # mtime
- f.write("%-12d" % 0)
- # owner
- f.write("%-6d" % 0)
- # group
- f.write("%-6d" % 0)
- # file mode
- f.write("%-8o" % 0644)
-
- # move to next member
- f.seek(file_header_start + FILE_HEADER_LENGTH + file_size, os.SEEK_SET)
-
-if __name__ == '__main__':
- main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git
More information about the Reproducible-commits
mailing list