[debsums] 07/07: Suppress warning about empty .md5sums file if it's expected to be empty

Axel Beckert abe at deuxchevaux.org
Tue Mar 3 11:35:24 UTC 2015


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

abe pushed a commit to branch master
in repository debsums.

commit 5f3320580cdddd0f876e7878e7df4d3512080c18
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Tue Mar 3 12:29:38 2015 +0100

    Suppress warning about empty .md5sums file if it's expected to be empty
    
    That's the case if a package contains only directories and symbolic
    links as not uncommon for meta-packages like e.g. g++, default-jre or
    python-all.
---
 debian/changelog |  2 +-
 debsums          | 28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7fe031f..666c237 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,7 +27,7 @@ debsums (2.1~dev) UNRELEASED; urgency=medium
   * debsums:
     + Apply patch by Vladimir N. Solovyov to also report modified files of
       arch-qualified (multiarch) packages. (Closes: #773136)
-    + Warn if found md5sums file is empty. (Closes: #577197)
+    + Warn if found md5sums file is empty but shouldn't. (Closes: #577197)
     + Broaden character set which is considered a valid version number.
       (Closes: #779626)
     + Simplify parsing of dpkg-{parsechangelog,query} output by using more
diff --git a/debsums b/debsums
index fb377d2..80c5325 100755
--- a/debsums
+++ b/debsums
@@ -336,8 +336,32 @@ sub md5sums_path
     }
 
     if (-e $path and -z _) {
-        warn "$path is empty!\n";
-        $status |= 2;
+        # Empty .md5sums file: check if that's ok, either print a warning
+        my $list_file = $path;
+        $list_file =~ s/md5sums$/list/;
+        unless (-e $list_file) {
+            warn "$path is empty and $list_file does not exist!\n";
+            $status |= 2;
+        } else {
+            my $rc = open(my $lffd, '<', $list_file);
+            unless ($rc) {
+                warn "Couldn't open $list_file for reading: $!";
+                $status |= 2;
+            } else {
+                my $found_a_file = 0;
+                while (my $line = <$lffd>) {
+                    chomp($line);
+                    next if -l $line;
+                    next if -d _;
+                    if (-f _) {
+                        warn "$path is empty but shouldn't!\n";
+                        $status |= 2;
+                        last;
+                    }
+                }
+                close($lffd);
+            }
+        }
     }
 
     return $path;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git



More information about the Pkg-perl-cvs-commits mailing list