From patchwork Mon Dec 19 12:53:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wookey X-Patchwork-Id: 5870 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 85D7923E04 for ; Mon, 19 Dec 2011 12:53:50 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 5D297A183F1 for ; Mon, 19 Dec 2011 12:53:50 +0000 (UTC) Received: by eaac11 with SMTP id c11so1864142eaa.11 for ; Mon, 19 Dec 2011 04:53:50 -0800 (PST) Received: by 10.204.129.24 with SMTP id m24mr1382531bks.89.1324299230111; Mon, 19 Dec 2011 04:53:50 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs5281bkc; Mon, 19 Dec 2011 04:53:46 -0800 (PST) Received: by 10.227.198.19 with SMTP id em19mr14553189wbb.14.1324299223709; Mon, 19 Dec 2011 04:53:43 -0800 (PST) Received: from stoneboat.aleph1.co.uk (stoneboat.aleph1.co.uk. [80.68.88.63]) by mx.google.com with ESMTPS id fb6si10493526wbb.25.2011.12.19.04.53.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Dec 2011 04:53:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of wookey@aleph1.co.uk designates 80.68.88.63 as permitted sender) client-ip=80.68.88.63; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of wookey@aleph1.co.uk designates 80.68.88.63 as permitted sender) smtp.mail=wookey@aleph1.co.uk Received: from host-78-151-164-206.static.as13285.net ([78.151.164.206] helo=dream.aleph1.co.uk) by stoneboat.aleph1.co.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Rccim-0003dF-PJ; Mon, 19 Dec 2011 12:53:42 +0000 Received: from wookey by dream.aleph1.co.uk with local (Exim 4.72) (envelope-from ) id 1Rccig-0003oZ-OU; Mon, 19 Dec 2011 12:53:30 +0000 From: wookey@wookware.org To: buildd-tools-devel@lists.alioth.debian.org Cc: patches@linaro.org, Wookey Date: Mon, 19 Dec 2011 12:53:12 +0000 Message-Id: <1324299198-14640-1-git-send-email-wookey@wookware.org> X-Mailer: git-send-email 1.7.2.5 X-SA-Exim-Connect-IP: 78.151.164.206 X-SA-Exim-Mail-From: wookey@aleph1.co.uk X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on stoneboat.aleph1.co.uk X-Spam-Level: X-Spam-Status: No, score=-2.1 required=4.5 tests=AWL,BAYES_00 autolearn=no version=3.3.1 Subject: [PATCH 1/7] Merge in BUILD/HOST ARCH bits that got lost X-SA-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:51:10 +0000) X-SA-Exim-Scanned: Yes (on stoneboat.aleph1.co.uk) From: Wookey --- bin/sbuild-createchroot | 19 +++++++++---------- lib/Sbuild/Build.pm | 30 ++++++++++++++++++------------ lib/Sbuild/Utility.pm | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot index b8b82b7..c3c8d8a 100755 --- a/bin/sbuild-createchroot +++ b/bin/sbuild-createchroot @@ -90,7 +90,7 @@ sub set_options { $self->add_options( "arch=s" => sub { - $self->set_conf('ARCH', $_[1]); + $self->set_conf('BUILD_ARCH', $_[1]); }, "foreign" => sub { $self->set_conf('FOREIGN', 0); @@ -177,7 +177,7 @@ if ($conf->get('VERBOSE')) { print "I: SCRIPT: $script\n" if (defined($script)); } -my @args = ("--arch=" . $conf->get('ARCH'), +my @args = ("--arch=" . $conf->get('BUILD_ARCH'), "--variant=buildd"); push @args, "--verbose" if $conf->get('VERBOSE'); push @args, "--foreign" if $conf->get('FOREIGN'); @@ -250,11 +250,11 @@ dump_file("${target}/etc/apt/sources.list"); print "I: Please add any additional APT sources to ${target}/etc/apt/sources.list\n"; # Write out schroot chroot configuration. -my $chrootname = "${suite}-" . $conf->get('ARCH') . "-sbuild"; +my $chrootname = "${suite}-" . $conf->get('BUILD_ARCH') . "-sbuild"; # Determine the schroot chroot configuration to use. my $config_entry; -my $arch = $conf->get('ARCH'); +my $arch = $conf->get('BUILD_ARCH'); if ($conf->get('MAKE_SBUILD_TARBALL')) { my $tarball = $conf->get('MAKE_SBUILD_TARBALL'); @@ -298,18 +298,17 @@ if (-d "/etc/schroot/chroot.d") { my ($personality, $personality_message); # Detect whether personality might be needed. - - if ($conf->get('ARCH') ne $conf->get('HOST_ARCH')) { + if ($conf->get('ARCH') ne $conf->get('BUILD_ARCH')) { # Take care of the known case(s). - if ($conf->get('ARCH') eq 'i386' && - $conf->get('HOST_ARCH') eq 'amd64') { + if ($conf->get('BUILD_ARCH') eq 'i386' && + $conf->get('ARCH') eq 'amd64') { $personality='linux32'; $personality_message = "I: Added personality=$personality automatically (i386 on amd64).\n"; } else { $personality_message = "W: The selected architecture and the current architecture do not match\n" . - "W: (" . $conf->get('ARCH') . " versus " . $conf->get('HOST_ARCH') . ").\n" . + "W: (" . $conf->get('BUILD_ARCH') . " versus " . $conf->get('ARCH') . ").\n" . "I: You probably need to add a personality option (see schroot(1)).\n" . "I: You may want to report your use case to the sbuild developers so that\n" . "I: the appropriate option gets automatically added in the future.\n\n"; @@ -383,7 +382,7 @@ if ($conf->get('ARCH') eq $conf->get('HOST_ARCH')) { } } else { print "W: The selected architecture and the current architecture do not match\n"; - print "W: (" . $conf->get('ARCH') . " versus " . $conf->get('HOST_ARCH') . ").\n"; + print "W: (" . $conf->get('BUILD_ARCH') . " versus " . $conf->get('ARCH') . ").\n"; print "W: Not automatically updating APT package lists.\n"; print "I: Run \"apt-get update\" and \"apt-get dist-upgrade\" prior to use.\n"; print "I: Run \"sbuild-checkpackages --set\" to set reference package list.\n"; diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index ff2240f..b7ab733 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -369,7 +369,7 @@ sub run_chroot_session { my $session = $chroot_info->create('chroot', $self->get_conf('DISTRIBUTION'), $self->get_conf('CHROOT'), - $self->get_conf('ARCH')); + $self->get_conf('BUILD_ARCH')); # Run pre build external commands $self->check_abort(); @@ -388,12 +388,14 @@ sub run_chroot_session { $self->check_abort(); my $chroot_arch = $self->chroot_arch(); - if ($self->get('Arch') ne $chroot_arch) { - Sbuild::Exception::Build->throw(error => "Build architecture (" . $self->get('Arch') . - ") is not the same as the chroot architecture (" . - $chroot_arch . ")", - info => "Please specify the correct architecture with --arch, or use a chroot of the correct architecture", - failstage => "create-session"); + if ($self->get_conf('BUILD_ARCH') ne $chroot_arch) { + Sbuild::Exception::Build->throw( + error => "Requested build architecture (" . + $self->get_conf('BUILD_ARCH') . + ") and chroot architecture (" . $chroot_arch . + ") do not match. Skipping build.", + info => "Please specify the correct architecture with --build-arch, or use a chroot of the correct architecture", + failstage => "create-session"); } $self->set('Chroot Dir', $session->get('Location')); @@ -984,14 +986,14 @@ sub fetch_source_files { } else { my $valid_arch; for my $a (split(/\s+/, $dscarchs)) { - if (Dpkg::Arch::debarch_is($arch, $a)) { + if (Dpkg::Arch::debarch_is($host_arch, $a)) { $valid_arch = 1; last; } } if ($dscarchs ne "any" && !($valid_arch) && !($dscarchs eq "all" && $self->get_conf('BUILD_ARCH_ALL')) ) { - my $msg = "$dsc: $arch not in arch list or does not match any arch wildcards: $dscarchs -- skipping\n"; + my $msg = "$dsc: $host_arch not in arch list or does not match any arch wildcards: $dscarchs -- skipping\n"; $self->log($msg); Sbuild::Exception::Build->throw(error => "$dsc: $host_arch not in arch list or does not match any arch wildcards: $dscarchs -- skipping", status => "skipped", @@ -1346,7 +1348,7 @@ sub build { " to version number; no source changes\n"; } if ($self->get_conf('BIN_NMU')) { - print F " * Binary-only non-maintainer upload for $arch; ", + print F " * Binary-only non-maintainer upload for $host_arch; ", "no source changes.\n"; print F " * ", join( " ", split( "\n", $self->get_conf('BIN_NMU') )), "\n"; } @@ -1605,7 +1607,7 @@ sub build { } $self->log_subsection("Changes"); - $changes = $self->get('Package_SVersion') . "_$arch.changes"; + $changes = $self->get('Package_SVersion') . "_$host_arch.changes"; my @cfiles; if (-r "$build_dir/$changes") { my(@do_dists, @saved_dists); @@ -1659,7 +1661,7 @@ sub build { my @debcfiles = @cfiles; foreach (@debcfiles) { my $deb = "$build_dir/$_"; - next if $deb !~ /(\Q$arch\E|all)\.[\w\d.-]*$/; + next if $deb !~ /(\Q$host_arch\E|all)\.[\w\d.-]*$/; $self->log_subsubsection("$_"); if (!open( PIPE, "dpkg --info $deb 2>&1 |" )) { @@ -2174,6 +2176,10 @@ sub open_build_log { my $hostname = $self->get_conf('HOSTNAME'); $self->log("sbuild (Debian sbuild) $version ($release_date) on $hostname\n"); + my $arch_string = $self->get_conf('BUILD_ARCH'); + $arch_string = 'CROSS host=' . $self->get_conf('HOST_ARCH') . + '/build=' . $self->get_conf('BUILD_ARCH') + if ($self->get_conf('HOST_ARCH') ne $self->get_conf('BUILD_ARCH')); my $head1 = $self->get('Package') . ' ' . $self->get('Version') . ' (' . $arch_string . ') '; my $head2 = strftime("%d %b %Y %H:%M", diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm index f75f703..63a94f1 100644 --- a/lib/Sbuild/Utility.pm +++ b/lib/Sbuild/Utility.pm @@ -97,7 +97,7 @@ sub setup ($$$) { $session = $chroot_info->create($namespace, $chroot, undef, # TODO: Add --chroot option - $conf->get('ARCH')); + $conf->get('BUILD_ARCH')); $session->set('Log Stream', \*STDOUT);