Skip to content

Commit 0841291

Browse files
ehellbaralcaliva
authored andcommitted
protection against corrupt O2DPG repository during topology generation
(cherry picked from commit 4fb7da4)
1 parent 2b6245b commit 0841291

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

DATA/tools/epn/gen_topo_o2dpg.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,16 @@ while true; do
8181
break
8282
fi
8383
fi
84-
if [[ ! -d O2DPG ]]; then git clone https://github.com/AliceO2Group/O2DPG.git 1>&2 || { echo O2DPG checkout failed 1>&2; exit 1; }; fi
85-
cd O2DPG
84+
for CHECKOUTATTEMPT in 1 2; do
85+
if [[ ! -d O2DPG ]]; then git clone https://github.com/AliceO2Group/O2DPG.git 1>&2 || { echo O2DPG checkout failed 1>&2; exit 1; }; fi
86+
cd O2DPG
87+
rm -f DATA/core_dump_*
88+
git reset --hard HEAD &> /dev/null && git clean -d -f &> /dev/null && break
89+
[[ $CHECKOUTATTEMPT -eq 2 ]] && { echo git reset error 1>&2; exit 1; }
90+
echo "Clean-up of O2DPG repository failed. Removing repository and cloning it from scratch" 1>&2
91+
cd $GEN_TOPO_WORKDIR || { echo Cannot enter work dir 1>&2; exit 1; }
92+
rm -rf O2DPG
93+
done
8694
git checkout $GEN_TOPO_SOURCE &> /dev/null
8795
if [[ $? != 0 ]]; then
8896
git fetch --tags origin 1>&2 || { echo Repository update failed 1>&2; exit 1; }

0 commit comments

Comments
 (0)