Package: sbuild Version: 0.63.2-1ubuntu2 Severity: normal Attached is a patch to change the chroot lookup code to allow for cross chroots to be named dist-build-host instead of just dist-arch, so one doesn't run into namespace clashes between native and cross chroots on the same machine. Manpage is updated to match.
Also, this fixes a thinko in Build.pm, where chroot lookups were looking for BUILD_ARCH instead of HOST_ARCH, which didn't seem to make much sense. It doesn't change anything for the non-cross case. ... Adam -- System Information: Debian Release: wheezy/sid APT prefers raring-updates APT policy: (500, 'raring-updates'), (500, 'raring-security'), (500, 'raring') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.7.0-4-generic (SMP w/4 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages sbuild depends on: ii adduser 3.113+nmu3ubuntu1 ii apt-utils 0.9.7.6ubuntu5 ii libsbuild-perl 0.63.2-1ubuntu2 ii perl 5.14.2-15 ii perl-modules 5.14.2-15 Versions of packages sbuild recommends: ii debootstrap 1.0.44 ii fakeroot 1.18.4-2ubuntu1 Versions of packages sbuild suggests: pn deborphan <none> ii wget 1.14-1ubuntu1 -- no debconf information
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index e82e4a7..457a412 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -361,7 +361,7 @@ sub run_chroot_session { my $session = $chroot_info->create('chroot', $self->get_conf('DISTRIBUTION'), $self->get_conf('CHROOT'), - $self->get_conf('BUILD_ARCH')); + $self->get_conf('HOST_ARCH')); # Run pre build external commands $self->check_abort(); diff --git a/lib/Sbuild/ChrootInfo.pm b/lib/Sbuild/ChrootInfo.pm index bc16d1e..62b264e 100644 --- a/lib/Sbuild/ChrootInfo.pm +++ b/lib/Sbuild/ChrootInfo.pm @@ -93,6 +93,7 @@ sub find { $arch = $self->get_conf('HOST_ARCH'); } my $arch_set = ($arch eq $self->get_conf('HOST_ARCH')) ? 0 : 1; + my $build_arch = $self->get_conf('BUILD_ARCH'); my $arch_found = 0; @@ -108,7 +109,17 @@ sub find { } } - if ($arch ne "" && + if ($arch ne $build_arch && + defined($ns->{"${distribution}-${build_arch}-${arch}-sbuild"})) { + $chroot = "${namespace}:${distribution}-${build_arch}-${arch}-sbuild"; + $arch_found = 1; + } + elsif ($arch ne $build_arch && + defined($ns->{"${distribution}-${build_arch}-${arch}"})) { + $chroot = "${namespace}:${distribution}-${build_arch}-${arch}"; + $arch_found = 1; + } + elsif ($arch ne "" && defined($ns->{"${distribution}-${arch}-sbuild"})) { $chroot = "${namespace}:${distribution}-${arch}-sbuild"; $arch_found = 1; diff --git a/man/sbuild.1.in b/man/sbuild.1.in index 379a294..a91a064 100644 --- a/man/sbuild.1.in +++ b/man/sbuild.1.in @@ -154,14 +154,16 @@ appropriately to build as that architecture, e.g. using this option is equivalent to "\-\-host=architecture \-\-build=architecture". .TP .BR "\-\-host=\fIarchitecture\fP" -Build using the host architecture specified. A chroot named -\fI$distribution\-$arch-sbuild\fP or \fI$distribution\-arch\fP is searched for, -in that order of preference. This option is only useful for cross-building -when used together with \-\-build. +Build using the host architecture specified. If $host and $build don't match, a +chroot named \fI$distribution\-$build\-$host\-sbuild\fP or \fI$distribution\-$build\-$host\fP +is searched for, falling back to \fI$distribution\-$host\-sbuild\fP or +\fI$distribution\-$host\fP, in that order of preference. This option is only +useful for cross-building when used together with \-\-build. .TP .BR "\-\-build=\fIarchitecture\fP" Build using the build architecture specified. This option is only useful for -cross-building when used together with \-\-host. +cross-building when used together with \-\-host. If \-\-build is not specified, +the default system architecture is assumed. .TP .BR \-A ", " "\-\-arch\-all" Also build Architecture: all packages, i.e. use dpkg\-buildpackage \-b