diff -Nru strip-nondeterminism-0.025/bin/dh_strip_nondeterminism strip-nondeterminism-0.029/bin/dh_strip_nondeterminism --- strip-nondeterminism-0.025/bin/dh_strip_nondeterminism 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/bin/dh_strip_nondeterminism 2016-12-22 10:52:33.000000000 +0000 @@ -11,7 +11,6 @@ use Debian::Debhelper::Dh_Lib; use File::StripNondeterminism; use Date::Parse; -use POSIX qw(tzset); =head1 SYNOPSIS @@ -46,6 +45,7 @@ init(); my @nondeterministic_files; + sub testfile { return if -l $_ or -d $_; # Skip directories and symlinks always. @@ -62,8 +62,7 @@ } } -$ENV{'TZ'} = 'UTC'; -tzset(); +File::StripNondeterminism::init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); @@ -72,7 +71,8 @@ find(\&testfile,$tmp); next unless @nondeterministic_files; - $File::StripNondeterminism::canonical_time = eval { get_source_date_epoch() }; + $File::StripNondeterminism::canonical_time + = eval { get_source_date_epoch() }; if (not defined $File::StripNondeterminism::canonical_time) { # Hack for old versions of debhelper isnative($package); # Sets $dh{DATE} as a side-effect @@ -81,7 +81,8 @@ foreach (@nondeterministic_files) { my ($path, $normalize) = @$_; - eval { $normalize->($path); 1 } or die "dh_strip_nondeterminism: $path: $@"; + eval { $normalize->($path); 1 } + or die "dh_strip_nondeterminism: $path: $@"; } } diff -Nru strip-nondeterminism-0.025/bin/strip-nondeterminism strip-nondeterminism-0.029/bin/strip-nondeterminism --- strip-nondeterminism-0.025/bin/strip-nondeterminism 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/bin/strip-nondeterminism 2016-12-22 10:52:33.000000000 +0000 @@ -23,22 +23,24 @@ use warnings; use File::StripNondeterminism; -use POSIX qw(tzset); use Getopt::Long; Getopt::Long::Configure(qw(no_ignore_case permute bundling)); my $cmd = $0; $cmd =~ s/.*\///; -my $usage = "Usage: $cmd [-t|--type FILETYPE] [-T|--timestamp SECONDS] [--clamp-timestamp] FILENAME\n"; +my $usage + = "Usage: $cmd [-t|--type FILETYPE] [-T|--timestamp SECONDS] [--clamp-timestamp] FILENAME\n"; my ($filetype, $timestamp, $clamp_timestamp, $want_help, $want_version); my $getopt = Getopt::Long::Parser->new; $getopt->configure(qw(no_ignore_case permute bundling)); -$getopt->getoptions('type|t=s', \$filetype, - 'timestamp|T=i', \$timestamp, - 'clamp-timestamp!', \$clamp_timestamp, - 'help|h', \$want_help, - 'version|V', \$want_version) or die $usage; +$getopt->getoptions( + 'type|t=s', \$filetype, + 'timestamp|T=i', \$timestamp, + 'clamp-timestamp!', \$clamp_timestamp, + 'help|h', \$want_help, + 'version|V', \$want_version +) or die $usage; if ($want_help) { print $usage; @@ -50,8 +52,7 @@ exit 0; } -$ENV{'TZ'} = 'UTC'; -tzset(); +File::StripNondeterminism::init(); $File::StripNondeterminism::canonical_time = $timestamp; $File::StripNondeterminism::clamp_time = $clamp_timestamp; @@ -59,16 +60,21 @@ die $usage if @ARGV == 0; for my $filename (@ARGV) { + die "$filename: Does not exist\n" unless -e $filename; + my $normalizer; if (defined $filetype) { - $normalizer = File::StripNondeterminism::get_normalizer_by_name($filetype); + $normalizer + = File::StripNondeterminism::get_normalizer_by_name($filetype); die "$filetype: Unknown file type\n" unless $normalizer; } else { - $normalizer = File::StripNondeterminism::get_normalizer_for_file($filename); + $normalizer + = File::StripNondeterminism::get_normalizer_for_file($filename); next unless $normalizer; } - eval { $normalizer->($filename); 1 } or die "strip-nondeterminism: $filename: $@"; + eval { $normalizer->($filename); 1 } + or die "strip-nondeterminism: $filename: $@"; } __END__ diff -Nru strip-nondeterminism-0.025/debian/changelog strip-nondeterminism-0.029/debian/changelog --- strip-nondeterminism-0.025/debian/changelog 2016-09-11 22:15:22.000000000 +0000 +++ strip-nondeterminism-0.029/debian/changelog 2017-01-04 09:33:55.000000000 +0000 @@ -1,14 +1,72 @@ -strip-nondeterminism (0.025-1~14.04.york1) trusty; urgency=medium +strip-nondeterminism (0.029-2~14.04.york1) trusty; urgency=medium * debian/rules: disable tests - -- Jonathon Fernyhough Sun, 11 Sep 2016 23:14:14 +0100 + -- Jonathon Fernyhough Mon, 02 Jan 2017 19:45:50 +0000 -strip-nondeterminism (0.025-1~14.04.york0) trusty; urgency=medium +strip-nondeterminism (0.029-2) unstable; urgency=medium - * No-change backport to trusty + [ Chris Lamb ] + * debian/tests/control: Also copy our binaries as they are used in the tests. + Closes: #849391 - -- Jonathon Fernyhough Sun, 11 Sep 2016 22:14:49 +0100 + -- Mattia Rizzolo Tue, 27 Dec 2016 13:54:57 +0100 + +strip-nondeterminism (0.029-1) unstable; urgency=medium + + [ Chris Lamb ] + * t/binaries.t: + - Don't make tests rely on Debian::Debhelper::Dh_Lib for non-Debian + distributions. + - Smoke test strip-nondeterminism(1) and dh_strip_nondeterminism(1) to + prevent regressions like a3c16cd08. + * Makefile.PL: Change "NAME" argument to a Perl package name. + * .pertidyrc: Inherit/copy from lintian's version but using tabs over spaces. + * Run perltidy across codebase. + + [ Reiner Herrmann ] + * zip: normalize NTFS FIleTimes. (Closes: #845203) + + [ Anders Kaseorg ] + * libfile-stripnondeterminism-perl: Treat .par files as Zip archives. + (Closes: #846895) + + -- Chris Lamb Thu, 22 Dec 2016 10:55:20 +0000 + +strip-nondeterminism (0.028-1) unstable; urgency=medium + + * bin/strip-nondeterminism: Add missing semicolon. + + -- Chris Lamb Mon, 12 Sep 2016 09:06:01 +0100 + +strip-nondeterminism (0.027-1) unstable; urgency=medium + + * Add a File::StripNondeterminism::init method to avoid tzset DRY violation. + - Also set timezone in tests. (Closes: #837382) + + -- Chris Lamb Sun, 11 Sep 2016 23:10:35 +0100 + +strip-nondeterminism (0.026-1) unstable; urgency=medium + + * handlers/jar.pm: Reintroduce subroutine prototype on _jar_filename_cmp to + fix ordering regression in .jar files. + * Add a testcase for jar file ordering and normalisation. + * bin/strip-nondeterminism: die if file does not exist (Closes: #800159) + * debian/rules: + - No need for -make hack as we'll have Makefile during package build. + (Closes: #836732) + - Update clean target to avoid FTBFS twice in a row. + * Add Homepage field. + * t/fixtures.t: + - Add a lookup table for descriptions of stat(1) indices. + - Don't test whether inode number has changed. + - Check that output matches expected before comparing attributes to make it + less confusing on failure. + - Re-add top-level "plan" call dropped in 0.024-1. + - Add comment why we use a per-fixture temporary directory. + - Re-order @fixtures setup for global->specific ordering. + + -- Chris Lamb Fri, 09 Sep 2016 11:02:04 +0100 strip-nondeterminism (0.025-1) unstable; urgency=medium diff -Nru strip-nondeterminism-0.025/debian/control strip-nondeterminism-0.029/debian/control --- strip-nondeterminism-0.025/debian/control 2016-09-11 21:14:46.000000000 +0000 +++ strip-nondeterminism-0.029/debian/control 2016-12-27 12:54:57.000000000 +0000 @@ -14,6 +14,7 @@ Mattia Rizzolo , Chris Lamb , Standards-Version: 3.9.8 +Homepage: https://reproducible-builds.org/ Vcs-Git: https://anonscm.debian.org/git/reproducible/strip-nondeterminism.git Vcs-Browser: https://anonscm.debian.org/git/reproducible/strip-nondeterminism.git diff -Nru strip-nondeterminism-0.025/debian/rules strip-nondeterminism-0.029/debian/rules --- strip-nondeterminism-0.025/debian/rules 2016-09-11 22:14:11.000000000 +0000 +++ strip-nondeterminism-0.029/debian/rules 2017-01-02 19:45:47.000000000 +0000 @@ -1,13 +1,13 @@ #!/usr/bin/make -f +%: + dh $@ + # Remove the auto-generated Makefile to prevent dh_auto_clean from failing # if the Makefile contain paths referring to an old version of Perl. override_dh_auto_clean: - rm -f Makefile + rm -rf Makefile MYMETA.* cover_db/ blib/ dh_auto_clean override_dh_auto_test: -# cover -test -make 'prove -v -Ilib; return $?;' -ignore_re '^t/' - -%: - dh $@ +# cover -test -ignore_re '^t/' diff -Nru strip-nondeterminism-0.025/debian/tests/control strip-nondeterminism-0.029/debian/tests/control --- strip-nondeterminism-0.025/debian/tests/control 2016-09-04 16:43:00.000000000 +0000 +++ strip-nondeterminism-0.029/debian/tests/control 2016-12-27 12:53:42.000000000 +0000 @@ -1,2 +1,2 @@ -Test-Command: mkdir "${ADTTMP}/t" && cp -rv t/* "${ADTTMP}/t/" && cd "${ADTTMP}" && perl -MExtUtils::Command::MM -MTest::Harness t/*.t +Test-Command: mkdir -p "${ADTTMP}" && cp -rv t/ bin/ "${ADTTMP}" && cd "${ADTTMP}" && perl -MExtUtils::Command::MM -MTest::Harness t/*.t Restrictions: allow-stderr diff -Nru strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/ar.pm strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/ar.pm --- strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/ar.pm 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/ar.pm 2016-12-22 10:52:33.000000000 +0000 @@ -37,7 +37,7 @@ my $buf; open(my $fh, '+<', $file) - or die("failed to open $file for read+write: $!"); + or die("failed to open $file for read+write: $!"); read $fh, $buf, $GLOBAL_HEADER_LENGTH; return 0 if $buf ne $GLOBAL_HEADER; @@ -59,26 +59,30 @@ #58 59 File magic \140\012 die "Incorrect header length" - if length $buf != $FILE_HEADER_LENGTH; + if length $buf != $FILE_HEADER_LENGTH; die "Incorrect file magic" - if substr($buf, 58, length($FILE_MAGIC)) ne $FILE_MAGIC; + if substr($buf, 58, length($FILE_MAGIC)) ne $FILE_MAGIC; my $file_mode = oct(substr($buf, 40, 8)); my $file_size = substr($buf, 48, 10); seek $fh, $file_header_start + 16, SEEK_SET; # mtime - syswrite $fh, sprintf("%-12d", $File::StripNondeterminism::canonical_time // 0); + syswrite $fh, + sprintf("%-12d", $File::StripNondeterminism::canonical_time // 0); # owner syswrite $fh, sprintf("%-6d", 0); # group syswrite $fh, sprintf("%-6d", 0); # file mode - syswrite $fh, sprintf("%-8o", ($file_mode & oct(100)) ? oct(755) : oct(644)); + syswrite $fh, + sprintf("%-8o", ($file_mode & oct(100)) ? oct(755) : oct(644)); # move to next member my $padding = $file_size % 2; - seek $fh, $file_header_start + $FILE_HEADER_LENGTH + $file_size + $padding, SEEK_SET; + seek $fh, + $file_header_start + $FILE_HEADER_LENGTH + $file_size + $padding, + SEEK_SET; } diff -Nru strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/gettext.pm strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/gettext.pm --- strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/gettext.pm 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/gettext.pm 2016-12-22 10:52:33.000000000 +0000 @@ -28,7 +28,8 @@ my $filename = shift; local $/ = undef; - open(my $fh, '<', $filename) or die "Can't open file $filename for reading: $!"; + open(my $fh, '<', $filename) + or die "Can't open file $filename for reading: $!"; binmode($fh); my $buf = <$fh>; close($fh); @@ -56,7 +57,8 @@ return 0; } - my ($revision, $nstrings, $orig_to, $trans_to) = unpack($fmt x 4, substr($buf, 1*4, 4*4)); + my ($revision, $nstrings, $orig_to, $trans_to) + = unpack($fmt x 4, substr($buf, 1*4, 4*4)); my $major = int($revision / 256); my $minor = int($revision % 256); return 0 if $major > 1; @@ -74,22 +76,25 @@ my $pot_date = $1; my $time; - eval { - $time = Time::Piece->strptime($pot_date, "%Y-%m-%d %H:%M%z"); - }; + eval {$time = Time::Piece->strptime($pot_date, "%Y-%m-%d %H:%M%z");}; next if $@; next if $time <= $norm_time; my $new_time = strftime("%Y-%m-%d %H:%M%z", gmtime($norm_time)); - $trans_msg =~ s/\QPOT-Creation-Date: $pot_date\E/POT-Creation-Date: $new_time/; + $trans_msg + =~ s/\QPOT-Creation-Date: $pot_date\E/POT-Creation-Date: $new_time/; next if length($trans_msg) != $trans_len; - $buf = substr($buf, 0, $trans_offset) . $trans_msg . substr($buf, $trans_offset + $trans_len); + $buf + = substr($buf, 0, $trans_offset) + . $trans_msg + . substr($buf, $trans_offset + $trans_len); $modified = 1; } if ($modified) { - open(my $fh, '>', $mo_filename) or die "Can't open file $mo_filename for writing: $!"; + open(my $fh, '>', $mo_filename) + or die "Can't open file $mo_filename for writing: $!"; binmode($fh); print $fh $buf; close($fh); diff -Nru strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/gzip.pm strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/gzip.pm --- strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/gzip.pm 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/gzip.pm 2016-12-22 10:52:33.000000000 +0000 @@ -36,7 +36,8 @@ sub normalize { my ($filename) = @_; - open(my $fh, '<', $filename) or die "Unable to open $filename for reading: $!"; + open(my $fh, '<', $filename) + or die "Unable to open $filename for reading: $!"; # See RFC 1952 @@ -54,10 +55,13 @@ my $new_flg = $flg; $new_flg &= ~FNAME; # Don't include filename - $new_flg &= ~FHCRC; # Don't include header CRC (not all implementations support it) - unless ($mtime == 0) { # Don't set a deterministic timestamp if there wasn't already a timestamp + $new_flg &= ~FHCRC + ; # Don't include header CRC (not all implementations support it) + unless ($mtime == 0) + { # Don't set a deterministic timestamp if there wasn't already a timestamp if (defined $File::StripNondeterminism::canonical_time) { - if (!$File::StripNondeterminism::clamp_time || $mtime > $File::StripNondeterminism::canonical_time) { + if ( !$File::StripNondeterminism::clamp_time + || $mtime > $File::StripNondeterminism::canonical_time) { $mtime = $File::StripNondeterminism::canonical_time; } } else { @@ -69,7 +73,8 @@ my $tempfile = File::Temp->new(DIR => dirname($filename)); # Write a new header - print $tempfile pack('CCCClclose; copy_data($tempfile->filename, $filename) - or die "$filename: unable to overwrite: copy_data: $!"; + or die "$filename: unable to overwrite: copy_data: $!"; return 1; } diff -Nru strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/jar.pm strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/jar.pm --- strip-nondeterminism-0.025/lib/File/StripNondeterminism/handlers/jar.pm 2016-09-04 16:42:08.000000000 +0000 +++ strip-nondeterminism-0.029/lib/File/StripNondeterminism/handlers/jar.pm 2016-12-22 10:52:33.000000000 +0000 @@ -28,9 +28,10 @@ use File::StripNondeterminism::handlers::javadoc; use File::StripNondeterminism::handlers::javaproperties; -sub _jar_filename_cmp { +sub _jar_filename_cmp($$) { my ($a, $b) = @_; - # META-INF/ and META-INF/MANIFEST.MF are expected to be the first entries in the Zip archive. + # META-INF/ and META-INF/MANIFEST.MF are expected to be the first + # entries in the Zip archive. return 0 if $a eq $b; for (qw{META-INF/ META-INF/MANIFEST.MF}) { return -1 if $a eq $_; @@ -42,7 +43,8 @@ sub _jar_normalize_manifest { my ($filename) = @_; - open(my $fh, '<', $filename) or die "Unable to open $filename for reading: $!"; + open(my $fh, '<', $filename) + or die "Unable to open $filename for reading: $!"; my $tempfile = File::Temp->new(DIR => dirname($filename)); my $modified = 0; @@ -60,7 +62,7 @@ if ($modified) { $tempfile->close; copy_data($tempfile->filename, $filename) - or die "$filename: unable to overwrite: copy_data: $!"; + or die "$filename: unable to overwrite: copy_data: $!"; } return $modified; } @@ -69,22 +71,28 @@ my ($member) = @_; # $member is a ref to an Archive::Zip::Member return if $member->isDirectory(); - if ($member->fileName() =~ /\.html$/ && - File::StripNondeterminism::handlers::zip::peek_member($member, 1024) =~ /\