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

Bug#179661: Support for hyphenated GNU OS values



Package: dpkg
Version: 1.10.9
Severity: wishlist
Tags: patch

Two new GNU OS values relevant to the Debian project have hyphens in their
OS fields (netbsdelf-gnu and freebsd-gnu). When handling one of these
systems, dpkg-architecture returns invalid values for some fields (in
particular, GNU_SYSTEM entries), and can cause them to be mistaken for Hurd
systems (since the parsing returns the part beyond the last hyphen in the
GNU_TYPE variable, resulting in a bare 'gnu' in both cases).

I have attached patches to dpkg-architecture.pl that change how the string
handling is done, and should cope with any hyphenated value for upstream
GNU OS names.
-- 
Joel Baker <fenton@debian.org>
diff -ur dpkg-1.10.9.orig/scripts/dpkg-architecture.pl dpkg-1.10.9/scripts/dpkg-architecture.pl
--- dpkg-1.10.9.orig/scripts/dpkg-architecture.pl	2003-02-03 04:02:35.000000000 +0000
+++ dpkg-1.10.9/scripts/dpkg-architecture.pl	2003-02-03 04:01:44.000000000 +0000
@@ -124,10 +124,9 @@
 }
 chomp $deb_build_arch;
 $deb_build_gnu_type = $archtable{$deb_build_arch};
-$deb_build_gnu_cpu = $deb_build_gnu_type;
-$deb_build_gnu_system = $deb_build_gnu_type;
-$deb_build_gnu_cpu =~ s/-.*$//;
-$deb_build_gnu_system =~ s/^.*-//;
+@deb_build_gnu_triple = split(/-/, $deb_build_gnu_type, 2);
+$deb_build_gnu_cpu = $deb_build_gnu_triple[0];
+$deb_build_gnu_system = $deb_build_gnu_triple[1];
 
 # Default host: Current gcc.
 $gcc = `\${CC:-gcc} --print-libgcc-file-name`;
@@ -154,8 +153,9 @@
 	$gcc=$archtable{$list[0]};
 	$deb_host_arch = $list[0];
 	$deb_host_gnu_type = $gcc;
-        ($deb_host_gnu_system = $gcc) =~ s/^.*-//;
-        ($deb_host_gnu_cpu = $gcc ) =~ s/-.*$//;
+	@deb_host_gnu_triple = split(/-/, $deb_host_gnu_type, 2);
+	$deb_host_gnu_cpu = $deb_host_gnu_triple[0];
+	$deb_host_gnu_system = $deb_host_gnu_triple[1];
     }
 }
 if (!defined($deb_host_arch)) {
@@ -214,9 +214,10 @@
 
 $deb_host_arch = $req_host_arch if $req_host_arch ne '';
 if ($req_host_gnu_type ne '') {
-    $deb_host_gnu_cpu = $deb_host_gnu_system = $deb_host_gnu_type = $req_host_gnu_type;
-    $deb_host_gnu_cpu =~ s/-.*$//;
-    $deb_host_gnu_system =~ s/^.*-//;
+    $deb_host_gnu_type = $req_host_gnu_type;
+    @deb_host_gnu_triple = split(/-/, $deb_host_gnu_type, 2);
+    $deb_host_gnu_cpu = $deb_host_gnu_triple[0];
+    $deb_host_gnu_system = $deb_host_gnu_triple[1];
 }
 
 #$gcc = `\${CC:-gcc} --print-libgcc-file-name`;

Attachment: pgpqqaOr0GASb.pgp
Description: PGP signature


Reply to: