Author: guillem
Date: 2007-05-24 16:22:43 +0000 (Thu, 24 May 2007)
New Revision: 792

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/scripts/controllib.pl
Log:
Recognize again architecture wildcards. Closes: #424670


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2007-05-24 08:14:20 UTC (rev 791)
+++ trunk/ChangeLog     2007-05-24 16:22:43 UTC (rev 792)
@@ -1,3 +1,12 @@
+2007-05-24  Guillem Jover  <[EMAIL PROTECTED]>
+
+       * scripts/controllib.pl (debarch_to_debtriplet): Match exactly 'any'
+       or 'all', recognize again 'linux-<arch>', and do not accept unknown
+       debtriplets.
+       (debwildcard_to_debtriplet): New function.
+       (debarch_is): Use debwildcard_to_debtriplet for the wildcard
+       parameter.
+
 2007-05-23  Guillem Jover  <[EMAIL PROTECTED]>
 
        Revert commit on 2007-04-28 by Aaron M. Ucko  <[EMAIL PROTECTED]>.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2007-05-24 08:14:20 UTC (rev 791)
+++ trunk/debian/changelog      2007-05-24 16:22:43 UTC (rev 792)
@@ -10,6 +10,7 @@
     Thanks to Kylan Robinson. Closes: #425629
   * Revert change on 1.14.0 from Aaron M. Ucko. Trim down duped entries only
     when passing them to dpkg-query instead. Closes: #425641
+  * Recognize again architecture wildcards. Closes: #424670
 
   [ Updated dpkg translations ]
   * French (Frédéric Bothamy).

Modified: trunk/scripts/controllib.pl
===================================================================
--- trunk/scripts/controllib.pl 2007-05-24 08:14:20 UTC (rev 791)
+++ trunk/scripts/controllib.pl 2007-05-24 16:22:43 UTC (rev 792)
@@ -255,19 +255,41 @@
     read_triplettable() if (!%debarch_to_debtriplet);
 
     local ($_) = @_;
+    my $arch;
 
-    if (/any/ || /all/) {
+    # FIXME: 'any' is handled here, to be able to do debarch_eq('any', foo).
+    if (/^any$/ || /^all$/) {
        return ($_, $_, $_);
-    } elsif (/^([^-]*)-([^-]*)-(.*)/) {
-       return ($1, $2, $3);
+    } elsif (/^linux-([^-]*)/) {
+       # XXX: Might disappear in the future, not sure yet.
+       $arch = $1;
     } else {
-       my $triplet = $debarch_to_debtriplet{$_};
+       $arch = $_;
+    }
 
-       if (defined($triplet)) {
-           return split('-', $triplet, 3);
+    my $triplet = $debarch_to_debtriplet{$arch};
+
+    if (defined($triplet)) {
+       return split('-', $triplet, 3);
+    } else {
+       return undef;
+    }
+}
+
+sub debwildcard_to_debtriplet($)
+{
+    local ($_) = @_;
+
+    if (/any/) {
+       if (/^([^-]*)-([^-]*)-(.*)/) {
+           return ($1, $2, $3);
+       } elsif (/^([^-]*)-([^-]*)$/) {
+           return ('any', $1, $2);
        } else {
-           return undef;
+           return ($_, $_, $_);
        }
+    } else {
+       return debarch_to_debtriplet($_);
     }
 }
 
@@ -286,7 +308,7 @@
 {
     my ($real, $alias) = @_;
     my @real = debarch_to_debtriplet($real);
-    my @alias = debarch_to_debtriplet($alias);
+    my @alias = debwildcard_to_debtriplet($alias);
 
     return 0 if grep(!defined, (@real, @alias));
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to