From patchwork Thu Apr 6 18:18:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 747927 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vzWFr5Clsz9s7g for ; Fri, 7 Apr 2017 04:19:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B4EDB86A1C; Thu, 6 Apr 2017 18:19:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DJoPOnQzP5kx; Thu, 6 Apr 2017 18:19:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E08B186944; Thu, 6 Apr 2017 18:19:26 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 84C981C276A for ; Thu, 6 Apr 2017 18:19:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7CDED88B4F for ; Thu, 6 Apr 2017 18:19:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hFxpmcn4UY2R for ; Thu, 6 Apr 2017 18:19:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by hemlock.osuosl.org (Postfix) with ESMTPS id DEBC288B3E for ; Thu, 6 Apr 2017 18:19:15 +0000 (UTC) Received: from vandecaa-laptop.septentrio.local (10.3.4.134) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 6 Apr 2017 20:18:55 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Thu, 6 Apr 2017 20:18:43 +0200 Message-ID: <20170406181854.5242-3-arnout@mind.be> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.3.4.134] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH v5 03/13] support/test-pkg: calculate toolchain name only once X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: "Yann E. MORIN" The toolchain name was calculated in main() for reporting to the user, and again in build_one() for creating the build directory. Calculate it only once, in main(), and pass the build directory as an argument to build_one(). Signed-off-by: "Yann E. MORIN" Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- I'm not sure why the mkdir is also moved up to main() - IMO, it fits better in build_one(). Yann, the original commit message was just "create build dir from caller", any reason _why_ you did that? Changes v4 -> v5 by Arnout: - Reword commit message - Reorder patch series --- support/scripts/test-pkg | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg index f9f994402d..27601168b1 100755 --- a/support/scripts/test-pkg +++ b/support/scripts/test-pkg @@ -6,7 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf main() { local o O opts local cfg dir pkg random toolchain - local ret nb nb_skip nb_fail nb_tc + local ret nb nb_skip nb_fail nb_tc build_dir local -a toolchains o='hc:d:p:r:' @@ -68,11 +68,14 @@ main() { nb=0 nb_skip=0 nb_fail=0 - for toolchain in "${toolchains[@]}"; do + for toolchainconfig in "${toolchains[@]}"; do : $((nb++)) - printf "%40s [%*d/%d]: " "$(basename "${toolchain}" .config)" \ - ${#nb_tc} ${nb} ${nb_tc} - build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}" && ret=0 || ret=${?} + # Using basename(1) on a URL works nicely + toolchain="$(basename "${toolchainconfig}" .config)" + build_dir="${dir}/${toolchain}" + mkdir -p "${build_dir}" + printf "%40s [%*d/%d]: " "${toolchain}" ${#nb_tc} ${nb} ${nb_tc} + build_one "${build_dir}" "${toolchainconfig}" "${cfg}" "${pkg}" && ret=0 || ret=${?} case ${ret} in (0) printf "OK\n";; (1) : $((nb_skip++)); printf "SKIPPED\n";; @@ -88,13 +91,6 @@ build_one() { local url="${2}" local cfg="${3}" local pkg="${4}" - local toolchain - - # Using basename(1) on a URL works nicely - toolchain="$(basename "${url}" .config)" - - dir="${dir}/${toolchain}" - mkdir -p "${dir}" if ! curl -s "${url}" >"${dir}/.config"; then return 2