Skip to content

Commit 45be6af

Browse files
committed
Merge bitcoin/bitcoin#27333: ci: cleanup of CI_EXEC & CI_EXEC_ROOT
b5ef141 ci: cleanup of CI_EXEC & CI_EXEC_ROOT (refs #27321) (Vasil Stoyanov) Pull request description: Basically it removes the above-mentioned env-vars as per MarcoFalke's instructions. The only deviation from the plan laid out there was that I double-quoted the last instance of $ANDROID_HOME for the sake of consistency and future-proofing and the rest of the non-quoted vars due to lint failing the build. Fixes #27321. ACKs for top commit: josibake: ACK bitcoin/bitcoin@b5ef141 hernanmarino: untested ACK b5ef141. LGTM Tree-SHA512: a79776bf64a2fa8b38195cc84445e171fd689f156aac5a1e5d39040300567eb9f4c2ebd00fbf3fa0e55b68793f8f752d94f7d817f6097ed9dd3a8ea57651b981
2 parents 328087d + b5ef141 commit 45be6af

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

ci/test/01_base_install.sh

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,28 @@
66

77
export LC_ALL=C.UTF-8
88

9-
# This script is always run as root, and the functions can be removed and
10-
# replaced by a bash -c "command" directly, where needed.
11-
# For now, they are named aliases to aid review with --color-moved=dimmed-zebra.
12-
CI_EXEC_ROOT () { bash -c "$*"; }
13-
CI_EXEC() { bash -c "$*"; }
14-
export -f CI_EXEC_ROOT
15-
export -f CI_EXEC
169

1710
if [ -n "$DPKG_ADD_ARCH" ]; then
18-
CI_EXEC_ROOT dpkg --add-architecture "$DPKG_ADD_ARCH"
11+
dpkg --add-architecture "$DPKG_ADD_ARCH"
1912
fi
2013

2114
if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then
22-
${CI_RETRY_EXE} CI_EXEC_ROOT dnf -y install epel-release
23-
${CI_RETRY_EXE} CI_EXEC_ROOT dnf -y --allowerasing install "$CI_BASE_PACKAGES" "$PACKAGES"
15+
${CI_RETRY_EXE} bash -c "dnf -y install epel-release"
16+
${CI_RETRY_EXE} bash -c "dnf -y --allowerasing install $CI_BASE_PACKAGES $PACKAGES"
2417
elif [ "$CI_USE_APT_INSTALL" != "no" ]; then
2518
if [[ "${ADD_UNTRUSTED_BPFCC_PPA}" == "true" ]]; then
2619
# Ubuntu 22.04 LTS and Debian 11 both have an outdated bpfcc-tools packages.
2720
# The iovisor PPA is outdated as well. The next Ubuntu and Debian releases will contain updated
2821
# packages. Meanwhile, use an untrusted PPA to install an up-to-date version of the bpfcc-tools
2922
# package.
3023
# TODO: drop this once we can use newer images in GCE
31-
CI_EXEC_ROOT add-apt-repository ppa:hadret/bpfcc
24+
add-apt-repository ppa:hadret/bpfcc
3225
fi
3326
if [[ -n "${APPEND_APT_SOURCES_LIST}" ]]; then
34-
CI_EXEC_ROOT echo "${APPEND_APT_SOURCES_LIST}" \>\> /etc/apt/sources.list
27+
echo "${APPEND_APT_SOURCES_LIST}" >> /etc/apt/sources.list
3528
fi
36-
${CI_RETRY_EXE} CI_EXEC_ROOT apt-get update
37-
${CI_RETRY_EXE} CI_EXEC_ROOT apt-get install --no-install-recommends --no-upgrade -y "$PACKAGES" "$CI_BASE_PACKAGES"
29+
${CI_RETRY_EXE} apt-get update
30+
${CI_RETRY_EXE} bash -c "apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $CI_BASE_PACKAGES"
3831
fi
3932

4033
if [ -n "$PIP_PACKAGES" ]; then
@@ -44,47 +37,47 @@ if [ -n "$PIP_PACKAGES" ]; then
4437
IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt" ${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES
4538
else
4639
# shellcheck disable=SC2086
47-
${CI_RETRY_EXE} CI_EXEC pip3 install --user $PIP_PACKAGES
40+
${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES
4841
fi
4942
fi
5043

5144
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
52-
CI_EXEC_ROOT "update-alternatives --install /usr/bin/clang++ clang++ \$(which clang++-12) 100"
53-
CI_EXEC_ROOT "update-alternatives --install /usr/bin/clang clang \$(which clang-12) 100"
54-
CI_EXEC "mkdir -p ${BASE_SCRATCH_DIR}/msan/build/"
55-
CI_EXEC "git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-12.0.0 ${BASE_SCRATCH_DIR}/msan/llvm-project"
56-
CI_EXEC "cd ${BASE_SCRATCH_DIR}/msan/build/ && cmake -DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi' -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_TARGETS_TO_BUILD=X86 ../llvm-project/llvm/"
57-
CI_EXEC "cd ${BASE_SCRATCH_DIR}/msan/build/ && make $MAKEJOBS cxx"
45+
update-alternatives --install /usr/bin/clang++ clang++ "$(which clang++-12)" 100
46+
update-alternatives --install /usr/bin/clang clang "$(which clang-12)" 100
47+
mkdir -p "${BASE_SCRATCH_DIR}"/msan/build/
48+
git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-12.0.0 "${BASE_SCRATCH_DIR}"/msan/llvm-project
49+
cd "${BASE_SCRATCH_DIR}"/msan/build/ && cmake -DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi' -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_TARGETS_TO_BUILD=X86 ../llvm-project/llvm/
50+
cd "${BASE_SCRATCH_DIR}"/msan/build/ && make "$MAKEJOBS" cxx
5851
fi
5952

6053
if [[ "${RUN_TIDY}" == "true" ]]; then
6154
if [ ! -d "${DIR_IWYU}" ]; then
62-
CI_EXEC "mkdir -p ${DIR_IWYU}/build/"
63-
CI_EXEC "git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_15 ${DIR_IWYU}/include-what-you-use"
64-
CI_EXEC "cd ${DIR_IWYU}/build && cmake -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-15 ../include-what-you-use"
65-
CI_EXEC_ROOT "cd ${DIR_IWYU}/build && make install $MAKEJOBS"
55+
mkdir -p "${DIR_IWYU}"/build/
56+
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_15 "${DIR_IWYU}"/include-what-you-use
57+
cd "${DIR_IWYU}"/build && cmake -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-15 ../include-what-you-use
58+
cd "${DIR_IWYU}"/build && make install "$MAKEJOBS"
6659
fi
6760
fi
6861

69-
CI_EXEC mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
62+
mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
7063

7164
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers"
7265

7366
if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ]; then
7467
OSX_SDK_FILENAME="${OSX_SDK_BASENAME}.tar.gz"
7568
OSX_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${OSX_SDK_FILENAME}"
7669
if [ ! -f "$OSX_SDK_PATH" ]; then
77-
CI_EXEC curl --location --fail "${SDK_URL}/${OSX_SDK_FILENAME}" -o "$OSX_SDK_PATH"
70+
curl --location --fail "${SDK_URL}/${OSX_SDK_FILENAME}" -o "$OSX_SDK_PATH"
7871
fi
79-
CI_EXEC tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH"
72+
tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH"
8073
fi
8174

8275
if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then
8376
ANDROID_TOOLS_PATH=${DEPENDS_DIR}/sdk-sources/android-tools.zip
8477
if [ ! -f "$ANDROID_TOOLS_PATH" ]; then
85-
CI_EXEC curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH"
78+
curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH"
8679
fi
87-
CI_EXEC mkdir -p "$ANDROID_HOME"
88-
CI_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME"
89-
CI_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=\"${ANDROID_HOME}\" --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\""
80+
mkdir -p "$ANDROID_HOME"
81+
unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME"
82+
yes | "${ANDROID_HOME}"/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_HOME}" --install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "platforms;android-${ANDROID_API_LEVEL}" "ndk;${ANDROID_NDK_VERSION}"
9083
fi

0 commit comments

Comments
 (0)