tags 403207 patch
thanks

Frank Küster <[EMAIL PROTECTED]> wrote:

> Package: devscripts
> Version: 2.9.22~bpo.2
> Severity: normal
>
> Currently, dd-list always uses source package names in the output:

(not always, with --dctrl it lists binary names if no Sources: lines are
included).  Here's a patch:

diff -Nur devscripts-2.9.27.old/dd-list.pl devscripts-2.9.27/dd-list.pl
--- devscripts-2.9.27.old/dd-list.pl    2006-06-15 20:22:05.000000000 +0200
+++ devscripts-2.9.27/dd-list.pl        2006-12-15 13:08:53.000000000 +0100
@@ -26,10 +26,10 @@
 my $version='###VERSION###';
 
 sub get_developers_given_package {
-       my $package_name=shift;
+       my ($package_name,$print_binary) = @_;
        
        my $developer;
-       my $source_name;
+       my $print_name;
        my $uploaders;
        my @uploaders;
        open (F, "apt-cache showsrc '$package_name' |");
@@ -44,11 +44,11 @@
                        
                }
                elsif (/^Package: (.*)/) {
-                       $source_name=$1;
+                       $print_name = $print_binary ? $package_name : $1 ;
                }
        }
        close F;
-       return ($developer, [EMAIL PROTECTED], $source_name);
+       return ($developer, [EMAIL PROTECTED], $print_name);
 }
 
 sub parse_developer {
@@ -86,6 +86,10 @@
     -u, --uploaders
         Also list uploaders of packages, not only the listed maintainers
 
+    -b, --print-binary
+        If binary package names are given as input, print these names 
+       in the output instead of corresponding source packages.
+
     -V, --version
         Print version (it\'s $version by the way).
 EOF
@@ -94,11 +98,13 @@
 my $use_stdin=0;
 my $use_dctrl=0;
 my $show_uploaders=0;
+my $print_binary=0;
 if (! GetOptions(
        "help" => sub { help(); exit },
        "stdin|i" => \$use_stdin,
        "dctrl|d" => \$use_dctrl,
        "uploaders|u" => \$show_uploaders,
+       "print-binary|b" => \$print_binary,
        "version" => sub { print "dd-list version $version\n" })) {
        exit(1);
 }
@@ -114,7 +120,7 @@
                if (/^Package:\s+(.*)$/m) {
                        $package=$1;
                }
-               if (/^Source:\s+(.*)$/m) {
+               if (/^Source:\s+(.*)$/m && ! $print_binary ) {
                        $package=$1;
                }
                if (/^Maintainer:\s+(.*)$/m) {
@@ -154,12 +160,12 @@
        }
 
        foreach my $package_name (@package_names) {
-               my ($developer, $uploaders, 
$source_name)=get_developers_given_package($package_name);
+               my ($developer, $uploaders, 
$print_name)=get_developers_given_package($package_name,$print_binary);
                if (defined $developer) {
-                       push @{$dict{$developer}}, $source_name;
+                       push @{$dict{$developer}}, $print_name;
                        if ($show_uploaders && @$uploaders) {
                                foreach my $uploader (@$uploaders) {
-                                       push @{$dict{$uploader}}, "$source_name 
(U)";
+                                       push @{$dict{$uploader}}, "$print_name 
(U)";
                                }
                        }
                }
diff -Nur devscripts-2.9.27.old/dd-list.1 devscripts-2.9.27/dd-list.1
--- devscripts-2.9.27.old/dd-list.1     2005-09-16 16:09:37.000000000 +0200
+++ devscripts-2.9.27/dd-list.1 2006-12-15 12:56:06.000000000 +0100
@@ -33,7 +33,7 @@
 .B --stdin 
 is given). 
 Output is a list of the following format, where package names are source
-packages:
+packages by default:
 .PP
 .nf
 .RS
@@ -70,12 +70,20 @@
 apt-cache. This is the fastest way to use dd-list, as it uses the
 maintainer information from the input instead of looking up the maintainer
 of each listed package.
+.IP
+If no \fISource:\fP line is given, the \fIPackage:\fP name is used for
+output, which might be a binary package name.
 .TP
 .BR \-u , \-\-uploaders
 Also list developers who are named as uploaders of packages, not only
 the maintainers.  Uploaders are indicated with "(U)" appended to the
 package name.
 .TP
+.BR \-b , \-\-print\-binary
+Use binary package names in the output instead of source package names
+(has no effect with \fB--dctrl\fP if the \fIPackage:\fP line contains
+source package names).
+.TP
 .BR \-V , \-\-version
 Print the version.
 .\" --------------------------------------------------------------------


-- 
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)

Reply via email to