Browse Source

Recognize again architecture wildcards. Closes: #424670

Guillem Jover 17 years ago
parent
commit
6f38a08d7c
3 changed files with 40 additions and 8 deletions
  1. 9 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 30 8
      scripts/controllib.pl

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2007-05-24  Guillem Jover  <guillem@debian.org>
+
+	* 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  <guillem@debian.org>
 
 	Revert commit on 2007-04-28 by Aaron M. Ucko  <ucko@debian.org>.

+ 1 - 0
debian/changelog

@@ -10,6 +10,7 @@ dpkg (1.14.4) UNRELEASED; urgency=low
     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).

+ 30 - 8
scripts/controllib.pl

@@ -255,19 +255,41 @@ sub debarch_to_debtriplet($)
     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 = $_;
+    }
+
+    my $triplet = $debarch_to_debtriplet{$arch};
 
-	if (defined($triplet)) {
-	    return split('-', $triplet, 3);
+    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 @@ sub debarch_is($$)
 {
     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));