Skip to content

Commit 9473056

Browse files
committed
scripts/bootstrap-prefix: shellcheck
Signed-off-by: Fabian Groffen <[email protected]>
1 parent 00075c6 commit 9473056

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

scripts/bootstrap-prefix.sh

+25-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
#shellcheck disable=SC2016,SC2030,SC2031,SC2038,SC2185,SC2120
2+
#shellcheck disable=SCSC1091,SC2016,SC2030,SC2031,SC2038,SC2185,SC2120
33
# Copyright 2006-2024 Gentoo Authors
44
# Distributed under the terms of the GNU General Public License v2
55

@@ -1088,8 +1088,6 @@ bootstrap_python() {
10881088

10891089
fix_config_sub
10901090

1091-
local myconf=""
1092-
10931091
case ${CHOST} in
10941092
(x86_64-*-*|sparcv9-*-*)
10951093
export CFLAGS="-m64"
@@ -1103,7 +1101,9 @@ bootstrap_python() {
11031101
*-linux*)
11041102
# Bug 382263: make sure Python will know about the libdir in use for
11051103
# the current arch
1106-
libdir="-L/usr/lib/$(gcc ${CFLAGS} -print-multi-os-directory)"
1104+
local -a flgarg
1105+
read -r -a flgarg <<< "${CFLAGS}"
1106+
libdir="-L/usr/lib/$(gcc "${flgarg[@]}" -print-multi-os-directory)"
11071107
;;
11081108
x86_64-*-solaris*|sparcv9-*-solaris*)
11091109
# Like above, make Python know where GCC's 64-bits
@@ -1157,7 +1157,7 @@ bootstrap_python() {
11571157
--disable-ipv6 \
11581158
--disable-shared \
11591159
--libdir="${ROOT}"/tmp/usr/lib \
1160-
${myconf} || return 1
1160+
|| return 1
11611161
emake || return 1
11621162

11631163
einfo "Installing ${A%.tar.*}"
@@ -1178,15 +1178,15 @@ bootstrap_cmake_core() {
11781178

11791179
einfo "Bootstrapping ${A%.tar.*}"
11801180

1181-
efetch https://github.com/Kitware/CMake/releases/download/v${PV}/${A} \
1181+
efetch "https://github.com/Kitware/CMake/releases/download/v${PV}/${A}" \
11821182
|| return 1
11831183

11841184
einfo "Unpacking ${A%.tar.*}"
11851185
export S="${PORTAGE_TMPDIR}/cmake-${PV}"
11861186
rm -rf "${S}"
11871187
mkdir -p "${S}" || return 1
11881188
cd "${S}" || return 1
1189-
gzip -dc "${DISTDIR}"/${A} | tar -xf -
1189+
gzip -dc "${DISTDIR}/${A}" | tar -xf -
11901190
[[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
11911191
S="${S}"/cmake-${PV}
11921192
cd "${S}" || return 1
@@ -1212,10 +1212,10 @@ bootstrap_cmake_core() {
12121212
# later on, so kill it in the installed version
12131213
ver=${A%-*} ; ver=${ver%.*}
12141214
sed -i -e '/cmake_gnu_set_sysroot_flag/d' \
1215-
"${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-GNU-*.cmake || die
1215+
"${ROOT}/tmp/usr/share/${ver}/Modules/Platform"/Apple-GNU-*.cmake || die
12161216
# disable isysroot usage with clang as well
12171217
sed -i -e '/_SYSROOT_FLAG/d' \
1218-
"${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-Clang.cmake || die
1218+
"${ROOT}/tmp/usr/share/${ver}/Modules/Platform"/Apple-Clang.cmake || die
12191219

12201220
einfo "${A%.tar.*} bootstrapped"
12211221
}
@@ -1231,7 +1231,7 @@ bootstrap_zlib_core() {
12311231

12321232
einfo "Bootstrapping ${A%.tar.*}"
12331233

1234-
efetch ${DISTFILES_G_O}/distfiles/${A} || return 1
1234+
efetch "${DISTFILES_G_O}/distfiles/${A}" || return 1
12351235

12361236
einfo "Unpacking ${A%.tar.*}"
12371237
export S="${PORTAGE_TMPDIR}/zlib-${PV}"
@@ -1242,7 +1242,7 @@ bootstrap_zlib_core() {
12421242
*.tar.gz) decomp=gzip ;;
12431243
*) decomp=bzip2 ;;
12441244
esac
1245-
${decomp} -dc "${DISTDIR}"/${A} | tar -xf -
1245+
${decomp} -dc "${DISTDIR}/${A}" | tar -xf -
12461246
[[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
12471247
S="${S}"/zlib-${PV}
12481248
cd "${S}" || return 1
@@ -1356,7 +1356,7 @@ bootstrap_make() {
13561356
bootstrap_gnu make 4.2.1 || return 1
13571357
if [[ ${MAKE} == gmake ]] ; then
13581358
# make make available as gmake
1359-
( cd ${ROOT}/tmp/usr/bin && ln -s make gmake )
1359+
( cd "${ROOT}"/tmp/usr/bin && ln -s make gmake )
13601360
fi
13611361
}
13621362

@@ -1464,7 +1464,7 @@ bootstrap_stage1() {
14641464

14651465
# See comments in do_tree().
14661466
local portroot=${PORTDIR%/*}
1467-
mkdir -p "${ROOT}"/tmp/${portroot#${ROOT}/}
1467+
mkdir -p "${ROOT}/tmp/${portroot#"${ROOT}"/}"
14681468
for x in lib sbin bin; do
14691469
mkdir -p "${ROOT}"/tmp/usr/${x}
14701470
[[ -e ${ROOT}/tmp/${x} ]] || ( cd "${ROOT}"/tmp && ln -s usr/${x} )
@@ -1678,11 +1678,11 @@ bootstrap_stage1_log() {
16781678
echo "CHOST: ${CHOST}"
16791679
echo "IDENT: ${CHOST_IDENTIFY}"
16801680
echo "==========================================="
1681-
} >> ${ROOT}/stage1.log
1681+
} >> "${ROOT}"/stage1.log
16821682
bootstrap_stage1 "${@}" 2>&1 | tee -a "${ROOT}"/stage1.log
16831683
local ret=${PIPESTATUS[0]}
16841684
[[ ${ret} == 0 ]] && touch "${ROOT}"/.stage1-finished
1685-
return ${ret}
1685+
return "${ret}"
16861686
}
16871687

16881688
do_emerge_pkgs() {
@@ -1770,6 +1770,15 @@ do_emerge_pkgs() {
17701770
# defaults).
17711771
echo "USE=${myuse[*]} PKG=${pkg}"
17721772
(
1773+
local -a eopts
1774+
read -r -a eopts <<< "${opts}"
1775+
eopts=(
1776+
"--color" "n"
1777+
"-v"
1778+
"--oneshot"
1779+
"--root-deps"
1780+
"${eopts[@]}"
1781+
)
17731782
estatus "${STAGE}: emerge ${pkg}"
17741783
unset CFLAGS CXXFLAGS
17751784
[[ -n ${OVERRIDE_CFLAGS} ]] \
@@ -1779,7 +1788,7 @@ do_emerge_pkgs() {
17791788
PORTAGE_SYNC_STALE=0 \
17801789
FEATURES="-news ${FEATURES}" \
17811790
USE="${myuse[*]}" \
1782-
emerge --color n -v --oneshot --root-deps ${opts} "${pkg}"
1791+
emerge "${eopts[@]}" "${pkg}"
17831792
) || return 1
17841793
done
17851794
}

0 commit comments

Comments
 (0)