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 committed Oct 29, 2024
1 parent e11820a commit 6d88cdd
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions DATA/tools/epn/gen_topo_o2dpg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,26 @@ 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
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; }
CHECKOUTATTEMPT=1
while true; 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
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
if [ $? -eq 0 ]; then
break
else
[[ $CHECKOUTATTEMPT -eq 2 ]] && { echo git reset error 1>&2; exit 1; }
echo "First attempt to checkout O2DPG failed. Cleaning up and trying a second time" 1>&2
CHECKOUTATTEMPT=2
cd $GEN_TOPO_WORKDIR || { echo Cannot enter work dir 1>&2; exit 1; }
rm -rf O2DPG
fi
done
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
Expand Down

0 comments on commit 6d88cdd

Please sign in to comment.