From patchwork Fri Dec 16 20:27:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 16874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD12C4167B for ; Fri, 16 Dec 2022 20:28:01 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5486.1671222476887154327 for ; Fri, 16 Dec 2022 12:27:57 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F13D31042; Fri, 16 Dec 2022 12:28:36 -0800 (PST) Received: from oss-tx204.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5A093F71E; Fri, 16 Dec 2022 12:27:55 -0800 (PST) From: Ross Burton To: meta-arm@lists.yoctoproject.org Cc: nd@arm.com Subject: [PATCH 4/4] ci/get-binary-toolchains: rewrite, slightly Date: Fri, 16 Dec 2022 20:27:51 +0000 Message-Id: <20221216202751.1031059-4-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221216202751.1031059-1-ross.burton@arm.com> References: <20221216202751.1031059-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 16 Dec 2022 20:28:01 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/4205 Add set -e so errors are fatal. Allow HOST_ARCH and VER to be overridden by the environment, for testing. Pull the tarball basename into a variable to reduce duplication. Turn the wget call into a function to reduce duplication. Drop the big-endian binaries as we never use those. Signed-off-by: Ross Burton --- ci/get-binary-toolchains | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/ci/get-binary-toolchains b/ci/get-binary-toolchains index ed334bf3..bf8bf3e7 100755 --- a/ci/get-binary-toolchains +++ b/ci/get-binary-toolchains @@ -1,8 +1,9 @@ #!/bin/bash -set -u +set -u -e -HOST_ARCH=$(uname -m) -VER="11.3.rel1" +BASENAME=arm-gnu-toolchain +VER=${VER:-11.3.rel1} +HOST_ARCH=${HOST_ARCH:-$(uname -m)} DOWNLOAD_DIR=$1 TOOLCHAIN_DIR=$2 @@ -11,36 +12,39 @@ TOOLCHAIN_LINK_DIR=$3 # These should be already created by .gitlab-ci.yml, but do here if run outside of that env mkdir -p $DOWNLOAD_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR +download() { + TRIPLE=$1 + URL=https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/$BASENAME-$VER-$HOST_ARCH-$TRIPLE.tar.xz + wget -P $DOWNLOAD_DIR -nc $URL +} + if [ $HOST_ARCH = "aarch64" ]; then - #AArch64 Linux hosted cross compilers + # AArch64 Linux hosted cross compilers - #AArch32 target with hard float (arm-none-linux-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf elif [ $HOST_ARCH = "x86_64" ]; then - #x86_64 Linux hosted cross compilers - - #AArch32 target with hard float (arm-linux-none-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # x86_64 Linux hosted cross compilers - #AArch64 GNU/Linux target (aarch64-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf - #AArch64 GNU/Linux target (aarch64_be-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz + # AArch64 GNU/Linux target + download aarch64-none-linux-gnu else echo "ERROR - Unknown build arch of $HOST_ARCH" exit 1 fi -for i in arm aarch64 aarch64_be; do - if [ ! -d $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then - if [ ! -f $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then +for i in arm aarch64; do + if [ ! -d $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then + if [ ! -f $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then continue fi - tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz + tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz fi # Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location) - ln -s $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i + ln -s $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i done