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

Guillem Jover added triplet support to dpkg 1.13.18 in order to properly
support the armel architecture (arm-linux-gnueabi in GNU-speak).

This is the orginal message/patch
http://lists.debian.org/debian-embedded/2006/05/msg00032.html

I have rebased this for 1.13.25 in case it helps.
tested patch attached.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-k7
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages dpkg depends on:
ii  coreutils                   5.97-5.3     The GNU core utilities
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries

dpkg recommends no packages.

-- no debconf information

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

diff -urN dpkg-1.13.25.orig/m4/arch.m4 dpkg-1.13.25/m4/arch.m4
--- dpkg-1.13.25.orig/m4/arch.m4        2006-08-18 03:54:23.000000000 +0100
+++ dpkg-1.13.25/m4/arch.m4     2007-02-14 02:26:31.000000000 +0000
@@ -52,6 +52,25 @@
 DPKG_OS_TYPE
 AC_MSG_CHECKING([dpkg architecture name])
 _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch])
+case "$os_type-$cpu_type" in
+(gnueabi-linux-arm)
+       dpkg_arch=armel
+       ;;
+(gnu-linux-*)
+       dpkg_arch=$cpu_type
+       ;;
+(gnu-*)
+       t=`echo $os_type | sed -e 's:gnu::'`
+       dpkg_arch="$t-$cpu_type"
+       ;;
+(none-*)
+       t=`echo $os_type | sed -e 's:none::'`
+       dpkg_arch="$t-$cpu_type"
+       ;;
+(*)
+       dpkg_arch="$os_type-$cpu_type"
+       ;;
+esac
 AC_MSG_RESULT([$dpkg_arch])
 AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_arch}",
        [Set this to the canonical dpkg architecture name.])
diff -urN dpkg-1.13.25.orig/ostable dpkg-1.13.25/ostable
--- dpkg-1.13.25.orig/ostable   2006-06-21 14:33:54.000000000 +0100
+++ dpkg-1.13.25/ostable        2007-02-14 02:27:47.000000000 +0000
@@ -13,11 +13,12 @@
 # system part of the output of the GNU config.guess script.
 #
 # <Debian name>        <GNU name>      <config.guess regex>
-linux          linux-gnu       linux[^-]*(-gnu.*)?
-darwin         darwin          darwin[^-]*
-freebsd                freebsd         freebsd[^-]*
-kfreebsd       kfreebsd-gnu    kfreebsd[^-]*(-gnu.*)?
-knetbsd                knetbsd-gnu     knetbsd[^-]*(-gnu.*)?
-netbsd         netbsd          netbsd[^-]*
-openbsd                openbsd         openbsd[^-]*
-hurd           gnu             gnu[^-]*
+gnueabi-linux  linux-gnueabi   linux[^-]*-gnueabi
+gnu-linux      linux-gnu       linux[^-]*(-gnu)?
+gnu-hurd       gnu             gnu[^-]*
+gnu-kfreebsd   kfreebsd-gnu    kfreebsd[^-]*(-gnu)?
+gnu-knetbsd    knetbsd-gnu     knetbsd[^-]*(-gnu)?
+bsd-darwin     darwin          darwin[^-]*
+bsd-freebsd    freebsd         freebsd[^-]*
+bsd-netbsd     netbsd          netbsd[^-]*
+bsd-openbsd    openbsd         openbsd[^-]*
diff -urN dpkg-1.13.25.orig/scripts/controllib.pl 
dpkg-1.13.25/scripts/controllib.pl
--- dpkg-1.13.25.orig/scripts/controllib.pl     2006-11-24 04:05:39.000000000 
+0000
+++ dpkg-1.13.25/scripts/controllib.pl  2007-02-14 02:30:42.000000000 +0000
@@ -88,8 +88,12 @@
 {
     local ($os, $cpu) = @_;
 
-    if ($os eq "linux") {
+    if ($os eq "gnu-linux") {
        return $cpu;
+    } elsif ($os =~ /^(none|gnu)-(.*)/) {
+       return "$2-$cpu";
+    } elsif ("$os-$cpu" eq "gnueabi-linux-arm") {
+       return "armel";
     } else {
        return "$os-$cpu";
     }
@@ -102,8 +106,10 @@
        return ($1, $2);
     } elsif (/any/ || /all/) {
        return ($_, $_);
+    } elsif (/^armel$/) {
+       return ("gnueabi-linux", "arm");
     } else {
-       return ("linux", $_);
+       return ("gnu-linux", $_);
     }
 }
 
diff -urN dpkg-1.13.25.orig/scripts/dpkg-architecture.pl 
dpkg-1.13.25/scripts/dpkg-architecture.pl
--- dpkg-1.13.25.orig/scripts/dpkg-architecture.pl      2006-08-18 
03:54:24.000000000 +0100
+++ dpkg-1.13.25/scripts/dpkg-architecture.pl   2007-02-14 02:41:28.000000000 
+0000
@@ -95,19 +95,23 @@
 sub split_debian {
     local ($_) = @_;
     
-    if (/^([^-]*)-(.*)/) {
-       return ($1, $2);
+    if (/^([^-]*)-([^-]*)-(.*)/) {
+       return ($1, $2, $3);
+    } elsif (/^([^-]*)-(.*)/) {
+       return ("gnu", $1, $2);
+    } elsif (/^armel/) {
+       return ("gnueabi", "linux", "arm");
     } else {
-       return ("linux", $_);
+       return ("gnu", "linux", $_);
     }
 }
 
 sub debian_to_gnu {
     local ($arch) = @_;
-    local ($os, $cpu) = &split_debian($arch);
+    local ($abi, $os, $cpu) = &split_debian($arch);
 
-    return undef unless exists($cputable{$cpu}) && exists($ostable{$os});
-    return join("-", $cputable{$cpu}, $ostable{$os});
+    return undef unless exists($cputable{$cpu}) && 
exists($ostable{"$abi-$os"});
+    return join("-", $cputable{$cpu}, $ostable{"$abi-$os"});
 }
 
 sub split_gnu {
@@ -252,20 +256,22 @@
 &warn(sprintf(_g("Specified GNU system type %s does not match gcc system type 
%s."), $deb_host_gnu_type, $gcc)) if !($req_is_arch or $req_eq_arch) && ($gcc 
ne '') && ($gcc ne $deb_host_gnu_type);
 
 # Split the Debian and GNU names
-($deb_host_arch_os, $deb_host_arch_cpu) = &split_debian($deb_host_arch);
-($deb_build_arch_os, $deb_build_arch_cpu) = &split_debian($deb_build_arch);
+($deb_host_arch_abi, $deb_host_arch_os, $deb_host_arch_cpu) = 
&split_debian($deb_host_arch);
+($deb_build_arch_abi, $deb_build_arch_os, $deb_build_arch_cpu) = 
&split_debian($deb_build_arch);
 ($deb_host_gnu_cpu, $deb_host_gnu_system) = &split_gnu($deb_host_gnu_type);
 ($deb_build_gnu_cpu, $deb_build_gnu_system) = &split_gnu($deb_build_gnu_type);
 
 %env = ();
 if (!$force) {
     $deb_build_arch = $ENV{DEB_BUILD_ARCH} if (exists $ENV{DEB_BUILD_ARCH});
+    $deb_build_arch_abi = $ENV{DEB_BUILD_ARCH_ABI} if (exists 
$ENV{DEB_BUILD_ARCH_ABI});
     $deb_build_arch_os = $ENV{DEB_BUILD_ARCH_OS} if (exists 
$ENV{DEB_BUILD_ARCH_OS});
     $deb_build_arch_cpu = $ENV{DEB_BUILD_ARCH_CPU} if (exists 
$ENV{DEB_BUILD_ARCH_CPU});
     $deb_build_gnu_cpu = $ENV{DEB_BUILD_GNU_CPU} if (exists 
$ENV{DEB_BUILD_GNU_CPU});
     $deb_build_gnu_system = $ENV{DEB_BUILD_GNU_SYSTEM} if (exists 
$ENV{DEB_BUILD_GNU_SYSTEM});
     $deb_build_gnu_type = $ENV{DEB_BUILD_GNU_TYPE} if (exists 
$ENV{DEB_BUILD_GNU_TYPE});
     $deb_host_arch = $ENV{DEB_HOST_ARCH} if (exists $ENV{DEB_HOST_ARCH});
+    $deb_host_arch_abi = $ENV{DEB_HOST_ARCH_ABI} if (exists 
$ENV{DEB_HOST_ARCH_ABI});
     $deb_host_arch_os = $ENV{DEB_HOST_ARCH_OS} if (exists 
$ENV{DEB_HOST_ARCH_OS});
     $deb_host_arch_cpu = $ENV{DEB_HOST_ARCH_CPU} if (exists 
$ENV{DEB_HOST_ARCH_CPU});
     $deb_host_gnu_cpu = $ENV{DEB_HOST_GNU_CPU} if (exists 
$ENV{DEB_HOST_GNU_CPU});
@@ -273,18 +279,20 @@
     $deb_host_gnu_type = $ENV{DEB_HOST_GNU_TYPE} if (exists 
$ENV{DEB_HOST_GNU_TYPE});
 }
 
[EMAIL PROTECTED] = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
[EMAIL PROTECTED] = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_ABI DEB_BUILD_ARCH_OS 
DEB_BUILD_ARCH_CPU
              DEB_BUILD_GNU_CPU DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
-             DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
+             DEB_HOST_ARCH DEB_HOST_ARCH_ABI DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
              DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
 
 $env{'DEB_BUILD_ARCH'}=$deb_build_arch;
+$env{'DEB_BUILD_ARCH_ABI'}=$deb_build_arch_abi;
 $env{'DEB_BUILD_ARCH_OS'}=$deb_build_arch_os;
 $env{'DEB_BUILD_ARCH_CPU'}=$deb_build_arch_cpu;
 $env{'DEB_BUILD_GNU_CPU'}=$deb_build_gnu_cpu;
 $env{'DEB_BUILD_GNU_SYSTEM'}=$deb_build_gnu_system;
 $env{'DEB_BUILD_GNU_TYPE'}=$deb_build_gnu_type;
 $env{'DEB_HOST_ARCH'}=$deb_host_arch;
+$env{'DEB_HOST_ARCH_ABI'}=$deb_host_arch_abi;
 $env{'DEB_HOST_ARCH_OS'}=$deb_host_arch_os;
 $env{'DEB_HOST_ARCH_CPU'}=$deb_host_arch_cpu;
 $env{'DEB_HOST_GNU_CPU'}=$deb_host_gnu_cpu;

Reply via email to