[Reproducible-commits] [strip-nondeterminism] 04/08: Add timestamp clamping support to gzip handler
Andrew Ayer
agwa at andrewayer.name
Fri Jun 10 04:27:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
agwa-guest pushed a commit to branch debian
in repository strip-nondeterminism.
commit f69632e0f372b30547ffbfd40ce072e7cff6328e
Author: Andrew Ayer <agwa at andrewayer.name>
Date: Tue Jun 7 22:37:16 2016 -0700
Add timestamp clamping support to gzip handler
---
lib/File/StripNondeterminism/handlers/gzip.pm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/File/StripNondeterminism/handlers/gzip.pm b/lib/File/StripNondeterminism/handlers/gzip.pm
index 472952b..e0f370d 100644
--- a/lib/File/StripNondeterminism/handlers/gzip.pm
+++ b/lib/File/StripNondeterminism/handlers/gzip.pm
@@ -55,8 +55,13 @@ sub normalize {
$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
- # If there's no canonical time set, zero out the mtime (this is what `gzip -n` does):
- $mtime = $File::StripNondeterminism::canonical_time // 0;
+ if (defined $File::StripNondeterminism::canonical_time) {
+ if (!$File::StripNondeterminism::clamp_time || $mtime > $File::StripNondeterminism::canonical_time) {
+ $mtime = $File::StripNondeterminism::canonical_time;
+ }
+ } else {
+ $mtime = 0; # gzip treats 0 as "no timestamp"
+ }
}
# TODO: question: normalize some of the other fields, such as OS?
--
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