[dh-make-perl] 01/03: when parsing Contents files, strip the common prefix from the diagnostic output

Damyan Ivanov dmn at moszumanska.debian.org
Sun Nov 19 18:03:11 UTC 2017


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

dmn pushed a commit to branch master
in repository dh-make-perl.

commit 860b1b2dec3e9b99980e44d1acb6fd0329da84c0
Author: Damyan Ivanov <dmn at debian.org>
Date:   Sun Nov 19 16:34:13 2017 +0000

    when parsing Contents files, strip the common prefix from the diagnostic output
---
 lib/Debian/AptContents.pm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/Debian/AptContents.pm b/lib/Debian/AptContents.pm
index 382361f..541374c 100644
--- a/lib/Debian/AptContents.pm
+++ b/lib/Debian/AptContents.pm
@@ -224,9 +224,6 @@ sub read_cache {
                 or die
                 "Can't run '/usr/lib/apt/apt-helper cat-file' on Contents files: $!\n";
 
-            $self->warning( 1,
-                "Parsing Contents files:\n\t"
-                    . join( "\n\t", @{ $self->contents_files } ) );
             my $line;
             while ( defined( $line = $f->getline ) ) {
                 my ( $file, $packages ) = split( /\s+/, $line );
@@ -246,6 +243,26 @@ sub read_cache {
                 # section/package items. We'll parse it when a file
                 # matches. Otherwise we'd parse thousands of entries,
                 # while checking only a couple
+            {
+                my $prefix;
+                for my $f ( @{ $self->contents_files } ) {
+                    if ( defined($prefix) ) {
+                        chop($prefix)
+                            while length($prefix)
+                            and not $f =~ /^\Q$prefix\E/;
+                    }
+                    else {
+                        $prefix = $f;
+                    }
+                }
+                $self->warning(
+                    1,
+                    "Parsing Contents files:\n\t"
+                        . join( "\n\t",
+                        map { my $x = $_; $x =~ s{^\Q$prefix\E}{}; $x }
+                            @{ $self->contents_files } )
+                );
+            }
             }
             close($f);
 

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



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