From patchwork Mon Dec 19 12:53:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wookey X-Patchwork-Id: 5875 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 3522923E04 for ; Mon, 19 Dec 2011 12:54:01 +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 24AB5A183F1 for ; Mon, 19 Dec 2011 12:54:01 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id c11so1864142eaa.11 for ; Mon, 19 Dec 2011 04:54:01 -0800 (PST) Received: by 10.205.138.136 with SMTP id is8mr1368313bkc.35.1324299240946; Mon, 19 Dec 2011 04:54:00 -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 ac16cs5290bkc; Mon, 19 Dec 2011 04:54:00 -0800 (PST) Received: by 10.227.206.4 with SMTP id fs4mr11772164wbb.21.1324299239407; Mon, 19 Dec 2011 04:53:59 -0800 (PST) Received: from stoneboat.aleph1.co.uk (stoneboat.aleph1.co.uk. [80.68.88.63]) by mx.google.com with ESMTPS id n5si10503178wbh.3.2011.12.19.04.53.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Dec 2011 04:53:59 -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 1Rcciv-0003dL-4c; Mon, 19 Dec 2011 12:53:58 +0000 Received: from wookey by dream.aleph1.co.uk with local (Exim 4.72) (envelope-from ) id 1Rccip-0003oo-4C; Mon, 19 Dec 2011 12:53:39 +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:17 +0000 Message-Id: <1324299198-14640-6-git-send-email-wookey@wookware.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1324299198-14640-1-git-send-email-wookey@wookware.org> References: <1324299198-14640-1-git-send-email-wookey@wookware.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=-2.1 required=4.5 tests=AWL,BAYES_00 autolearn=no version=3.3.1 Subject: [PATCH 6/7] Add setup-dpkg fn to set dpkg foreign-architecture Add apt-config option to set apt to use $HOST package files 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 --- lib/Sbuild/ResolverBase.pm | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm index 3bae921..963e194 100644 --- a/lib/Sbuild/ResolverBase.pm +++ b/lib/Sbuild/ResolverBase.pm @@ -88,9 +88,9 @@ sub setup { } print $F "APT::Install-Recommends false;\n"; - if ($self->get('Host_Arch') ne $self->get('Build_Arch')) { - print $F "APT::Architecture=".$self->get('Host_Arch'); - print STDOUT "Adding APT::Architecture".$self->get('Host_Arch')."to the apt config"; + if ($self->get_conf('HOST_ARCH') ne $self->get_conf('BUILD_ARCH')) { + print $F "APT::Architecture=".$self->get_conf('HOST_ARCH'); + $self->log("Adding APT::Architecture" . $self->get_conf('HOST_ARCH') . " to the apt config\n"); } if ($self->get('Split')) { print $F "Dir \"$chroot_dir\";\n"; @@ -133,13 +133,19 @@ sub setup { sub setup_dpkg { my $self = shift; - - #if cross-building we need to set the correct foreign-arch - if ($self->get('Host_Arch') ne $self->get('Build_Arch')) { - open (my $F, '>/etc/dpkg/dpkg.cfg.d/sbuild'); - print $F "foreign-architecture ".$self->get('Host_Arch'); - close ($F); - print "Setting dpkg foreign-architecutre"; + + my $session = $self->get('Session'); + + #if cross-building set the correct foreign-arch + if ($self->get_conf('HOST_ARCH') ne $self->get_conf('BUILD_ARCH')) { + + $session->run_command( + { COMMAND => ['echo', 'foreign-architecture ' . $self->get_conf('HOST_ARCH'), '>', '/etc/dpkg/dpk.cfg.d/sbuild'], + USER => 'root' }); + # We should get this much nicer interface with new dpkg upload. + # { COMMAND => ['dpkg', '--add-foreign-architecture ', $self->get_conf('HOST_ARCH')], + # USER => 'root' }); + $self->log("Setting dpkg foreign-architecture\n"); } }