From patchwork Thu Apr 16 13:42:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 6225981 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 80CC89F1C4 for ; Thu, 16 Apr 2015 13:43:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A51A02027D for ; Thu, 16 Apr 2015 13:43:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A014B2024D for ; Thu, 16 Apr 2015 13:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964999AbbDPNnA (ORCPT ); Thu, 16 Apr 2015 09:43:00 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:35430 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964987AbbDPNm7 (ORCPT ); Thu, 16 Apr 2015 09:42:59 -0400 Received: by labbd9 with SMTP id bd9so57030238lab.2 for ; Thu, 16 Apr 2015 06:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ItRkDxhBtNzIt6jQFS+IRzBFRebCVmwdbnVkLpkCIgw=; b=KavivN5vIQnqGJUJUkaKmvl1/NSFsbNli27l606Qmiz+Ntljel4eKzNEVSj9oAbRMY LVfD/uJ7W8JKYXypYTs7SOKUUy/r8lsn83yQCjk+8x13IiJAipti40dbUnCfRVhKlPxi 3yKtFp6JF4zu5g0pIhHxFaSTTAw7A9Cdqu4q6M+UJXh4UeQUeIjr3gmsQHizXD/SBgX9 OtazBepTPs7IsLquiGoJUY217ap5/N2mfAU/ZuE1Sc8NLkZ5vlUW/R+7B5CsCPmDjv6x 1XtTXK/DvPW3HpGHblWzVrANbR3q9eng/r5SUsFF366eIjbYMfTwF1gcyMMUXDjDjeuA 1neA== X-Gm-Message-State: ALoCoQlkjqjWogV/zo1I6dm1CSkmjVPm9cRZYgko8er1adH7O3WcKDj4Sq8OWlvLJL+yVAsQ5Ir5 X-Received: by 10.112.204.6 with SMTP id ku6mr28288495lbc.73.1429191777886; Thu, 16 Apr 2015 06:42:57 -0700 (PDT) Received: from localhost.localdomain (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by mx.google.com with ESMTPSA id ao5sm1691241lac.48.2015.04.16.06.42.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Apr 2015 06:42:56 -0700 (PDT) From: riku.voipio@linaro.org To: linux-kbuild@vger.kernel.org, mmarek@suse.cz, debian-kernel@lists.debian.org Cc: Riku Voipio Subject: [PATCH] deb-pkg: v2: move setting debarch for a separate function Date: Thu, 16 Apr 2015 16:42:46 +0300 Message-Id: <1429191766-13385-1-git-send-email-riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <552E59D9.7060101@suse.cz> References: <552E59D9.7060101@suse.cz> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Riku Voipio create_package() function tries to resolve used architecture for everry package. Split the setting the architecture to a new function, set_debarch(), called once on startup. This allows using debarch from other parts of script as needed. v2: Follow Michals suggestion on setting variables at top scope and also setting the fallback $debarch in the new function Signed-off-by: Riku Voipio --- scripts/package/builddeb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index a9858a4..d9b7694 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -27,8 +27,13 @@ create_package() { chown -R root:root "$pdir" chmod -R go-w "$pdir" + # Create the package + dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir" + dpkg --build "$pdir" .. +} + +set_debarch() { # Attempt to find the correct Debian architecture - local forcearch="" debarch="" case "$UTS_MACHINE" in i386|ia64|alpha) debarch="$UTS_MACHINE" ;; @@ -58,6 +63,7 @@ create_package() { fi ;; *) + debarch=$(dpkg --print-architecture) echo "" >&2 echo "** ** ** WARNING ** ** **" >&2 echo "" >&2 @@ -70,13 +76,8 @@ create_package() { if [ -n "$KBUILD_DEBARCH" ] ; then debarch="$KBUILD_DEBARCH" fi - if [ -n "$debarch" ] ; then - forcearch="-DArchitecture=$debarch" - fi + forcearch="-DArchitecture=$debarch" - # Create the package - dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" - dpkg --build "$pdir" .. } # Some variables and settings used throughout the script @@ -99,6 +100,9 @@ kernel_headers_packagename=linux-headers-$version libc_headers_packagename=linux-libc-dev dbg_packagename=$packagename-dbg tools_packagename=linux-tools-$version +debarch= +forcearch= +set_debarch if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version