Skip to content

Commit 172242b

Browse files
committed
modifications to bot/build.sh from EESSI PR 518
1 parent 0083ddf commit 172242b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

bot/build.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ fi
182182
# determine if the removal step has to be run
183183
# assume there's only one diff file that corresponds to the PR patch file
184184
pr_diff=$(ls [0-9]*.diff | head -1)
185-
changed_easystacks_rebuilds=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | grep "/rebuilds/")
186-
if [[ -z ${changed_easystacks_rebuilds} ]]; then
185+
# 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,
186+
# but due to "set -e" the entire script would otherwise fail
187+
changed_easystacks_rebuilds=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | (grep "/rebuilds/" || true))
188+
if [[ -z "${changed_easystacks_rebuilds}" ]]; then
187189
echo "This PR does not add any easystack files in a rebuilds subdirectory, so let's skip the removal step."
188190
else
189191
# prepare directory to store tarball of tmp for removal and build steps
@@ -192,7 +194,7 @@ else
192194

193195
# prepare arguments to eessi_container.sh specific to remove step
194196
declare -a REMOVAL_STEP_ARGS=()
195-
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
197+
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_REMOVAL_STEP_DIR}")
196198
REMOVAL_STEP_ARGS+=("--storage" "${STORAGE}")
197199
# add fakeroot option in order to be able to remove software, see:
198200
# https://github.com/EESSI/software-layer/issues/312
@@ -247,7 +249,14 @@ declare -a TARBALL_STEP_ARGS=()
247249
TARBALL_STEP_ARGS+=("--save" "${TARBALL_TMP_TARBALL_STEP_DIR}")
248250

249251
# determine temporary directory to resume from
250-
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
252+
if [[ -z ${REMOVAL_TMPDIR} ]]; then
253+
# no rebuild step was done, so the tarball step should resume from the build directory
254+
BUILD_TMPDIR=$(grep ' as tmp directory ' ${build_outerr} | cut -d ' ' -f 2)
255+
TARBALL_STEP_ARGS+=("--resume" "${BUILD_TMPDIR}")
256+
else
257+
# a removal step was done, so resume from its temporary directory (which was also used for the build step)
258+
TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
259+
fi
251260

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

0 commit comments

Comments
 (0)