Skip to content

Commit 081349d

Browse files
committed
scripts/bootstrap-prefix: shellcheck
Signed-off-by: Fabian Groffen <[email protected]>
1 parent 8c71637 commit 081349d

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

scripts/bootstrap-prefix.sh

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
#shellcheck disable=SC1091,SC2016,SC2030,SC2031,SC2038,SC2185,SC2120
2+
#shellcheck disable=SC1091,SC2015,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

@@ -1902,8 +1902,10 @@ bootstrap_stage2() {
19021902
emerge_pkgs --nodeps "${pkgs[@]}" || return 1
19031903

19041904
# Debian multiarch supported by RAP needs ld to support sysroot.
1905-
EXTRA_ECONF=$(rapx --with-sysroot=/) \
1906-
emerge_pkgs --nodeps ${linker} || return 1
1905+
for pkg in ${linker} ; do
1906+
EXTRA_ECONF=$(rapx --with-sysroot=/) \
1907+
emerge_pkgs --nodeps "${pkg}" || return 1
1908+
done
19071909

19081910
# During Gentoo prefix bootstrap stage2, GCC is built with
19091911
# "--disable-bootstrap". For Darwin, it means that rather than letting
@@ -1941,7 +1943,7 @@ bootstrap_stage2() {
19411943
OVERRIDE_CXXFLAGS="${CPPFLAGS} ${OVERRIDE_CXXFLAGS}" \
19421944
TPREFIX="${ROOT}" \
19431945
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \
1944-
emerge_pkgs --nodeps ${pkg} || return 1
1946+
emerge_pkgs --nodeps "${pkg}" || return 1
19451947

19461948
if [[ "${pkg}" == *sys-devel/llvm* || ${pkg} == *sys-devel/clang* ]] ;
19471949
then
@@ -1972,7 +1974,9 @@ bootstrap_stage2() {
19721974
# multilib.eclass -- can't blame it at this point really)
19731975
# do it ourselves here to make the bootstrap continue
19741976
if [[ -x "${ROOT}"/tmp/usr/bin/${CHOST}-clang ]] ; then
1975-
( cd "${ROOT}"/tmp/usr/bin && ln -s clang ${CHOST}-clang && ln -s clang++ ${CHOST}-clang++ )
1977+
( cd "${ROOT}"/tmp/usr/bin && \
1978+
ln -s clang "${CHOST}-clang" && \
1979+
ln -s clang++ "${CHOST}-clang++" )
19761980
fi
19771981
elif ! is-rap ; then
19781982
# make sure the EPREFIX gcc shared libraries are there
@@ -1990,11 +1994,11 @@ bootstrap_stage2_log() {
19901994
echo "CHOST: ${CHOST}"
19911995
echo "IDENT: ${CHOST_IDENTIFY}"
19921996
echo "==========================================="
1993-
} >> ${ROOT}/stage2.log
1994-
bootstrap_stage2 "${@}" 2>&1 | tee -a ${ROOT}/stage2.log
1997+
} >> "${ROOT}"/stage2.log
1998+
bootstrap_stage2 "${@}" 2>&1 | tee -a "${ROOT}"/stage2.log
19951999
local ret=${PIPESTATUS[0]}
19962000
[[ ${ret} == 0 ]] && touch "${ROOT}/.stage2-finished"
1997-
return ${ret}
2001+
return "${ret}"
19982002
}
19992003

20002004
bootstrap_stage3() {
@@ -2038,7 +2042,7 @@ bootstrap_stage3() {
20382042
# tmp, we basically made the system unusable, so remove python-exec
20392043
# here so we can use the python in tmp
20402044
for pef in python{,3} python{,3}-config ; do
2041-
rm -f "${ROOT}"/tmp/usr/bin/${pef}
2045+
rm -f "${ROOT}/tmp/usr/bin/${pef}"
20422046
[[ ${pef} == *-config ]] && ppf=-config || ppf=
20432047
( cd "${ROOT}"/tmp/usr/bin && \
20442048
ln -s "python$(python_ver)${ppf}" "${pef}" )
@@ -2084,13 +2088,13 @@ bootstrap_stage3() {
20842088
# packages installed end up in ROOT/tmp, which means we keep using
20852089
# stage2 area and config which breaks things like binutils-config'
20862090
# path search, so don't use this
2087-
with_stack_emerge_pkgs() {
2088-
# keep FEATURES=stacked-prefix until we bump portage in stage1
2089-
FEATURES="${FEATURES} stacked-prefix" \
2090-
USE="${USE} prefix-stack" \
2091-
PORTAGE_OVERRIDE_EPREFIX="${ROOT}/tmp" \
2092-
emerge_pkgs "$@"
2093-
}
2091+
#with_stack_emerge_pkgs() {
2092+
# # keep FEATURES=stacked-prefix until we bump portage in stage1
2093+
# FEATURES="${FEATURES} stacked-prefix" \
2094+
# USE="${USE} prefix-stack" \
2095+
# PORTAGE_OVERRIDE_EPREFIX="${ROOT}/tmp" \
2096+
# emerge_pkgs "$@"
2097+
#}
20942098

20952099
# pre_emerge_pkgs relies on stage 2 portage, but installs into the
20962100
# final destination Prefix
@@ -2116,7 +2120,9 @@ bootstrap_stage3() {
21162120
cp -a "${ROOT}"{/tmp,}/usr/share/portage
21172121
fi
21182122

2123+
local -a linker_pkgs compiler_pkgs
21192124
read -r -a linker_pkgs <<< "${linker}"
2125+
read -r -a compiler_pkgs <<< "${compiler}"
21202126

21212127
if is-rap ; then
21222128
# We need ${ROOT}/usr/bin/perl to merge glibc.
@@ -2222,7 +2228,7 @@ bootstrap_stage3() {
22222228
fi
22232229
# remove stage2 ld so that stage3 ld is used by stage2 gcc.
22242230
is-rap && [[ -f ${ROOT}/tmp/usr/${CHOST}/bin/ld ]] && \
2225-
mv ${ROOT}/tmp/usr/${CHOST}/bin/ld{,.stage2}
2231+
mv "${ROOT}/tmp/usr/${CHOST}/bin"/ld{,.stage2}
22262232

22272233
# On some hosts, gcc gets confused now when it uses the new linker,
22282234
# see for instance bug #575480. While we would like to hide that
@@ -2241,10 +2247,10 @@ bootstrap_stage3() {
22412247

22422248
# Try to get ourself out of the mud, bug #575324
22432249
EXTRA_ECONF="--disable-compiler-version-checks $(rapx '--disable-lto --disable-bootstrap')" \
2244-
GCC_MAKE_TARGET=$(rapx all) \
2250+
GCC_MAKE_TARGET="$(rapx all)" \
22452251
MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \
2246-
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \
2247-
pre_emerge_pkgs --nodeps ${compiler} || return 1
2252+
PYTHON_COMPAT_OVERRIDE="python$(python_ver)" \
2253+
pre_emerge_pkgs --nodeps "${compiler_pkgs[@]}" || return 1
22482254

22492255
# Undo libgcc_s.so path of stage2
22502256
# Now we have the compiler right there
@@ -2348,11 +2354,11 @@ bootstrap_stage3_log() {
23482354
echo "CHOST: ${CHOST}"
23492355
echo "IDENT: ${CHOST_IDENTIFY}"
23502356
echo "==========================================="
2351-
} >> ${ROOT}/stage3.log
2352-
bootstrap_stage3 "${@}" 2>&1 | tee -a ${ROOT}/stage3.log
2357+
} >> "${ROOT}"/stage3.log
2358+
bootstrap_stage3 "${@}" 2>&1 | tee -a "${ROOT}"/stage3.log
23532359
local ret=${PIPESTATUS[0]}
23542360
[[ ${ret} == 0 ]] && touch "${ROOT}/.stage3-finished"
2355-
return ${ret}
2361+
return "${ret}"
23562362
}
23572363

23582364
set_helper_vars() {
@@ -2403,7 +2409,7 @@ bootstrap_interactive() {
24032409
24042410
EOF
24052411
[[ ${TODO} == 'noninteractive' ]] && ans=yes ||
2406-
read -p "Do you want me to start off now? [Yn] " ans
2412+
read -r -p "Do you want me to start off now? [Yn] " ans
24072413
case "${ans}" in
24082414
[Yy][Ee][Ss]|[Yy]|"")
24092415
: ;;

0 commit comments

Comments
 (0)