From patchwork Wed Dec 14 17:54:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wookey X-Patchwork-Id: 5705 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 E1D8C23E0E for ; Wed, 14 Dec 2011 17:55:45 +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 D8549A18826 for ; Wed, 14 Dec 2011 17:55:45 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id k10so972414eaa.11 for ; Wed, 14 Dec 2011 09:55:45 -0800 (PST) Received: by 10.205.120.135 with SMTP id fy7mr1702391bkc.54.1323885345378; Wed, 14 Dec 2011 09:55:45 -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.129.2 with SMTP id hg2cs15398bkc; Wed, 14 Dec 2011 09:55:45 -0800 (PST) Received: by 10.224.216.197 with SMTP id hj5mr11179934qab.15.1323885343382; Wed, 14 Dec 2011 09:55:43 -0800 (PST) Received: from stoneboat.aleph1.co.uk (stoneboat.aleph1.co.uk. [80.68.88.63]) by mx.google.com with ESMTPS id fn7si1957860wbb.139.2011.12.14.09.55.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Dec 2011 09:55: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 1Rat3B-0005Hg-Ck; Wed, 14 Dec 2011 17:55:42 +0000 Received: from wookey by dream.aleph1.co.uk with local (Exim 4.72) (envelope-from ) id 1Rat35-0006DW-Be; Wed, 14 Dec 2011 17:55:23 +0000 From: wookey@linaro.org To: patches@linaro.org Cc: Wookey Date: Wed, 14 Dec 2011 17:54:20 +0000 Message-Id: <1323885273-23505-4-git-send-email-wookey@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1323885273-23505-1-git-send-email-wookey@linaro.org> References: <1323885273-23505-1-git-send-email-wookey@linaro.org> 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=-1.9 required=4.5 tests=BAYES_00 autolearn=no version=3.3.1 Subject: [PATCH 04/17] Resolve comflicts from merging initial cross-support 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 | 36 +++++++++++++++++++++++++----------- lib/Sbuild/Utility.pm | 2 +- 3 files changed, 35 insertions(+), 22 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 b6784b3..1eb099f 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(); @@ -396,6 +396,16 @@ sub run_chroot_session { failstage => "create-session"); } + my $chroot_arch = $self->chroot_arch(); + 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.", + failstage => "create-session"); + } + $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. @@ -974,14 +984,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", @@ -990,7 +1000,7 @@ sub fetch_source_files { } } - debug("Arch check ok ($arch included in $dscarchs)\n"); + debug("Arch check ok ($host_arch included in $dscarchs)\n"); $self->set('Build Depends', $build_depends); $self->set('Build Depends Indep', $build_depends_indep); @@ -1334,7 +1344,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"; } @@ -1593,7 +1603,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); @@ -1647,7 +1657,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 |" )) { @@ -2042,7 +2052,7 @@ sub open_build_log { my $filename = $self->get_conf('LOG_DIR') . '/' . $self->get('Package_SVersion') . '-' . - $self->get('Arch') . + $self->get_conf('HOST_ARCH') . "-$date"; open($saved_stdout, ">&STDOUT") or warn "Can't redirect stdout\n"; @@ -2079,7 +2089,7 @@ sub open_build_log { $self->log_symlink($filename, $self->get_conf('BUILD_DIR') . '/' . $self->get('Package_SVersion') . '_' . - $self->get('Arch') . '.build'); + $self->get_conf('HOST_ARCH') . '.build'); } } @@ -2162,6 +2172,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", @@ -2226,8 +2240,8 @@ sub close_build_log { my $subject = "Log for " . $self->get_status() . " build of " . $self->get('Package_Version'); - if ($self->get('Arch')) { - $subject .= " on " . $self->get('Arch'); + if ($self->get_conf('HOST_ARCH')) { + $subject .= " on " . $self->get_conf('HOST_ARCH'); } if ($self->get_conf('ARCHIVE')) { $subject .= " (" . $self->get_conf('ARCHIVE') . "/" . $self->get_conf('DISTRIBUTION') . ")"; 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);