The following commit has been merged in the master branch:
commit 9635e75e67fbc21fa4d4e95bb1f3f1fc6c1cc125
Author: James McCoy <[email protected]>
Date:   Sat Feb 25 19:32:56 2012 -0500

    dd-list: Fix correlation of given package when it does not match the source 
package.
    
    Closes: #655854
    Signed-off-by: James McCoy <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 11a0d73..43b809e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,10 @@ devscripts (2.11.5) UNRELEASED; urgency=low
   * deb-reversion: Simplify option parsing, also allowing simpler quoting of
     arguments.
 
+  [ James McCoy ]
+  * dd-list: Fix correlation of given package name when it does not match the
+    source package name.  (Closes: #655854)
+
  -- Adam D. Barratt <[email protected]>  Wed, 15 Feb 2012 19:40:58 +0000
 
 devscripts (2.11.4) unstable; urgency=high
diff --git a/scripts/dd-list.pl b/scripts/dd-list.pl
index 343020e..92666bd 100755
--- a/scripts/dd-list.pl
+++ b/scripts/dd-list.pl
@@ -92,26 +92,56 @@ sub parsefh
 {
     my ($fh, $fname, $check_package) = @_;
     local $/="\n\n";
+    my $package_names;
+    if ($check_package) {
+       $package_names = sprintf '(?:^| )(%s)(?:,|$)',
+                                join '|',
+                                map { "\Q$_\E" }
+                                keys %package_name;
+    }
     while (<$fh>) {
-       my ($package, $maintainer, $uploaders, @uploaders);
+       my ($package, $source, $binaries, $maintainer, $uploaders, @uploaders);
 
+       # Binary is shown in _source_Sources and contains all binaries produced 
by
+       # that source package
+       if (/^Binary:\s+(.*(?:\n .*)*)$/m) {
+           $binaries = $1;
+           $binaries =~ s/\n//;
+       }
+       # Package is shown both in _source_Sources and _binary-*.  It is the
+       # name of the package, source or binary respectively, being described
+       # in that control stanza
        if (/^Package:\s+(.*)$/m) {
            $package=$1;
        }
-       if (/^Source:\s+(.*)$/m && ! $print_binary ) {
-           $package=$1;
+       # Source is shown in _binary-* and specifies the source package which
+       # produced the binary being described
+       if (/^Source:\s+(.*)$/m) {
+           $source=$1;
        }
        if (/^Maintainer:\s+(.*)$/m) {
            $maintainer=$1;
        }
-       if (/^Uploaders:\s+(.*)$/m) {
+       if (/^Uploaders:\s+(.*(?:\n .*)*)$/m) {
            $uploaders=$1;
+           $uploaders =~ s/\n//g;
            @uploaders = split /(?<=>)\s*,\s*/, $uploaders;
        }
 
-       if (defined $maintainer && defined $package) {
-           if ($check_package && !exists $package_name{$package}) {
-               next;
+       if (defined $maintainer
+           && (defined $package || defined $source || defined $binaries)) {
+           $source ||= $package;
+           $binaries ||= $package;
+           if ($check_package) {
+               if ($binaries =~ m/$package_names/) {
+                   $binaries = $1;
+                   $package_name{$binaries}--;
+               }
+               elsif ($source !~ m/$package_names/) {
+                   next;
+               }
+               $package_name{$source}--;
+               $package = $print_binary ? $binaries : $source;
            }
            push @{$dict{$maintainer}}, $package;
            if ($show_uploaders && defined $uploaders) {
@@ -163,7 +193,6 @@ foreach my $developer (sort_developers(keys %dict)) {
     print "$developer\n";
     my %seen;
     foreach my $package (sort @{$dict{$developer}}) {
-       $package_name{$package}--;
        next if $seen{$package};
        $seen{$package}=1;
        print "   $package\n";

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to