Преглед изворни кода

dpkg-source: extend the Package-List field based on the feedback received

Integrate the architecture field with spaces replaced by commas. It will
be used by the wanna-build team to see if the source package builds
Architecture: all packages. The reprepro maintainer also had a similar
use case for this information.

Put the type of the package in a dedicated field rather than a prefix of
the package name. Suggested by Bastian Blank.

See feedback at
http://lists.debian.org/debian-policy/2011/03/threads.html#00155
Raphaël Hertzog пре 15 година
родитељ
комит
e3a9083fca
2 измењених фајлова са 8 додато и 6 уклоњено
  1. 1 1
      debian/changelog
  2. 7 5
      scripts/dpkg-source.pl

+ 1 - 1
debian/changelog

@@ -94,7 +94,7 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     LP: #739179
   * Add new Package-List field to .dsc files as requested by ftpmasters.
     It contains a list of packages that the source can build along with
-    their sections and priorities. Closes: #619131
+    their sections, priorities and architecture. Closes: #619131
   * Remove duplicate word in german translation of dpkg(1). Closes: #616096
   * Strip repeated non-significant spaces before and after newlines
     in Uploaders. Closes: #598922

+ 7 - 5
scripts/dpkg-source.pl

@@ -222,8 +222,6 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
     my $src_fields = $control->get_source();
     my $src_sect = $src_fields->{'Section'} || "unknown";
     my $src_prio = $src_fields->{'Priority'} || "unknown";
-    $fields->{'Package-List'} = sprintf("\nsrc:%s %s %s", $src_fields->{'Source'},
-                                        $src_sect, $src_prio);
     foreach $_ (keys %{$src_fields}) {
 	my $v = $src_fields->{$_};
 	if (m/^Source$/i) {
@@ -253,8 +251,9 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
 	my $prio = $pkg->{'Priority'} || $src_prio;
 	my $type = $pkg->{'Package-Type'} ||
 	        $pkg->get_custom_field('Package-Type') || 'deb';
-	push @pkglist, sprintf("%s%s %s %s", ($type eq "deb") ? "" : "$type:",
-	                       $p, $sect, $prio);
+	my $arch = $pkg->{'Architecture'};
+	$arch =~ s/\s+/,/g;
+	push @pkglist, sprintf("%s %s %s %s %s", $p, $type, $sect, $prio, $arch);
 	push(@binarypackages,$p);
 	foreach $_ (keys %{$pkg}) {
 	    my $v = $pkg->{$_};
@@ -283,12 +282,15 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
             }
 	}
     }
-    $fields->{'Package-List'} .= "\n" . join("\n", sort @pkglist);
     if (grep($_ eq 'any', @sourcearch)) {
         # If we encounter one 'any' then the other arches become insignificant.
         @sourcearch = ('any');
     }
     $fields->{'Architecture'} = join(' ', @sourcearch);
+    $fields->{'Package-List'} = sprintf("\n%s source %s %s %s", $sourcepackage,
+                                        $src_sect, $src_prio,
+                                        join(',', @sourcearch));
+    $fields->{'Package-List'} .= "\n" . join("\n", sort @pkglist);
 
     # Scan fields of dpkg-parsechangelog
     foreach $_ (keys %{$changelog}) {