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

[PATCH] dpkg-cross: handle multi-arch packages too



Hi

Ubuntu 'natty' switched to multiarch recently and my cross toolchain
packages started to fail to build. Most of problems were fixed but then
dpkg-cross hit us.

Today I looked at dpkg-cross and made attached patch to handle problem.
What patch does is converting multiarch packages into old style ones.
There is no extra switch like "--force-even-when-multiarch" and
"--convert-anyway -A" is used instead. This is change against latest CVS
code (dpkg-cross r1.83).

>From my tests it looks like it does proper job.
Index: dpkg-cross
===================================================================
RCS file: /cvsroot/dpkg-cross/dpkg-cross/dpkg-cross,v
retrieving revision 1.83
diff -u -r1.83 dpkg-cross
--- dpkg-cross	23 Feb 2011 14:46:33 -0000	1.83
+++ dpkg-cross	23 Mar 2011 14:32:35 -0000
@@ -507,7 +507,7 @@
 	}
 	close(CONTROL);
 
-	if (defined ($control{'multi-arch'})) {
+	if (defined ($control{'multi-arch'}) and !$anyway) {
 		my $output = basename ($package);
 		warn sprintf(_g("%s: Skipping the '%s' Multi-Arch package.\n"), $progname, $output);
 		if (not -f $output) {
@@ -775,6 +775,16 @@
 		} elsif ((m:^/emul/ia32-linux/usr/lib/([^/]+\.[ao])$:)) {
 			# regular .a or .o file under /emul/ia32-linux/ for #463588
 			link_file("$src$_", "$dst$crosslib32/$1") or goto fail;
+		} elsif (m:^(/usr)?/lib/$crosstype/([^/]+\.[ao])$:) {
+			# regular .a or .o file under /lib or /usr/lib/TRIPLET/
+			link_file("$src$_", "$dst$crosslib/$crosstype/$2") or goto fail;
+		} elsif (m:^(/usr)?/lib/$crosstype/([^/]+\.so[^/]*)$:) {
+			# regular .so* file under /lib/TRIPLET or /usr/lib/TRIPLET 
+			if (is_ldscript("$src$_")) {
+				fix_ldscript("$src$_", "$dst$crosslib/$crosstype/$2") or goto fail;
+			} else {
+				link_file("$src$_", "$dst$crosslib/$crosstype/$2") or goto fail;
+			}
 		} elsif (m:^(/usr(/X11R6)?)?/lib/([^/]+\.so[^/]*)$:) {
 			# regular .so* file under /lib, /usr/lib or /usr/X11R6/lib
 			if (is_ldscript("$src$_")) {
@@ -914,7 +924,18 @@
 		# useful or packaged in the -cross package, basically anything
 		# in a directory beneath /usr/lib/. See #499292
 		# except pkgconfig symlinks, see #506956
-		next if (($lv =~ m:$crosslib/.*/:) and ($lv !~ m:$crosslib/pkgconfig/:));
+		# also handle multiarch packages with /usr/lib/TRIPLET/ directory
+		next if (
+		    (
+			($lv =~ m:$crosslib/$crosstype/.*/:) and 
+			($lv !~ m:$crosslib/$crosstype/pkgconfig/:)
+		    ) or
+		    (
+			($lv =~ m:$crosslib/.*/:) and 
+			($lv !~ m:$crosslib/pkgconfig/:) and
+			($lv !~ m:$crosslib/$crosstype/:) 
+		    )
+		);
 		$lv =~ m:$crosslib/(.*)$:;
 		# Translators, retain the -> to indicate the direction of the link.
 		printf (_g("Creating symlink %s -> %s\n"), $_, $1) if ($verbose >= 2);

Reply to: