[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#337034: invalid-arch-string-in-source-relation does not know about some architectures



Here's a first attempt at a patch for this.  There is a certain degree 
of ugliness in there because dpkg-architecture doesn't seem to have the 
interface we need, but the patch certainly removes the false positives 
that I complained about in the bug submission.

Any comments?
diff -Nru /tmp/sgYfq3sg05/lintian-1.23.13/checks/common_data.pm /tmp/WtvDGKGrHp/lintian-1.23.13pe/checks/common_data.pm
--- /tmp/sgYfq3sg05/lintian-1.23.13/checks/common_data.pm	2005-07-11 15:08:12.000000000 +0200
+++ /tmp/WtvDGKGrHp/lintian-1.23.13pe/checks/common_data.pm	2005-11-30 20:03:28.000000000 +0100
@@ -12,12 +12,41 @@
 
 # simple defines for commonly needed data
 
+sub read_table_file {
+    my ($filename, $fieldnr) = @_;
+    my @result = ();
+
+    open(FILE, $filename) or die;
+    while($_ = <FILE>) {
+        next unless /^[a-z]/;
+        chomp;
+        my @fields = split /\s+/;
+        push @result, $fields[$fieldnr];
+    }
+
+    return @result;
+}
+
+%known_cpus = map { $_ => 1 }
+    read_table_file('/usr/share/dpkg/cputable', 0);
+
+%known_os = map { $_ => 1 }
+    read_table_file('/usr/share/dpkg/ostable', 0);
+
+my @os_cpu_product = ();
+foreach my $os (keys(%known_os)) {
+    foreach my $cpu (keys(%known_cpus)) {
+        push @os_cpu_product, "$os-$cpu";
+    }
+}
+
 %known_archs = map { $_ => 1 }
-    ('alpha', 'arm', 'hppa', 'hurd-i386', 'i386', 'ia64', 'mips', 'mipsel', 
-     'm68k', 'powerpc', 's390', 'sparc', 'any', 'all');
+    (keys(%known_cpus),
+     @os_cpu_product,
+     'any', 'all');
 
-%non_standard_archs = map { $_ => 1 }
-    ('amd64', 'ppc64', 'sh', 'kfreebsd-i386', 'knetbsd-i386');
+%standard_archs = map { $_ => 1 }
+    read_table_file('/usr/share/dpkg/archtable', 1);
 
 
 %known_sections = map { $_ => 1 }
diff -Nru /tmp/sgYfq3sg05/lintian-1.23.13/checks/fields /tmp/WtvDGKGrHp/lintian-1.23.13pe/checks/fields
--- /tmp/sgYfq3sg05/lintian-1.23.13/checks/fields	2005-08-13 01:44:18.000000000 +0200
+++ /tmp/WtvDGKGrHp/lintian-1.23.13pe/checks/fields	2005-11-30 20:04:34.000000000 +0100
@@ -105,7 +105,7 @@
 	}
 
 	for my $arch (@archs) {
-		if ($non_standard_archs{$arch}) {
+		if (! $standard_archs{$arch}) {
 			tag "non-standard-architecture", "$arch";
 		} elsif (! $known_archs{$arch}) {
 			tag "unknown-architecture", "$arch";
@@ -448,7 +448,7 @@
 					my ($d_pkg, $d_version, $d_arch, $rest, $part_d_orig) = @$part_d;
 
 					for my $arch (@{$d_arch->[0]}) {
-						if ($non_standard_archs{$arch}) {
+						if (! $standard_archs{$arch}) {
 							tag "non-standard-arch-in-source-relation", "$arch [$field: $part_d_orig]";
 						} elsif (!$known_archs{$arch} && $arch ne "any" && $arch ne "all") {
 							tag "invalid-arch-string-in-source-relation", "$arch [$field: $part_d_orig]"
diff -Nru /tmp/sgYfq3sg05/lintian-1.23.13/debian/changelog /tmp/WtvDGKGrHp/lintian-1.23.13pe/debian/changelog
--- /tmp/sgYfq3sg05/lintian-1.23.13/debian/changelog	2005-10-13 15:21:01.000000000 +0200
+++ /tmp/WtvDGKGrHp/lintian-1.23.13pe/debian/changelog	2005-11-30 20:07:04.000000000 +0100
@@ -1,3 +1,10 @@
+lintian (1.23.13pe) UNRELEASED; urgency=low
+
+  * Pull the list of architectures directly from /usr/share/dpkg/
+    (closes: #337034)
+
+ -- Peter Eisentraut <peter_e@gmx.net>  Wed, 30 Nov 2005 17:38:08 +0100
+
 lintian (1.23.13) unstable; urgency=low
 
   * The "doesn't contain all the fixes I would like but that's no

Reply to: