Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-17 Thread Simon McVittie
On 11/09/15 13:46, Johannes Schauer wrote:
> 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.

Thanks, I've confirmed that a newer snapshot with that patch also works.

S



Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-13 Thread Johannes Schauer
Control: tags -1 + pending

Quoting Simon McVittie (2015-09-11 17:32:59)
> On 11/09/15 13:46, Johannes Schauer wrote:
> > 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.
> 
> Thanks, I'll test that and see what happens.

I pushed the fix I proposed to the sbuild master branch.

Please speak up if you see any problem with it.

Thanks!

cheers, josch


signature.asc
Description: signature


Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-11 Thread Simon McVittie
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 
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



Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-11 Thread Johannes Schauer
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'=> {


signature.asc
Description: signature


Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-11 Thread Simon McVittie
On 11/09/15 13:46, Johannes Schauer wrote:
> 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.

Thanks, I'll test that and see what happens.

S



Bug#798323: Building for i386 on amd64 tries to install amd64 packages into i386 chroot

2015-09-08 Thread Gaudenz Steinlin
Package: sbuild
Version: 0.65.2-1.1
Severity: important

Hi

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. See the attached build log for details.
Downgrading to the sbuild 0.65.2-1 fixes the problem.

I guess the problem is caused by some of the fixes for cross build
support which went into the NMU.

Gaudenz


-- System Information:
Debian Release: stretch/sid
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (100, 
'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.1.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages sbuild depends on:
ii  adduser 3.113+nmu3
ii  apt-utils   1.0.10.2
ii  libsbuild-perl  0.65.2-1
ii  perl5.20.2-6

Versions of packages sbuild recommends:
ii  debootstrap  1.0.72
ii  fakeroot 1.20.2-1

Versions of packages sbuild suggests:
pn  deborphan  
ii  wget   1.16.3-3

-- Configuration Files:
/etc/sbuild/sbuild.conf changed:
$build_arch_all = 1;
$build_source = 1;
$run_lintian = 1;
$purge_build_directory = 'successful';
$purge_session = 'successful';
1;


-- no debconf information
sbuild (Debian sbuild) 0.65.2 (24 Mar 2015) on moebius.durcheinandertal.private

╔══╗
║ owncloud-client 2.0.0+dfsg-1~bpo8+1 (i386) 08 Sep 2015 00:18 ║
╚══╝

Package: owncloud-client
Version: 2.0.0+dfsg-1~bpo8+1
Source Version: 2.0.0+dfsg-1~bpo8+1
Distribution: jessie-backports
Machine Architecture: amd64
Host Architecture: i386
Build Architecture: i386

I: NOTICE: Log filtering will replace 
'build/owncloud-client-pLFbSI/owncloud-client-2.0.0+dfsg' with '«PKGBUILDDIR»'
I: NOTICE: Log filtering will replace 'build/owncloud-client-pLFbSI' with 
'«BUILDDIR»'
I: NOTICE: Log filtering will replace 
'var/run/schroot/mount/jessie-i386-42fc61d4-1d1f-4d26-8660-ba04a5cffb6c' with 
'«CHROOT»'

┌──┐
│ Update chroot│
└──┘

Ign http://localhost: jessie InRelease
Hit http://localhost: jessie Release.gpg
Hit http://localhost: jessie Release
Hit http://localhost: jessie/main Sources
Hit http://localhost: jessie/main i386 Packages
Hit http://localhost: jessie/main Translation-en
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

┌──┐
│ Fetch source files   │
└──┘


Local sources
─

/home/gaudenz/debian/owncloud/owncloud-client_2.0.0+dfsg-1~bpo8+1.dsc exists in 
/home/gaudenz/debian/owncloud; copying to chroot

Check architectures
───


Check dependencies
──

Merged Build-Depends: build-essential:amd64, fakeroot:amd64
Filtered Build-Depends: build-essential:amd64, fakeroot:amd64
dpkg-deb: building package `sbuild-build-depends-core-dummy' in 
`/«BUILDDIR»/resolver-H1NAEB/apt_archive/sbuild-build-depends-core-dummy.deb'.
OK
Ign file: ./ InRelease
Get:1 file: ./ Release.gpg [299 B]
Get:2 file: ./ Release [2119 B]
Ign file: ./ Translation-en
Reading package lists...
Reading package lists...

┌──┐
│ Install core build dependencies (apt-based resolver) │
└──┘

Installing build dependencies
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sbuild-build-depends-core-dummy : Depends: build-essential:amd64 but it is not 
installable
   Depends: fakeroot:amd64 but it is not 
installable
E: Unable to correct problems, you have held broken packages.
apt-get failed.
Package