[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 02/05: Don't report timestamped-gzip if the file is pregenerated (#762105)



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

nthykier pushed a commit to branch master
in repository lintian.

commit 184e9526017b325919aaaf132fb0a67adfcadc83
Author: Tomasz Buchert <tomasz@debian.org>
Date:   Thu May 14 11:32:58 2015 +0200

    Don't report timestamped-gzip if the file is pregenerated (#762105)
    
    This is a heuristic proposed in https://bugs.debian.org/762105.
    If the gzipped file has a modification time *after* changelog,
    then very likely it is unreproducible. On the other hand,
    if it is *before*, then it is probably pregenerated in upstream
    sources.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/files.pm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/checks/files.pm b/checks/files.pm
index 7ad6e1f..8b937e8 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -277,6 +277,18 @@ sub run {
     my $isma_same = $info->field('multi-arch', '') eq 'same';
     my $ppkg = quotemeta($pkg);
 
+    # get the last changelog timestamp
+    # if for some weird reasons the timestamp does
+    # not exist, it will remain 0
+    my $changes = $info->changelog;
+    my $changelog_timestamp = 0;
+    if (defined $changes) {
+        my ($entry) = $changes->data;
+        if ($entry && $entry->Timestamp) {
+            $changelog_timestamp = $entry->Timestamp;
+        }
+    }
+
     # find out which files are scripts
     my %script = map {$_ => 1} (sort keys %{$info->scripts});
 
@@ -1433,7 +1445,11 @@ sub run {
                         if ($isma_same && $file !~ m/\Q$arch\E/o) {
                             tag 'gzip-file-is-not-multi-arch-same-safe', $file;
                         } else {
-                            tag 'package-contains-timestamped-gzip', $file;
+                            # see https://bugs.debian.org/762105
+                            my $diff = $file->timestamp - $changelog_timestamp;
+                            if ($diff >= 0) {
+                                tag 'package-contains-timestamped-gzip', $file;
+                            }
                         }
                     }
                 }

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


Reply to: