Control: tags 798323 + patch

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

Regards,
    S
>From 18a082cd482954e0cbc350c6b1e3f43cb3a4bb32 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Fri, 11 Sep 2015 11:00:56 +0100
Subject: [PATCH] Fix use of foreign chroots, such as i386 on amd64 (Closes:
 #798323)

This partially reverts commit 9f77e648. When using a foreign chroot,
such as a complete i386 chroot on an amd64 machine,
the default build architecture $conf->get('BUILD_ARCH') does not
match the current build architecture $self->get('Build Arch').

Instead, achieve the same result as 9f77e648 by appending
$self->get('Build Arch') to each element of CORE_DEPENDS and
(if used) CROSSBUILD_CORE_DEPENDS at dummy package build time.

Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798323
---
 lib/Sbuild/Build.pm |  1 +
 lib/Sbuild/Conf.pm  | 19 +++++++++----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 5661cd7..3e56d75 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -679,6 +679,7 @@ sub run_fetch_install_packages {
 	    push(@coredeps, @{$crosscoredeps->{$self->get('Host Arch')}})
 		if defined($crosscoredeps->{$self->get('Host Arch')});
 	}
+	@coredeps = map { "$_:" . $self->get('Build Arch') } @coredeps;
 	$resolver->add_dependencies('CORE', join(", ", @coredeps) , "", "", "", "", "");
 
 	if (!$resolver->install_core_deps('core', 'CORE')) {
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index 763ecaa..6acd3d2 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -768,8 +768,7 @@ sub setup ($) {
 	    TYPE => 'ARRAY:STRING',
 	    VARNAME => 'core_depends',
 	    GROUP => 'Core options',
-	    DEFAULT => ['build-essential:' . $conf->get('BUILD_ARCH'),
-			'fakeroot:' . $conf->get('BUILD_ARCH')],
+	    DEFAULT => ['build-essential', 'fakeroot'],
 	    HELP => 'Packages which must be installed in the chroot for all builds.'
 	},
 	'MANUAL_DEPENDS'			=> {
@@ -812,14 +811,14 @@ sub setup ($) {
 	    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'],
+			 armel => ['crossbuild-essential-armel'],
+			 armhf => ['crossbuild-essential-armhf'],
+			 ia64 => ['crossbuild-essential-ia64'],
+			 mips => ['crossbuild-essential-mips'],
+			 mipsel => ['crossbuild-essential-mipsel'],
+			 powerpc => ['crossbuild-essential-powerpc'],
+			 sparc => ['crossbuild-essential-sparc'],
 	    	       },
 	    HELP => 'Per-architecture dependencies required for cross-building.'
 	},	'BUILD_SOURCE'				=> {
-- 
2.5.1

Reply via email to