[buildd-tools-devel] Bug#609151: sbuild reported architecture is wrong when using a chroot with a personality

Jamie Strandboge jamie at ubuntu.com
Thu Jan 6 20:11:08 UTC 2011


Package: sbuild
Version: 0.60.8-1ubuntu1
Severity: normal
Tags: patch
Usertags: origin-ubuntu ubuntu-patch natty


The latest versions of sbuild do not properly set 'Arch' before calling
open_build_log() when building within a chroot with a personaility (eg,
i386 on an amd64 host). This results in the file name of the logfile for
the build and the logfile preamble having the wrong architecture. This
only seems to be a problem with the reporting, as the correct chroot is
used. For example:

$ /usr/bin/sbuild --chroot-setup-commands /tmp/umt-uPVUs9 -d maverick-i386 -A cups_1.4.4-6ubuntu2.3.dsc
....
| cups 1.4.4-6ubuntu2.3 (amd64)                              04 Jan 2011 10:04
....
Architecture: amd64
....
| Install cups build dependencies (internal resolver)
....
Get:1 http://debmirror/ubuntu/ maverick/main libexpat1 i386 2.0.1-7ubuntu1 [139kB]
....
| Summary
....
Architecture: i386
....

An easy fix is to start the chroot and set the Arch before before
calling open_build_log(), which is what earlier versions of sbuild did.
Attached is a patch to do just that.

Thanks!

Jamie

-- System Information:
Debian Release: squeeze/sid
  APT prefers natty-updates
  APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-23-generic (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

Versions of packages sbuild depends on:
ii  adduser                3.112+nmu1ubuntu2 add and remove users and groups
ii  libsbuild-perl         0.60.8-1ubuntu1   Tool for building Debian binary pa
ii  perl                   5.10.1-16ubuntu1  Larry Wall's Practical Extraction 
ii  perl-modules           5.10.1-16ubuntu1  Core Perl modules

Versions of packages sbuild recommends:
ii  debootstrap              1.0.25ubuntu2   Bootstrap a basic Debian system
ii  fakeroot                 1.14.4-1ubuntu1 Gives a fake root environment

Versions of packages sbuild suggests:
pn  deborphan                <none>          (no description available)
ii  wget                     1.12-2.1ubuntu1 retrieves files from the web

-- no debconf information
-------------- next part --------------
--- Build.pm.orig	2011-01-06 13:00:19.000000000 -0600
+++ Build.pm	2011-01-06 13:47:48.000000000 -0600
@@ -292,6 +292,29 @@ sub run {
 	$chroot_info = Sbuild::ChrootInfoSudo->new($self->get('Config'));
     }
 
+    # Start the chroot now, so we can query the chroot's architecture and
+    # $self->set('Arch', $self->chroot_arch()) before calling open_build_log().
+    my $end_session = 1;
+    my $session = $chroot_info->create('chroot',
+				       $self->get_conf('DISTRIBUTION'),
+				       $self->get_conf('CHROOT'),
+				       $self->get_conf('ARCH'));
+
+    # Run pre build external commands
+    $self->run_external_commands("pre-build-commands",
+				 $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'),
+				 $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR'));
+
+    if (!$session->begin_session()) {
+	$self->log("Error creating chroot session: skipping " .
+		   $self->get('Package') . "\n");
+	$self->set_status('failed');
+	goto cleanup_unlocked_session;
+    }
+
+    $self->set('Session', $session);
+    $self->set('Arch', $self->chroot_arch());
+
     # TODO: Get package name from build object
     if (!$self->open_build_log()) {
 	goto cleanup_skip;
@@ -341,27 +364,6 @@ sub run {
 	}
     }
 
-    my $end_session = 1;
-    my $session = $chroot_info->create('chroot',
-				       $self->get_conf('DISTRIBUTION'),
-				       $self->get_conf('CHROOT'),
-				       $self->get_conf('ARCH'));
-
-    # Run pre build external commands
-    $self->run_external_commands("pre-build-commands",
-				 $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'),
-				 $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR'));
-
-    if (!$session->begin_session()) {
-	$self->log("Error creating chroot session: skipping " .
-		   $self->get('Package') . "\n");
-	$self->set_status('failed');
-	goto cleanup_unlocked_session;
-    }
-
-    $self->set('Session', $session);
-    $self->set('Arch', $self->chroot_arch());
-
     $self->set('Chroot Dir', $session->get('Location'));
     # TODO: Don't hack the build location in; add a means to customise
     # the chroot directly.  i.e. allow changing of /build location.


More information about the Buildd-tools-devel mailing list