[Reproducible-commits] [strip-nondeterminism] 02/05: Add framework for "clamping" the timestamp

Andrew Ayer agwa at andrewayer.name
Wed Jun 8 04:50:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch mine
in repository strip-nondeterminism.

commit b0075dd138bdcc75f9e615d27dfd6724be6a5741
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Tue Jun 23 10:25:16 2015 -0700

    Add framework for "clamping" the timestamp
    
    When clamping is enabled, timestamps are only replaced with the
    canonical time if they're later than the canonical time. This way,
    only tmestamps introduced as part of the build process are replaced.
---
 bin/dh_strip_nondeterminism     | 1 +
 bin/strip-nondeterminism        | 6 ++++--
 lib/File/StripNondeterminism.pm | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/dh_strip_nondeterminism b/bin/dh_strip_nondeterminism
index 01b4ad7..6b56aa5 100755
--- a/bin/dh_strip_nondeterminism
+++ b/bin/dh_strip_nondeterminism
@@ -74,6 +74,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
 	isnative($package); # Sets $dh{DATE} as a side-effect (TODO: do this more nicely)
 	$File::StripNondeterminism::canonical_time = str2time($dh{DATE});
+	$File::StripNondeterminism::clamp_time = 1;
 
 	foreach (@nondeterministic_files) {
 		my ($path, $normalize) = @$_;
diff --git a/bin/strip-nondeterminism b/bin/strip-nondeterminism
index 3d185c7..c2005fe 100755
--- a/bin/strip-nondeterminism
+++ b/bin/strip-nondeterminism
@@ -29,13 +29,14 @@ Getopt::Long::Configure(qw(no_ignore_case permute bundling));
 
 my $cmd = $0;
 $cmd =~ s/.*\///;
-my $usage = "Usage: $cmd [-t|--type FILETYPE] [-T|--timestamp SECONDS] FILENAME\n";
+my $usage = "Usage: $cmd [-t|--type FILETYPE] [-T|--timestamp SECONDS] [--clamp-timestamp] FILENAME\n";
 
-my ($filetype, $timestamp, $want_help, $want_version);
+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;
 
@@ -53,6 +54,7 @@ $ENV{'TZ'} = 'UTC';
 tzset();
 
 $File::StripNondeterminism::canonical_time = $timestamp;
+$File::StripNondeterminism::clamp_time = $clamp_timestamp;
 
 die $usage if @ARGV == 0;
 
diff --git a/lib/File/StripNondeterminism.pm b/lib/File/StripNondeterminism.pm
index 7c85b7f..1672d27 100644
--- a/lib/File/StripNondeterminism.pm
+++ b/lib/File/StripNondeterminism.pm
@@ -31,7 +31,7 @@ use File::StripNondeterminism::handlers::png;
 use File::StripNondeterminism::handlers::javaproperties;
 use File::StripNondeterminism::handlers::zip;
 
-our($VERSION, $canonical_time);
+our($VERSION, $canonical_time, $clamp_time);
 
 $VERSION = '0.008'; # 0.008
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list