[slind-devel] [PATCH] dpkg armel support

Mikhail Gusarov dottedmag at dottedmag.net
Wed Apr 23 20:59:30 MSD 2008


- armel added to list of architectures
- /usr/share/dpkg/oscputable added

Current dpkg-architecture can't return arm-linux-gnueabi given 'linux-armel', so
additional table has been invented.

Upstream dpkg solves this in different, more complicated manner, by introducing
Debian triples, very like GNU triples, but it is not necessary to port this
machinery to Slind, it's easier to port to upstream dpkg one day.
---
 debian/archtable             |    2 ++
 debian/changelog             |   17 +++++++++++++++++
 debian/oscputable            |   10 ++++++++++
 debian/rules                 |    1 +
 scripts/dpkg-architecture.pl |   14 ++++++++++++++
 5 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 debian/oscputable

diff --git a/debian/archtable b/debian/archtable
index f9b9e8d..557be52 100644
--- a/debian/archtable
+++ b/debian/archtable
@@ -20,6 +20,8 @@ arm-linux-gnu			arm
 arm-linux-uclibc		uclibc-arm
 armeb-linux-gnu			armeb
 armeb-linux-uclibc		uclibc-armeb
+arm-linux-gnueabi		armel
+arm-linux-uclibcieabi		uclibc-armel
 hppa-linux-gnu			hppa
 m68k-linux-gnu			m68k
 mips-linux-gnu			mips
diff --git a/debian/changelog b/debian/changelog
index a27ad71..6bf8445 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+dpkg (1:1.13.25.slind2) unstable; urgency=low
+
+  armel support added:
+
+  - debian/archtable updated, adding armel.
+
+  - dpkg-architecture reads new file, /usr/share/oscputable, as it is
+    impossible to distinguish two systems with different ABIs, but with
+    the same CPU and OS in current scheme.
+
+    This is stopgap implementataion, as upstream already handles this
+    situation.
+
+  - debian/oscputable added, containing entry for armel.
+
+ -- Mikhail Gusarov <dottedmag at dottedmag.net>  Tue, 22 Apr 2008 00:22:23 +0700
+
 dpkg (1:1.13.25.slind1) unstable; urgency=low
 
   * Slind version.
diff --git a/debian/oscputable b/debian/oscputable
new file mode 100644
index 0000000..9ef28c2
--- /dev/null
+++ b/debian/oscputable
@@ -0,0 +1,10 @@
+# This file contains the table of known GNU triplets which cannot be deduced
+# from CPU and OS mappings.
+
+#
+# Column 1 is the Debian name for the system.
+# Column 2 is the Debian name for the CPU.
+# Column 3 is the GNU triplet for the given combination of system and CPU.
+#
+# <Debian system> <Debian CPU> <GNU triple>
+linux             armel        arm-linux-gnueabi
diff --git a/debian/rules b/debian/rules
index 187aee0..7322382 100755
--- a/debian/rules
+++ b/debian/rules
@@ -73,6 +73,7 @@ install: build
 	cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
 	install -m 644 debian/archtable debian/tmp/usr/share/dpkg/archtable
 	install -m 644 debian/cputable.slind debian/tmp/usr/share/dpkg/cputable
+	install -m 644 debian/oscputable debian/tmp/usr/share/dpkg/oscputable
 
 # Put together the dpkg and dselect packages
 binary-arch: install
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index 1c2b30b..61a98c4 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -92,6 +92,17 @@ sub read_ostable {
     close OSTABLE;
 }
 
+sub read_oscputable {
+    open OSCPUTABLE, "$pkgdatadir/oscputable"
+        or return;
+    while (<OSCPUTABLE>) {
+        if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
+            $oscputable{"$1-$2"} = $3;
+        }
+    }
+    close OSCPUTABLE;
+}
+
 sub split_debian {
     local ($_) = @_;
     
@@ -106,6 +117,8 @@ sub debian_to_gnu {
     local ($arch) = @_;
     local ($os, $cpu) = &split_debian($arch);
 
+    return $oscputable{"$os-$cpu"} if exists($oscputable{"$os-$cpu"});
+
     return undef unless exists($cputable{$cpu}) && exists($ostable{$os});
     return join("-", $cputable{$cpu}, $ostable{$os});
 }
@@ -143,6 +156,7 @@ sub gnu_to_debian {
 
 &read_cputable;
 &read_ostable;
+&read_oscputable;
 
 # Check for -L
 if (grep { m/^-L$/ } @ARGV) {
-- 
1.5.5



More information about the slind-devel mailing list