Bug#392992: [Buildd-tools-devel] Bug#392992: sbuild: build
architecture not detected from within chroot
Roger Leigh
rleigh at whinlatter.ukfsn.org
Fri Oct 20 22:28:09 UTC 2006
tags 392992 + fixed-upstream pending
thanks
Kees Cook <kees at outflux.net> writes:
> When attempting to run i386 builds within an i386 chroot on an amd64 host,
> the architecture is still identified as "amd64". This patch allows the
> architecture to be found from within the chroot instead.
Thanks very much for the patch. I have committed a slightly modified
version of the patch which
1) Splits out the logic into a separate function, chroot_arch(), to
make the code more maintainable.
2) Dies on error, rather than continuing.
I've attached the patch I applied in case there are any other changes
you would like to make to that. The changes are also in SVN if you
want to look there.
Index: debian/changelog
===================================================================
--- debian/changelog (revision 1049)
+++ debian/changelog (working copy)
@@ -6,8 +6,11 @@
policy, to allow building from experimental and sarge-backports.
Thanks to Wouter Verhelst for this patch, which has been slightly
modified to add configurability and adapt to this version of sbuild.
- * sbuild: Don't run md5sum inside the chroot. Thanks to Michael Banck
- (Closes: #392323).
+ * sbuild:
+ - Don't run md5sum inside the chroot. Thanks to Michael Banck
+ (Closes: #392323).
+ - chroot_arch(): New function to detect build architecture from
+ within the chroot. Thanks to Kees Cook (Closes: #392992).
* Sbuild/Conf.pm: Fix check for schroot. Thanks to Julien Danjou for
finding this (Closes: #392751).
* sbuild-setup.7.in: Correct example commandline for debootstrap.
Index: sbuild
===================================================================
--- sbuild (revision 1048)
+++ sbuild (working copy)
@@ -288,6 +288,8 @@
$main::srcdep_lock_dir = $$Sbuild::Chroot::current{'Srcdep Lock Dir'};
$main::ilock_file = $$Sbuild::Chroot::current{'Install Lock'};
+ $main::arch = chroot_arch();
+
$main::pkg_status = "failed"; # assume for now
$main::current_job = $pkgv;
$main::additional_deps = [];
@@ -3052,3 +3054,23 @@
return 0;
}
+
+# Figure out chroot architecture
+sub chroot_arch {
+ $main::sub_pid = open( PIPE, "-|" );
+ if (!defined $main::sub_pid) {
+ print PLOG "Can't spawn dpkg: $!\n";
+ return 0;
+ }
+ if ($main::sub_pid == 0) {
+ exec_command("$conf::dpkg --print-installation-architecture 2>/dev/null", $main::username, 1, 0);
+ }
+ chomp( my $chroot_arch = <PIPE> );
+ close( PIPE );
+ undef $main::sub_pid;
+
+ die "Can't determine architecture of chroot: $!\n"
+ if ($? || !defined($chroot_arch));
+
+ return $chroot_arch;
+}
Thanks,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20061020/9ddaa563/attachment.pgp
More information about the Buildd-tools-devel
mailing list