Skip to content

Commit 80260eb

Browse files
authored
Merge pull request #31 from bedroge/remove_removal_step
Remove removal step from `bot/build.sh`
2 parents 056cc3f + 3cfd839 commit 80260eb

File tree

3 files changed

+12
-212
lines changed

3 files changed

+12
-212
lines changed

EESSI-install-software.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,7 @@ else
390390
echo_green "Feeding easystack file ${easystack_file} to EasyBuild..."
391391

392392
if [[ ${easystack_file} == *"/rebuilds/"* ]]; then
393-
# the removal script should have removed the original directory and created a new and empty one
394-
# to work around permission issues:
395-
# https://github.com/EESSI/software-layer/issues/556
396-
echo_yellow "This is a rebuild, so using --try-amend=keeppreviousinstall=True to reuse the already created directory"
397-
${EB} --easystack ${easystack_file} --robot --try-amend=keeppreviousinstall=True
393+
${EB} --easystack ${easystack_file} --rebuild
398394
else
399395
${EB} --easystack ${easystack_file} --robot
400396
fi

EESSI-remove-software.sh

Lines changed: 0 additions & 151 deletions
This file was deleted.

bot/build.sh

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -204,65 +204,18 @@ COMMON_ARGS+=("--pass-through" "--contain")
204204
# make sure to use the same parent dir for storing tarballs of tmp
205205
PREVIOUS_TMP_DIR=${PWD}/previous_tmp
206206

207-
# prepare arguments to install_software_layer.sh (specific to build step)
208-
declare -a BUILD_STEP_ARGS=()
209-
declare -a INSTALL_SCRIPT_ARGS=()
210-
declare -a REMOVAL_SCRIPT_ARGS=()
211-
if [[ ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} =~ .*/generic$ ]]; then
212-
INSTALL_SCRIPT_ARGS+=("--generic")
213-
REMOVAL_SCRIPT_ARGS+=("--generic")
214-
fi
215-
[[ ! -z ${BUILD_LOGS_DIR} ]] && INSTALL_SCRIPT_ARGS+=("--build-logs-dir" "${BUILD_LOGS_DIR}")
216-
[[ ! -z ${SHARED_FS_PATH} ]] && INSTALL_SCRIPT_ARGS+=("--shared-fs-path" "${SHARED_FS_PATH}")
217-
218207
# Skip CUDA installation for riscv.eessi.io
219208
if [[ "${REPOSITORY_NAME}" == "riscv.eessi.io" ]]; then
220209
echo "bot/build.sh: disabling CUDA installation for RISC-V repository (${REPOSITORY_NAME})"
221210
INSTALL_SCRIPT_ARGS+=("--skip-cuda-install")
222211
fi
223212

224-
# determine if the removal step has to be run
225-
# assume there's only one diff file that corresponds to the PR patch file
226-
pr_diff=$(ls [0-9]*.diff | head -1)
227-
# the true at the end of the next command is important: grep will expectedly return 1 if there is no easystack file being added under rebuilds,
228-
# but due to "set -e" the entire script would otherwise fail
229-
changed_easystacks_rebuilds=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep 'easystacks/.*yml$' | (grep "/rebuilds/" || true))
230-
if [[ -z "${changed_easystacks_rebuilds}" ]]; then
231-
echo "This PR does not add any easystack files in a rebuilds subdirectory, so let's skip the removal step."
232-
else
233-
# prepare directory to store tarball of tmp for removal and build steps
234-
TARBALL_TMP_REMOVAL_STEP_DIR=${PREVIOUS_TMP_DIR}/removal_step
235-
mkdir -p ${TARBALL_TMP_REMOVAL_STEP_DIR}
236-
237-
# prepare arguments to eessi_container.sh specific to remove step
238-
declare -a REMOVAL_STEP_ARGS=()
239-
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_REMOVAL_STEP_DIR}")
240-
REMOVAL_STEP_ARGS+=("--storage" "${STORAGE}")
241-
242-
# add fakeroot option in order to be able to remove software, see:
243-
# https://github.com/EESSI/software-layer/issues/312
244-
REMOVAL_STEP_ARGS+=("--fakeroot")
245-
246-
# create tmp file for output of removal step
247-
removal_outerr=$(mktemp remove.outerr.XXXX)
248-
249-
echo "Executing command to remove software:"
250-
echo "$software_layer_dir/eessi_container.sh ${COMMON_ARGS[@]} ${REMOVAL_STEP_ARGS[@]}"
251-
echo " -- $software_layer_dir/EESSI-remove-software.sh \"${REMOVAL_SCRIPT_ARGS[@]}\" \"$@\" 2>&1 | tee -a ${removal_outerr}"
252-
$software_layer_dir/eessi_container.sh "${COMMON_ARGS[@]}" "${REMOVAL_STEP_ARGS[@]}" \
253-
-- $software_layer_dir/EESSI-remove-software.sh "${REMOVAL_SCRIPT_ARGS[@]}" "$@" 2>&1 | tee -a ${removal_outerr}
254-
255-
# make sure that the build step resumes from the same temporary directory
256-
# this is important, as otherwise the removed software will still be there
257-
REMOVAL_TMPDIR=$(grep ' as tmp directory ' ${removal_outerr} | cut -d ' ' -f 2)
258-
BUILD_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
259-
fi
260-
261213
# prepare directory to store tarball of tmp for build step
262214
TARBALL_TMP_BUILD_STEP_DIR=${PREVIOUS_TMP_DIR}/build_step
263215
mkdir -p ${TARBALL_TMP_BUILD_STEP_DIR}
264216

265217
# prepare arguments to eessi_container.sh specific to build step
218+
declare -a BUILD_STEP_ARGS=()
266219
BUILD_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
267220
BUILD_STEP_ARGS+=("--storage" "${STORAGE}")
268221

@@ -293,6 +246,14 @@ if [[ ! -z ${SHARED_FS_PATH} ]]; then
293246
BUILD_STEP_ARGS+=("--host-injections" "${SHARED_FS_PATH}/host-injections")
294247
fi
295248

249+
# prepare arguments to install_software_layer.sh (specific to build step)
250+
declare -a INSTALL_SCRIPT_ARGS=()
251+
if [[ ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} =~ .*/generic$ ]]; then
252+
INSTALL_SCRIPT_ARGS+=("--generic")
253+
fi
254+
[[ ! -z ${BUILD_LOGS_DIR} ]] && INSTALL_SCRIPT_ARGS+=("--build-logs-dir" "${BUILD_LOGS_DIR}")
255+
[[ ! -z ${SHARED_FS_PATH} ]] && INSTALL_SCRIPT_ARGS+=("--shared-fs-path" "${SHARED_FS_PATH}")
256+
296257
# create tmp file for output of build step
297258
build_outerr=$(mktemp build.outerr.XXXX)
298259

@@ -314,14 +275,8 @@ declare -a TARBALL_STEP_ARGS=()
314275
TARBALL_STEP_ARGS+=("--save" "${TARBALL_TMP_TARBALL_STEP_DIR}")
315276

316277
# determine temporary directory to resume from
317-
if [[ -z ${REMOVAL_TMPDIR} ]]; then
318-
# no rebuild step was done, so the tarball step should resume from the build directory
319-
BUILD_TMPDIR=$(grep ' as tmp directory ' ${build_outerr} | cut -d ' ' -f 2)
320-
TARBALL_STEP_ARGS+=("--resume" "${BUILD_TMPDIR}")
321-
else
322-
# a removal step was done, so resume from its temporary directory (which was also used for the build step)
323-
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
324-
fi
278+
BUILD_TMPDIR=$(grep ' as tmp directory ' ${build_outerr} | cut -d ' ' -f 2)
279+
TARBALL_STEP_ARGS+=("--resume" "${BUILD_TMPDIR}")
325280

326281
timestamp=$(date +%s)
327282
# to set EESSI_VERSION we need to source init/eessi_defaults now

0 commit comments

Comments
 (0)