- support brackets in combination with alternatives (e.g. "foo [i386] | bar [amd64]")
authorMarcus Huewe <suse-tux@gmx.de>
Sun, 28 Feb 2010 18:54:05 +0000 (19:54 +0100)
committerMarcus Huewe <suse-tux@gmx.de>
Sun, 28 Feb 2010 18:54:05 +0000 (19:54 +0100)
Build/Deb.pm

index 88cd440..f613404 100644 (file)
@@ -62,24 +62,32 @@ sub parse {
     } elsif ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-CONFLICTS' || $tag eq 'BUILD-IGNORE' || $tag eq 'BUILD-DEPENDS-INDEP') {
       my @d = split(/,\s*/, $data);
       for my $d (@d) {
-       if ($d =~ /^(.*?)\s*\[(.*)\]$/) {
-         $d = $1;
-         my $isneg = 0;
-         my $bad;
-         for my $q (split('[\s,]', $2)) {
-           $isneg = 1 if $q =~ s/^\!//;
-           $bad = 1 if !defined($bad) && !$isneg;
-           if ($isneg) {
-             if ($q eq $arch || $q eq "$os-$arch") {
-               $bad = 1;
-               last;
-             }
-           } elsif ($q eq $arch || $q eq "$os-$arch") {
-             $bad = 0;
-           }
-         }
-         next if $bad;
-       }
+        my @alts = split('\s*\|\s*', $d);
+        my @needed;
+        for my $c (@alts) {
+          if ($c =~ /^(.*?)\s*\[(.*)\]$/) {
+            $c = $1;
+            my $isneg = 0;
+            my $bad;
+            for my $q (split('[\s,]', $2)) {
+              $isneg = 1 if $q =~ s/^\!//;
+              $bad = 1 if !defined($bad) && !$isneg;
+              if ($isneg) {
+                if ($q eq $arch || $q eq "$os-$arch") {
+                  $bad = 1;
+                  last;
+                }
+              } elsif ($q eq $arch || $q eq "$os-$arch") {
+                $bad = 0;
+              }
+            }
+            push @needed, $c unless $bad;
+          } else {
+            push @needed, $c;
+          }
+        }
+        next unless @needed;
+        $d = join(' | ', @needed);
        $d =~ s/ \(([^\)]*)\)/ $1/g;
        $d =~ s/>>/>/g;
        $d =~ s/<</</g;