From patchwork Thu Apr 26 13:15:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 905062 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 40WyHF2Z90z9s06; Thu, 26 Apr 2018 23:15:37 +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 1fBgkG-0000RO-GV; Thu, 26 Apr 2018 13:15:32 +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 1fBgkE-0000RG-V8 for kernel-team@lists.ubuntu.com; Thu, 26 Apr 2018 13:15:30 +0000 Received: from mail-wr0-f197.google.com ([209.85.128.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fBgkE-0006Gc-Np for kernel-team@lists.ubuntu.com; Thu, 26 Apr 2018 13:15:30 +0000 Received: by mail-wr0-f197.google.com with SMTP id c56-v6so27052180wrc.5 for ; Thu, 26 Apr 2018 06:15:30 -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:in-reply-to :references; bh=0r+Q4bT/6Lbnk+o8BWTjYazeHNseNsQt4m83t7CUIyE=; b=UbdoQoy4hoDYUMUTIxOL54MLG+ijSkqfp6Ci7gtKoMSKNuSkr4SkwQ3+KSgIJN2MCX 6EOsmIA5xa2sgULmbMUGeiqO3RAAjPE7O+nhCIuGtoY5hPA9wgoojhrnvjYhVt4faPIa 2a9XinUbYmJ0i9WKTLoFcmisxY8h0p8+SiRvS/d/cS4jC1y4V+H4qRi7Bx0R67liKjW/ lA3sTRuo1FfIKQDwHXfbZpaul4AHY6J/eNrnir+lTpy2/6a/mQis8Rpt9lK0Djjh5VoD beEStO3UHGBP4yTwLl6qinBWdP1kgBIYwWoDvv2uAQuNS91A1ejfZxd7HLa7xLlSTEeS aEKA== X-Gm-Message-State: ALQs6tA2zFFyoYdwp8zPK2VVY9mb7Xh4mHn/xgr9lySGKeYAB3phMbiM ZCcyrZQ4owNBMyg2I9ItSJ9c0KpT+RoPwoH/D+DHAB59bDj4AAoelFocUMW8LBK48WJG1yZAfRK gQIv4KiK0pQ7W4W22/t+42xzkSWrbLMOitG1GJ15/cw== X-Received: by 10.80.166.152 with SMTP id e24mr38108407edc.2.1524748530141; Thu, 26 Apr 2018 06:15:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oZqMxa1EYxsQ69CeFWHci59QFa1hrvJPmDMyBXOpHIp/iVvaUKfEJglcIBjWq2GRgjnA59A== X-Received: by 10.80.166.152 with SMTP id e24mr38108356edc.2.1524748529819; Thu, 26 Apr 2018 06:15:29 -0700 (PDT) Received: from localhost.localdomain ([81.221.205.149]) by smtp.gmail.com with ESMTPSA id y56sm3953759edd.42.2018.04.26.06.15.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 06:15:29 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [kteam-tools][PATCH v2] cranky-test-build: Make the positional arg 'arch' an optional arg Date: Thu, 26 Apr 2018 15:15:27 +0200 Message-Id: <20180426131527.20638-1-juergh@canonical.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426082853.8536-1-juergh@canonical.com> References: <20180426082853.8536-1-juergh@canonical.com> 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 Acked-by: Kleber Sacilotto de Souza --- cranky/cranky-test-build | 51 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/cranky/cranky-test-build b/cranky/cranky-test-build index 68d69b86739d..45a31c7eef2f 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' ' ') + read -r -a arches <<< "$(ls -1d 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