Hi,

thanks Gaudenz for testing the version in experimental and thanks Simon for
even preparing a patch!

Quoting Simon McVittie (2015-09-11 12:16:56)
> On Tue, 08 Sep 2015 at 08:03:26 +0200, Gaudenz Steinlin wrote:
> > The sbuild NMU to experimental broke building packages for i386 on an
> > amd64 host with an i386 chroot and setting personality=linux32 in the
> > schroot configuration. sbuild tries to wrongly install
> > build-essential:amd64 and fakeroot:amd64 into this chroot. It should
> > instead install i386 packages.
> 
> Please consider the attached patch. With this change applied to sbuild
> git master, these builds succeed on an amd64 machine, using a chroot
> sid-i386-sbuild previously created with sbuild-createchroot:
> 
> sbuild --arch=i386 -d unstable hello_2.10-1
> - Machine Architecture: amd64
> - Host Architecture: i386
> - Build Architecture: i386
> 
> sbuild --build=i386 --host=armhf -d unstable hello_2.10-1
> - Machine Architecture: amd64
> - Host Architecture: armhf
> - Build Architecture: i386

it seems the problem comes from the --arch command line option only setting the
BUILD_ARCH configuration option *after* the value CORE_DEPENDS is evaluated.

One solution (as proposed in Simons patch) would be to add the architecture
qualifier for the build architecture at a later point when the value of
BUILD_ARCH is not the default one anymore. But this solution has two problems:

 1. the CORE_DEPENDS option currently accepts package relationships in any
    format parseable by the libdpkg-perl function Dpkg::Deps::deps_parse(...,
    build_dep => 1, ...). This means one could give it "foobar (>= 1)" which
    would break with the proposed patch. One way to fix this would be to parse
    the CORE_DEPENDS with deps_parse and then set the architecture qualifier to
    the build architecture, but this leads to a second problem:

 2. if the user puts foobar:myarch in their CORE_DEPENDS, then I think they can
    reasonably expect that their architecture qualifier is not overwritten at
    some point.

I thus think that the proper fix would be the attached patch which, instead of
setting the build architecture manually, uses the :native qualifier in
CORE_DEPENDS. This would defer the translation of :native to the build
architecture to when the core dependencies are actually installed and would
also not suffer from either of the above problems.

Thanks!

cheers, josch
--- /tmp/Conf.pm	2015-09-11 14:37:51.878734086 +0200
+++ /usr/share/perl5/Sbuild/Conf.pm	2015-09-11 14:39:23.786485733 +0200
@@ -768,8 +768,8 @@
 	    TYPE => 'ARRAY:STRING',
 	    VARNAME => 'core_depends',
 	    GROUP => 'Core options',
-	    DEFAULT => ['build-essential:' . $conf->get('BUILD_ARCH'),
-			'fakeroot:' . $conf->get('BUILD_ARCH')],
+	    DEFAULT => ['build-essential:native',
+			'fakeroot:native'],
 	    HELP => 'Packages which must be installed in the chroot for all builds.'
 	},
 	'MANUAL_DEPENDS'			=> {
@@ -812,14 +812,14 @@
 	    TYPE => 'HASH:ARRAY:STRING',
 	    VARNAME => 'crossbuild_core_depends',
 	    GROUP => 'Multiarch support (transitional)',
-	    DEFAULT => { arm64 => ['crossbuild-essential-arm64:' . $conf->get('BUILD_ARCH')],
-			 armel => ['crossbuild-essential-armel:' . $conf->get('BUILD_ARCH')],
-			 armhf => ['crossbuild-essential-armhf:' . $conf->get('BUILD_ARCH')],
-			 ia64 => ['crossbuild-essential-ia64:' . $conf->get('BUILD_ARCH')],
-			 mips => ['crossbuild-essential-mips:' . $conf->get('BUILD_ARCH')],
-			 mipsel => ['crossbuild-essential-mipsel:' . $conf->get('BUILD_ARCH')],
-			 powerpc => ['crossbuild-essential-powerpc:' . $conf->get('BUILD_ARCH')],
-			 sparc => ['crossbuild-essential-sparc:' . $conf->get('BUILD_ARCH')]
+	    DEFAULT => { arm64 => ['crossbuild-essential-arm64:native'],
+			 armel => ['crossbuild-essential-armel:native'],
+			 armhf => ['crossbuild-essential-armhf:native'],
+			 ia64 => ['crossbuild-essential-ia64:native'],
+			 mips => ['crossbuild-essential-mips:native'],
+			 mipsel => ['crossbuild-essential-mipsel:native'],
+			 powerpc => ['crossbuild-essential-powerpc:native'],
+			 sparc => ['crossbuild-essential-sparc:native']
 	    	       },
 	    HELP => 'Per-architecture dependencies required for cross-building.'
 	},	'BUILD_SOURCE'				=> {

Attachment: signature.asc
Description: signature

Reply via email to