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

Preliminary patches to remove dpkg-cross diversions



OK, I now have two patches (and a dummy changelog patch that just acts
to separate these changes from the existing dpkg packages) attached. I
also have maintainer script changes that remove any previous dpkg-cross
diversions upon installation of / upgrade to the new code.

dpkg-cross pre2 now depends on binutils-multiarch and this makes the
patches to dpkg-buildpackage and dpkg-shlibdeps in dpkg almost trivial.

Most of the detailed work in the enhanced 'dpkg-buildpackage -a' is done
by scripts provided by dpkg-cross but the patch to dpkg-shlibdeps
completely replaces the previous dpkg-cross code, courtesy of
binutils-multiarch, by checking the values returned by
dpkg-architecture.

I'm continuing to test the dpkg-cross code so the patches are submitted
here for review really. Once testing is complete I can submit a bug
report with the patches if that is preferable.

dpkg-cross will need to depend on the version of dpkg-dev that contains
the final versions of these patches *before* it leaves experimental.

For now, the old versions of the dpkg-cross scripts will be retained
in /usr/share/dpkg-cross/ to support bespoke configurations, corner
cases and other situations where the rewrite still needs work.

The changes in dpkg-dev are almost trivial (and, I hope,
self-explanatory after my previous posts).

Finally, this means that bug reports filed against dpkg for native
builds cannot be confused by having dpkg-cross also installed. The
dpkg-cross code is only called during a cross-build - i.e. only when
the -a option is supplied to dpkg-buildpackage.

With dpkg-cross pre2, the diversions are gone for good.
;-)

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

--- dpkg-1.14.5/scripts/dpkg-buildpackage.sh	2007-08-27 13:14:12.000000000 +0100
+++ dpkg.new/scripts/dpkg-buildpackage.sh	2007-08-27 13:14:49.000000000 +0100
@@ -84,6 +84,18 @@
 passopts=''
 admindir=''
 
+DPKGCROSSENABLE=0
+if [ -f /usr/share/dpkg-cross/buildcross ]; then
+ . /usr/share/dpkg-cross/buildcross
+ DPKGCROSSENABLE=1
+fi
+
+function enhance_cross {
+	if [ $DPKGCROSSENABLE -gt 0 ]; then
+		setup_cross
+	fi
+}
+
 while [ $# != 0 ]
 do
 	value="`echo x\"$1\" | sed -e 's/x--.*=//;s/^x-.//'`"
@@ -104,7 +116,7 @@
 	-us)	signsource=: ;;
 	-uc)	signchanges=: ;;
 	-ap)	usepause="true";;
-	-a*)    targetarch="$value"; checkbuilddep=false ;;
+	-a*)    targetarch="$value"; checkbuilddep=false; enhance_cross ;;
 	-si)	sourcestyle=-si ;;
 	-sa)	sourcestyle=-sa ;;
 	-sd)	sourcestyle=-sd ;;
@@ -181,7 +193,7 @@
 	if test "$signinterface" = "gpg" ; then
 		(cat "../$1" ; echo "") | \
 		$signcommand --local-user "${signkey:-$maintainer}" --clearsign --armor \
-			--textmode  > "../$1.asc" 
+			--textmode  > "../$1.asc"
 	else
 		$signcommand -u "${signkey:-$maintainer}" +clearsig=on -fast <"../$1" \
 			>"../$1.asc"
@@ -226,7 +238,7 @@
 	cd ..; withecho dpkg-source $passopts $diffignore $tarignore -b "$dirn"; cd "$dirn"
 fi
 if [ x$sourceonly = x ]; then
-	withecho debian/rules build 
+	withecho debian/rules build
 	withecho $rootcommand debian/rules $binarytarget
 fi
 if [ "$usepause" = "true" ] && \
@@ -251,7 +263,7 @@
 	fir=$?
 	set -e
 	return $fir
-}	
+}
 
 
 if fileomitted '\.deb'; then
--- dpkg.new/debian/changelog	2007-08-27 13:04:42.000000000 +0100
+++ dpkg-1.14.5/debian/changelog	2007-08-27 13:24:56.000000000 +0100
@@ -1,3 +1,11 @@
+dpkg (1.14.5.1) unstable; urgency=low
+
+  * Dummy entry to test the patches.
+  * Include patches to support removal of dpkg-cross diversions
+  for dpkg-buildpackage and dpkg-shlibdeps
+
+ -- Neil Williams <codehelp@debian.org>  Mon, 27 Aug 2007 12:58:20 +0100
+
 dpkg (1.14.5) unstable; urgency=low
 
   [ Guillem Jover ]
--- dpkg-1.14.5/scripts/dpkg-shlibdeps.pl	2007-08-27 13:14:06.000000000 +0100
+++ dpkg.new/scripts/dpkg-shlibdeps.pl	2007-08-27 13:16:46.000000000 +0100
@@ -75,6 +75,16 @@
 "), $progname, join("/",@depfields);
 }
 
+# detect cross-compilation
+my $result = `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp($result);
+my $host_arch = $result;
+$result = `dpkg-architecture -qDEB_BUILD_ARCH`;
+chomp($result);
+my $target_arch = $result;
+my $use_cross = 0;
+$use_cross = 1 if ($host_arch ne $target_arch);
+
 my ($stdout, @exec, @execfield);
 foreach (@ARGV) {
     if (m/^-T/) {
@@ -134,8 +144,16 @@
     }
 }
 
-my @librarypaths = qw( /lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
-		       /emul/ia32-linux/lib /emul/ia32-linux/usr/lib );
+my $crossprefix = '/';
+if ($use_cross)
+{
+	$crossprefix = `dpkg-architecture -qDEB_HOST_GNU_TYPE`;
+	chomp($crossprefix);
+	$crossprefix = "$crossprefix/";
+}
+my @librarypaths = ( "${crossprefix}lib", "/usr/${crossprefix}lib", "${crossprefix}lib32",
+		"/usr/${crossprefix}lib32", "${crossprefix}lib64", "/usr/${crossprefix}lib64",
+		"/emul/ia32-linux/lib", "/emul/ia32-linux/usr/lib" );
 my %librarypaths = map { $_ => 'default' } @librarypaths;
 
 if ($ENV{LD_LIBRARY_PATH}) {

Attachment: pgpFyb4PROthH.pgp
Description: PGP signature


Reply to: