浏览代码

dpkg-source: add new Package-List field to .dsc files

This field has been requested by ftpmasters so that they can install
overrides for all binary packages as soon as they have approved
the source package. It contains a the list of packages that the source
can build along with their sections and priorities.

It looks like this:

  Package-List:
   src:foo admin optional
   foo admin optional
   foo-common admin optional
   udeb:foo-udeb debian-installer extra
Raphaël Hertzog 15 年之前
父节点
当前提交
0146724324
共有 3 个文件被更改,包括 20 次插入1 次删除
  1. 3 0
      debian/changelog
  2. 5 1
      scripts/Dpkg/Control/Fields.pm
  3. 12 0
      scripts/dpkg-source.pl

+ 3 - 0
debian/changelog

@@ -92,6 +92,9 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     spotting it.
     spotting it.
   * Use the correct mtime when installing a file with statoverrides.
   * Use the correct mtime when installing a file with statoverrides.
     LP: #739179
     LP: #739179
+  * Add new Package-List field to .dsc files as requested by ftpmasters.
+    It contains a the list of packages that the source builds along with
+    their sections and priorities. Closes: #619131
 
 
   [ Jonathan Nieder ]
   [ Jonathan Nieder ]
   * Remove support for use of synchronous sync(2), due to its pernicious
   * Remove support for use of synchronous sync(2), due to its pernicious

+ 5 - 1
scripts/Dpkg/Control/Fields.pm

@@ -161,6 +161,9 @@ our %FIELDS = (
     'Package' => {
     'Package' => {
         allowed => ALL_PKG,
         allowed => ALL_PKG,
     },
     },
+    'Package-List' => {
+        allowed => ALL_SRC & ~CTRL_INFO_SRC,
+    },
     'Package-Type' => {
     'Package-Type' => {
         allowed => ALL_PKG,
         allowed => ALL_PKG,
     },
     },
@@ -288,7 +291,8 @@ our %FIELD_ORDER = (
         qw(Format Source Binary Architecture Version Origin Maintainer
         qw(Format Source Binary Architecture Version Origin Maintainer
         Uploaders Homepage Standards-Version Vcs-Browser
         Uploaders Homepage Standards-Version Vcs-Browser
         Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn
         Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn
-        Vcs-Svn), &field_list_src_dep(), @checksum_fields, qw(Files)
+        Vcs-Svn), &field_list_src_dep(), qw(Package-List),
+        @checksum_fields, qw(Files)
     ],
     ],
     CTRL_FILE_CHANGES() => [
     CTRL_FILE_CHANGES() => [
         qw(Format Date Source Binary Architecture Version Distribution
         qw(Format Date Source Binary Architecture Version Distribution

+ 12 - 0
scripts/dpkg-source.pl

@@ -220,6 +220,10 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
 
 
     # Scan control info of source package
     # Scan control info of source package
     my $src_fields = $control->get_source();
     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}) {
     foreach $_ (keys %{$src_fields}) {
 	my $v = $src_fields->{$_};
 	my $v = $src_fields->{$_};
 	if (m/^Source$/i) {
 	if (m/^Source$/i) {
@@ -242,8 +246,15 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
     }
     }
 
 
     # Scan control info of binary packages
     # Scan control info of binary packages
+    my @pkglist;
     foreach my $pkg ($control->get_packages()) {
     foreach my $pkg ($control->get_packages()) {
 	my $p = $pkg->{'Package'};
 	my $p = $pkg->{'Package'};
+	my $sect = $pkg->{'Section'} || $src_sect;
+	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);
 	push(@binarypackages,$p);
 	push(@binarypackages,$p);
 	foreach $_ (keys %{$pkg}) {
 	foreach $_ (keys %{$pkg}) {
 	    my $v = $pkg->{$_};
 	    my $v = $pkg->{$_};
@@ -272,6 +283,7 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
             }
             }
 	}
 	}
     }
     }
+    $fields->{'Package-List'} .= "\n" . join("\n", sort @pkglist);
     if (grep($_ eq 'any', @sourcearch)) {
     if (grep($_ eq 'any', @sourcearch)) {
         # If we encounter one 'any' then the other arches become insignificant.
         # If we encounter one 'any' then the other arches become insignificant.
         @sourcearch = ('any');
         @sourcearch = ('any');