From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7BD14158041 for ; Sat, 30 Mar 2024 12:13:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F247E2A09; Sat, 30 Mar 2024 12:13:44 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 815A3E2A09 for ; Sat, 30 Mar 2024 12:13:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 80E5E3430E7 for ; Sat, 30 Mar 2024 12:13:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B992815F4 for ; Sat, 30 Mar 2024 12:13:41 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1711800805.fac47bdfea3b3ecd54abd87cc7ee9ca653aad5f7.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/bootstrap-prefix.sh X-VCS-Directories: scripts/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: fac47bdfea3b3ecd54abd87cc7ee9ca653aad5f7 X-VCS-Branch: master Date: Sat, 30 Mar 2024 12:13:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fb3be8b6-9966-4309-9edf-b63b073da8df X-Archives-Hash: b9e9689ff0dd58bf07ab8e65b80b901a commit: fac47bdfea3b3ecd54abd87cc7ee9ca653aad5f7 Author: Fabian Groffen gentoo org> AuthorDate: Sat Mar 30 12:13:25 2024 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Mar 30 12:13:25 2024 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=fac47bdf scripts/bootstrap-prefix: shellcheck Signed-off-by: Fabian Groffen gentoo.org> scripts/bootstrap-prefix.sh | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 6276ccb8d6..2e4f542440 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#shellcheck disable=SC2016,SC2030,SC2038,SC2185,SC2120 +#shellcheck disable=SC2016,SC2030,SC2031,SC2038,SC2185,SC2120 # Copyright 2006-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 @@ -43,7 +43,8 @@ emake() { else estatus "stage1: building ${PWD##*/}" fi - v "${MAKE}" ${MAKEOPTS} "$@" || return 1 + read -a makeopts <<< "${MAKEOPTS}" + v "${MAKE}" "${makeopts[@]}" "$@" || return 1 } efetch() { @@ -100,8 +101,9 @@ efetch() { done locs=( "${locs[@]}" "$1" ) + read -a fetchcmd <<< "${FETCH_COMMAND}" for loc in "${locs[@]}" ; do - v ${FETCH_COMMAND} "${loc}" < /dev/null + v "${fetchcmd[@]}" "${loc}" < /dev/null [[ -f ${1##*/} ]] && break done if [[ ! -f ${1##*/} ]] ; then @@ -459,7 +461,7 @@ bootstrap_profile() { fsdk="$(readlink -f "${SDKPATH}")" osvers="$(sw_vers -productVersion)" if [[ ${osvers%%.*} -le 10 ]] ; then - osvers=$(echo ${osvers} | cut -d'.' -f1-2) + osvers=$(echo "${osvers}" | cut -d'.' -f1-2) else osvers=${osvers%%.*} fi @@ -604,7 +606,7 @@ bootstrap_startscript() { fi einfo "Trying to emerge the shell you use, if necessary by running:" einfo "emerge -u ${theshell}" - if ! emerge -u ${theshell} ; then + if ! emerge -u "${theshell}" ; then eerror "Your shell is not available in portage, hence we cannot" > /dev/stderr eerror "automate starting your prefix, set SHELL and rerun this script" > /dev/stderr return 1 @@ -617,7 +619,7 @@ bootstrap_startscript() { local minPATH local theirPATH minPATH="preamble:${BASH%/*}:postlude" - theirPATH="$(echo 'echo "${PATH}"' | env LS_COLORS= PATH="${minPATH}" $SHELL -l 2>/dev/null | grep "preamble:.*:postlude")" + theirPATH="$(echo 'echo "${PATH}"' | env LS_COLORS= PATH="${minPATH}" "${SHELL}" -l 2>/dev/null | grep "preamble:.*:postlude")" if [[ ${theirPATH} != *"preamble:"*":postlude"* ]] ; then einfo "WARNING: your shell initialisation (.cshrc, .bashrc, .profile)" einfo " seems to overwrite your PATH, this effectively kills" @@ -649,7 +651,7 @@ bootstrap_portage() { A=prefix-portage-${PV}.tar.bz2 einfo "Bootstrapping ${A%.tar.*}" - efetch ${DISTFILES_URL}/${A} || return 1 + efetch "${DISTFILES_URL}/${A}" || return 1 einfo "Unpacking ${A%.tar.*}" export S="${PORTAGE_TMPDIR}"/portage-${PV} @@ -696,7 +698,7 @@ bootstrap_portage() { emake install || return 1 cd "${ROOT}" || return 1 - rm -Rf ${ptmp} >& /dev/null + rm -Rf "${ptmp}" >& /dev/null # Some people will skip the tree() step and hence var/log is not created # As such, portage complains.. @@ -708,8 +710,8 @@ bootstrap_portage() { local tmpportdir=${ROOT}/tmp/${PORTDIR#"${ROOT}"} [[ -e "${tmpportdir}" ]] || ln -s "${PORTDIR}" "${tmpportdir}" for d in "${ROOT}"/tmp/usr/lib/python$(python_ver); do - [[ -e ${d}/portage ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/portage ${d}/portage - [[ -e ${d}/_emerge ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/_emerge ${d}/_emerge + [[ -e ${d}/portage ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/portage "${d}"/portage + [[ -e ${d}/_emerge ]] || ln -s "${ROOT}"/tmp/usr/lib/portage/lib/_emerge "${d}"/_emerge done if [[ -s ${PORTDIR}/profiles/repo_name ]]; then @@ -742,7 +744,7 @@ bootstrap_simple() { A=${PN}-${PV}.tar.${3:-gz} einfo "Bootstrapping ${A%.tar.*}" - efetch ${4:-${DISTFILES_G_O}/distfiles}/${A} || return 1 + efetch "${4:-${DISTFILES_G_O}/distfiles}/${A}" || return 1 einfo "Unpacking ${A%.tar.*}" S="${PORTAGE_TMPDIR}/${PN}-${PV}" @@ -750,11 +752,12 @@ bootstrap_simple() { mkdir -p "${S}" || return 1 cd "${S}" || return 1 case $3 in + zstd) decomp=zstd ;; xz) decomp=xz ;; bz2) decomp=bzip2 ;; gz|"") decomp=gzip ;; esac - ${decomp} -dc "${DISTDIR}"/${A} | tar -xf - + ${decomp} -dc "${DISTDIR}/${A}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 S="${S}"/${PN}-${PV} cd "${S}" || return 1 @@ -764,12 +767,16 @@ bootstrap_simple() { # for libressl, only provide static lib, such that wget (above) # links it in and we don't have to bother about RPATH or something if [[ ${PN} == "libressl" ]] ; then - myconf="${myconf} --enable-static --disable-shared" + myconf=( + "${myconf[@]}" + --enable-static + --disable-shared + ) fi einfo "Compiling ${A%.tar.*}" if [[ -x configure ]] ; then - econf ${myconf} || return 1 + econf "${myconf[@]}" || return 1 fi emake || return 1 @@ -788,6 +795,7 @@ bootstrap_gnu() { einfo "Bootstrapping ${A%.tar.*}" + # GNU does not use zstd (yet?) for t in tar.xz tar.bz2 tar.gz tar ; do A=${PN}-${PV}.${t} @@ -815,7 +823,7 @@ bootstrap_gnu() { tar.bz2) decomp=bzip2 ;; tar.gz) decomp=gzip ;; tar) - tar -xf "${DISTDIR}"/${A} || continue + tar -xf "${DISTDIR}/${A}" || continue break ;; *) @@ -823,7 +831,7 @@ bootstrap_gnu() { return 1 ;; esac - ${decomp} -dc "${DISTDIR}"/${URL##*/} | tar -xf - + ${decomp} -dc "${DISTDIR}/${URL##*/}" | tar -xf - [[ ${PIPESTATUS[*]} == '0 0' ]] || continue break done