Here's a new patch that will allow sbuild to support packages that add 
the 'Architecture' fields with any of the architecture wildcards, along with 
the Package interrelationship fields using the wildcards.

--
Regards,
Andres
--- lib/Sbuild/Build.pm.old	2009-03-27 17:54:25.000000000 -0400
+++ lib/Sbuild/Build.pm	2009-03-27 17:57:05.000000000 -0400
@@ -339,12 +339,23 @@
 	$self->log("$dsc has no Architecture: field -- skipping arch check!\n");
     }
     else {
-	if ($dscarchs ne "any" && $dscarchs !~ /\b$arch\b/ &&
-	    !($dscarchs eq "all" && $self->get_conf('BUILD_ARCH_ALL')) )  {
-	    $self->log("$dsc: $arch not in arch list: $dscarchs -- skipping\n");
-	    $self->set('Pkg Fail Stage', "arch-check");
-	    return 0;
-	}
+    my $valid_arch;
+    my $dpkg_architecture = '/usr/bin/dpkg-architecture';
+    for my $a (split(/\s+/, $dscarchs)) {
+        if (system($dpkg_architecture,
+            '-a' . $arch, '-i' . $a) eq 0) {
+            $valid_arch = 1;
+            last;
+        }
+    }
+    if ($dscarchs ne "any" && !($valid_arch) &&
+        !($dscarchs eq "all" && $self->get_conf('BUILD_ARCH_ALL')) )  {
+        my $msg = "$dsc: $arch not in arch list or does not match any arch ";
+        $msg .= "wildcards: $dscarchs -- skipping\n";
+        $self->log($msg);
+        $self->set('Pkg Fail Stage', "arch-check");
+        return 0;
+    }
     }
 
     debug("Arch check ok ($arch included in $dscarchs)\n");
@@ -1848,11 +1859,16 @@
 		my @archs = split( /\s+/, $archlist );
 		my ($use_it, $ignore_it, $include) = (0, 0, 0);
 		foreach (@archs) {
+			# Let's use 'dpkg-architecture' so we can support architecture
+			# wildcards.
+			my $dpkg_architecture = '/usr/bin/dpkg-architecture';
 		    if (/^!/) {
-			$ignore_it = 1 if substr($_, 1) eq $self->get('Arch');
+			$ignore_it = 1 if system($dpkg_architecture, '-a' .
+				$self->get('Arch'), '-i' . substr($_, 1)) eq 0;
 		    }
 		    else {
-			$use_it = 1 if $_ eq $self->get('Arch');
+			$use_it = 1 if system($dpkg_architecture, '-a' .
+				$self->get('Arch'), '-i' . $_) eq 0;
 			$include = 1;
 		    }
 		}

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to