|
182 | 182 | # determine if the removal step has to be run |
183 | 183 | # assume there's only one diff file that corresponds to the PR patch file |
184 | 184 | 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 |
187 | 189 | echo "This PR does not add any easystack files in a rebuilds subdirectory, so let's skip the removal step." |
188 | 190 | else |
189 | 191 | # prepare directory to store tarball of tmp for removal and build steps |
|
192 | 194 |
|
193 | 195 | # prepare arguments to eessi_container.sh specific to remove step |
194 | 196 | 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}") |
196 | 198 | REMOVAL_STEP_ARGS+=("--storage" "${STORAGE}") |
197 | 199 | # add fakeroot option in order to be able to remove software, see: |
198 | 200 | # https://github.com/EESSI/software-layer/issues/312 |
@@ -247,7 +249,14 @@ declare -a TARBALL_STEP_ARGS=() |
247 | 249 | TARBALL_STEP_ARGS+=("--save" "${TARBALL_TMP_TARBALL_STEP_DIR}") |
248 | 250 |
|
249 | 251 | # 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 |
251 | 260 |
|
252 | 261 | timestamp=$(date +%s) |
253 | 262 | # to set EESSI_VERSION we need to source init/eessi_defaults now |
|
0 commit comments