From patchwork Thu Apr 26 08:01:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 904910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 40WqJr5cCXz9s08; Thu, 26 Apr 2018 18:01:32 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fBbqI-0000wT-RF; Thu, 26 Apr 2018 08:01:26 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fBbqH-0000wK-AW for kernel-team@lists.ubuntu.com; Thu, 26 Apr 2018 08:01:25 +0000 Received: from mail-wr0-f199.google.com ([209.85.128.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fBbqH-0002Wv-2v for kernel-team@lists.ubuntu.com; Thu, 26 Apr 2018 08:01:25 +0000 Received: by mail-wr0-f199.google.com with SMTP id d4-v6so1364990wrn.15 for ; Thu, 26 Apr 2018 01:01:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=MI2DUb1SsvIkIJwCIPTr7tc5nU18+890re2NRjPYvcc=; b=eHMp0yh64r4bnMAzM9SQkAPqobihzOijo7kpNfjE2I6HRlZc58wvIFmo4mTOYKQh8A ILpwPUkWLqAFzZQOoCgWbjopYUoe58+DQGq5ZadobyXEgaf/tfSXg9ZNnb7oS3SPHoIA FDxEYT/BNRwgrGUE1sQXu4WLqNqDM7N+92SFOg9uI39G0bAHvsCb8Cca3w4GuuH6s0k9 +XaLTuwNoS+74YerBnl3wPZnGA0jh+DrpnuR452lF99W+F3l1Lnq5VDRkVO2wXkoSWwv 5a4Trg5KOrtLJvk3Fa8VTId8EkiZZJJDVP4MAluDoAKnTPhpDuNHigxgzHU34/MONQYz Gy/A== X-Gm-Message-State: ALQs6tBIQkDXiIYhLxKq1SKoba3poEjtH3bTi/kmPKXwjXFIaLUP6L3I XDKJSa4YUQu8CfUafXBpuDMQWACUbmuarvO1bHoan6VZNKdCCp3L5btRLnXYHTxkrRBqdxvpZyy e5Jzq4MO+MEJuTvjtoHsqvbnSrOSsAboEyZAeJrcuSw== X-Received: by 10.80.135.14 with SMTP id i14mr39186740edb.86.1524729684585; Thu, 26 Apr 2018 01:01:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx49cEmyUyqZO8FVf98ZuZXTKOSo6cKiuMe1ixQmxEgy6mhB29oYkc3qx1D2ik3MIdCEdZepAUw== X-Received: by 10.80.135.14 with SMTP id i14mr39186727edb.86.1524729684378; Thu, 26 Apr 2018 01:01:24 -0700 (PDT) Received: from localhost.localdomain ([81.221.205.149]) by smtp.gmail.com with ESMTPSA id v40sm10880743edm.35.2018.04.26.01.01.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 01:01:23 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [kteam-tools][PATCH] cranky-test-build: Make the positional arg 'arch' an optional arg Date: Thu, 26 Apr 2018 10:01:21 +0200 Message-Id: <20180426080121.7050-1-juergh@canonical.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" This feels more natural :-) Also, change the default (no arch specified) to only build the current host architecture, rather than all supported architectures. Introduce the special arch 'all' to build all supported architectures. Signed-off-by: Juerg Haefliger --- cranky/cranky-test-build | 47 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/cranky/cranky-test-build b/cranky/cranky-test-build index 68d69b86739d..f15f111fa7f1 100755 --- a/cranky/cranky-test-build +++ b/cranky/cranky-test-build @@ -16,30 +16,33 @@ function out() function usage() { cat <-binary - -h, --help show this help message and exit + -a, --arch ARCH[,ARCH,...] Comma-separated list of kernel architectures to + build. If not specified, defaults to the host + architecture. If the special architecture 'all' + is used, build all architectures listed under + debian.master/config/. + -c, --commit COMMIT Build from commit COMMIT instead of 'HEAD'. + -t, --target TARGET Build target TARGET instead of 'binary'. + -h, --help Show this help message and exit. Examples: - Build packages for a single architecture from the current commit: - $ cranky-test-build kathleen amd64 + Build binary packages for the host architecture from the current commit: + $ cranky-test-build kathleen Build packages for all supported architectures: - $ cranky-test-build kathleen + $ cranky-test-build -a all kathleen Build binary packages of kernel flavor 'generic' from branch 'testing' for architecture ppc64el: - $ cranky-test-build -c testing -t binary-generic kathleen ppc64el + $ cranky-test-build -c testing -t binary-generic -a ppc64el kathleen Current limitations: 1) The username on the build host must be identical to the username on the @@ -56,12 +59,16 @@ EOF } host= -arches= +arches=($(dpkg-architecture -q DEB_HOST_ARCH)) commit=HEAD target=binary while [ "${#}" -gt 0 ] ; do case "${1}" in + -a|--arch) + shift + IFS=',' read -r -a arches <<< "${1}" + ;; -c|--commit) shift commit=${1} @@ -74,12 +81,10 @@ while [ "${#}" -gt 0 ] ; do target=${1} ;; *) - if [ -z "${host}" ] ; then - host=${1} - else - arches=${*} - break + if [ -n "${host}" ] ; then + usage fi + host=${1} ;; esac shift @@ -106,13 +111,13 @@ if ! [ -e "${changelog}" ] ; then exit 1 fi -if [ -z "${arches}" ] ; then +if [ "${arches[0]}" = "all" ] ; then # shellcheck disable=SC2012 arches=$(ls -d debian.master/config/*/ | sed -e 's,/$,,' -e 's,.*/,,' | \ tr '\n' ' ') else # Verify that the specified arch(es) is/are valid - for arch in ${arches} ; do + for arch in "${arches[@]}" ; do if ! [ -d "debian.master/config/${arch}" ] ; then echo "Error: Unsupported arch '${arch}'" exit 1 @@ -128,7 +133,7 @@ fi echo "Build host: ${host}" echo "Build series: ${series}" -echo "Build arches: ${arches}" +echo "Build arches: ${arches[*]}" echo "Build commit: $(git log --format='%h ("%s")' "${commit}" -1)" # Verify we can talk to the host @@ -178,7 +183,7 @@ git branch "${BUILD_BRANCH}" "${commit}" trap out EXIT INT TERM HUP # Finally cycle through the arches and do the builds -for arch in ${arches} ; do +for arch in "${arches[@]}" ; do echo "Info: Doing a test build for arch '${arch}', target '${target}'" git push --force "${host}" "${BUILD_BRANCH}:${arch}-${target}" || true done