tags 587354 + patch
thanks

On Mo, 2010-06-28 at 22:04 +0300, Eugene V. Lyubimkin wrote:
> package libcupt-perl
> tags 587354 + wishlist confirmed
> thanks
> 
> Hi,
> 
> Julian Andres Klode wrote:
> > Package: libcupt-perl
> > Version: 1.5.13
> > 
> > Having a implemented a somewhat static subset
> > of architectures wildcards in APT yesterday
> > and today (Bug#547724); I noticed that cupt
> > seems to miss support for them. While they
> > are not part of policy yet, it would be nice
> > to have them, as some packages already use
> > them.
> 
> Accepted. Not in policy, so as wishlist. Patches welcome :)
It is part of Policy 3.9.0.0 which was released at 17:20 UTC this day
(less than 3 hours ago).

Patch is attached (same technique as for the APT one which might break
for new architectures, as the list of overrides is static). Parsing the
table might make more sense in the long term, but for now that patch is
all that is needed.

Regards,
Julian
-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

>From 608e99453ee796ef6f16fdfb0a1145f8b4d68e8b Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <j...@debian.org>
Date: Mon, 28 Jun 2010 22:15:36 +0200
Subject: [PATCH] architectured relation: Support wildcards.

---
 Cupt/Cache/ArchitecturedRelation.pm |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/Cupt/Cache/ArchitecturedRelation.pm b/Cupt/Cache/ArchitecturedRelation.pm
index f0d4903..ce6dc9c 100644
--- a/Cupt/Cache/ArchitecturedRelation.pm
+++ b/Cupt/Cache/ArchitecturedRelation.pm
@@ -97,6 +97,29 @@ sub stringify {
 
 =head1 FREE SUBROUTINES
 
+=head2 complete_architecture
+
+Return the complete architecture name for wildcard
+matching in the form <kernel>-<cpu>.
+
+Parameters:
+
+I<architecture> - string, the Debian architecture
+
+=cut
+
+sub complete_architecture {
+	my ($arch) = @_;
+    return "linux-arm"     if ($arch eq "armel");
+	return "linux-i386"    if ($arch eq "lpia");
+	return "linux-powerpc" if ($arch eq "powerpcspe");
+    return "linux-arm"     if ($arch eq "uclibc-linux-armel");
+    return "uclinux-arm"   if ($arch eq "uclinux-armel");
+    return $arch if ($arch =~ m/-/);
+    return 'linux-'.$arch;
+}
+
+
 =head2 unarchitecture_relation_expressions
 
 free subroutine, converts array of architectured relation expressions to array
@@ -112,6 +135,7 @@ I<current_architecture> - string, current architecture
 
 sub unarchitecture_relation_expressions ($$) {
 	my ($ref_architectured_relation_expressions, $current_architecture) = @_;
+	my $complete_architecture = complete_architecture($current_architecture);
 
 	my $sub_is_appropriate_relation = sub {
 		my ($architectured_relation) = @_;
@@ -121,8 +145,11 @@ sub unarchitecture_relation_expressions ($$) {
 		if ($architectures[0] =~ m/^!/) {
 			# negative architecture specifications, see Debian Policy §7.1
 			foreach my $architecture (@architectures) {
+				my $wildcard = $architecture;
+				$wildcard =~ s/any/.*/g;
 				$architecture =~ s/^!//;
-				if ($current_architecture eq $architecture) {
+				if ($current_architecture eq $architecture or
+				    $complete_architecture =~ m/^$wildcard$/) {
 					# not our case
 					return 0;
 				}
@@ -131,7 +158,10 @@ sub unarchitecture_relation_expressions ($$) {
 		} else {
 			# positive architecture specifications, see Debian Policy §7.1
 			foreach my $architecture (@architectures) {
-				if ($current_architecture eq $architecture) {
+				my $wildcard = $architecture;
+				$wildcard =~ s/any/.*/g;
+				if ($current_architecture eq $architecture or
+				    $complete_architecture =~ m/^$wildcard$/) {
 					# our case
 					return 1;
 				}
-- 
1.7.1

Reply via email to