The following commit has been merged in the master branch:
commit 3624a4b0eb5499f367c1d8077240f151903cd70a
Author: Philipp Kern <pk...@debian.org>
Date:   Sat May 2 11:39:00 2009 +0200

    dpkg-source: do not set arch:any in dsc on arch-restricted packages
    
    dpkg-source was pretty liberal in setting 'Architecture: any' in the
    dsc: as soon as there are two binary packages, one being arch:all and
    one being arch-restricted, you get arch:any in the dsc. This is
    incorrect because the package will only build on the autobuilders
    if there are architecture-dependent binary packages available.
    
    Thus this patch only produces arch:any if at least one binary package
    specifies it. Otherwise it outputs the set of all binary architectures
    (including arch:all).
    
    Closes: #526617
    
    Signed-off-by: Philipp Kern <pk...@debian.org>

diff --git a/debian/changelog b/debian/changelog
index 1fc1546..1c88a38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -72,6 +72,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
     - Add kfreebsd-i386 and kfreebsd-amd64.
   * Add avr32 to cputable. Closes: #523456
   * Detect the curses headers to use instead of hardcoding them.
+  * Make dpkg-source do not set arch:any in .dsc on arch-restricted packages.
+    Thanks to Philipp Kern <pk...@debian.org>. Closes: #526617
 
   [ Frank Lichtenheld ]
   * Dpkg::Version: Remove unnecessary function next_elem which just
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 75482d0..6ea264c 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -195,31 +195,23 @@ if ($options{'opmode'} eq 'build') {
        foreach $_ (keys %{$pkg}) {
            my $v = $pkg->{$_};
             if (m/^Architecture$/) {
-               if (debarch_eq($v, 'any')) {
-                    @sourcearch= ('any');
-               } elsif (debarch_eq($v, 'all')) {
-                    if (!...@sourcearch || $sourcearch[0] eq 'all') {
-                        @sourcearch= ('all');
-                    } else {
-                        @sourcearch= ('any');
-                    }
+                # Gather all binary architectures in one set. 'any' and 'all'
+                # are special-cased as they need to be the only ones in the
+                # current stanza if present.
+                if (debarch_eq($v, 'any') || debarch_eq($v, 'all')) {
+                    push(@sourcearch, $v) unless $archadded{$v}++;
                 } else {
-                   if (@sourcearch && grep($sourcearch[0] eq $_, 'any', 
'all')) {
-                       @sourcearch= ('any');
-                   } else {
-                       for my $a (split(/\s+/, $v)) {
-                           error(_g("`%s' is not a legal architecture string"),
-                                 $a)
-                               unless $a =~ /^[\w-]+$/;
-                           error(_g("architecture %s only allowed on its " .
-                                    "own (list for package %s is `%s')"),
-                                 $a, $p, $a)
-                               if grep($a eq $_, 'any','all');
-                            push(@sourcearch,$a) unless $archadded{$a}++;
-                        }
-                }
+                    for my $a (split(/\s+/, $v)) {
+                        error(_g("`%s' is not a legal architecture string"),
+                              $a)
+                            unless $a =~ /^[\w-]+$/;
+                        error(_g("architecture %s only allowed on its " .
+                                 "own (list for package %s is `%s')"),
+                              $a, $p, $a)
+                            if grep($a eq $_, 'any', 'all');
+                        push(@sourcearch, $a) unless $archadded{$a}++;
+                    }
                 }
-                $fields->{'Architecture'}= join(' ',@sourcearch);
             } elsif (s/^X[BC]*S[BC]*-//i) { # Include XS-* fields
                 $fields->{$_} = $v;
             } elsif (m/^$control_pkg_field_regex$/ ||
@@ -229,6 +221,11 @@ if ($options{'opmode'} eq 'build') {
             }
        }
     }
+    if (grep($_ eq 'any', @sourcearch)) {
+        # If we encounter one 'any' then the other arches become insignificant.
+        @sourcearch = ('any');
+    }
+    $fields->{'Architecture'} = join(' ', @sourcearch);
 
     # Scan fields of dpkg-parsechangelog
     foreach $_ (keys %{$changelog}) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to