Skip to content

Commit

Permalink
protection against corrupt O2DPG repository during topology generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehellbar authored and sawenzel committed Oct 31, 2024
1 parent 15049b0 commit 4fb7da4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions DATA/tools/epn/gen_topo_o2dpg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,21 @@ while true; do
break
fi
fi
if [[ ! -d O2DPG ]]; then git clone https://github.com/AliceO2Group/O2DPG.git 1>&2 || { echo O2DPG checkout failed 1>&2; exit 1; }; fi
cd O2DPG
for CHECKOUTATTEMPT in 1 2; do
if [[ ! -d O2DPG ]]; then git clone https://github.com/AliceO2Group/O2DPG.git 1>&2 || { echo O2DPG checkout failed 1>&2; exit 1; }; fi
cd O2DPG
rm -f DATA/core_dump_*
git reset --hard HEAD &> /dev/null && git clean -d -f &> /dev/null && break
[[ $CHECKOUTATTEMPT -eq 2 ]] && { echo git reset error 1>&2; exit 1; }
echo "Clean-up of O2DPG repository failed. Removing repository and cloning it from scratch" 1>&2
cd $GEN_TOPO_WORKDIR || { echo Cannot enter work dir 1>&2; exit 1; }
rm -rf O2DPG
done
git checkout $GEN_TOPO_SOURCE &> /dev/null
if [[ $? != 0 ]]; then
git fetch --tags origin 1>&2 || { echo Repository update failed 1>&2; exit 1; }
git checkout $GEN_TOPO_SOURCE &> /dev/null || { echo commit does not exist 1>&2; exit 1; }
fi
git reset --hard $GEN_TOPO_SOURCE &> /dev/null || { echo git reset error 1>&2; exit 1; }
rm -f DATA/core_dump_*
# At a tag, or a detached non-dirty commit, but not on a branch
if ! git describe --exact-match --tags HEAD &> /dev/null && ( git symbolic-ref -q HEAD &> /dev/null || ! git diff-index --quiet HEAD &> /dev/null ); then
unset GEN_TOPO_CACHEABLE
Expand Down

0 comments on commit 4fb7da4

Please sign in to comment.