From 5e59880d8190e7cd4480e2675b7afd6a8febdec7 Mon Sep 17 00:00:00 2001 From: Ray Culbertson Date: Thu, 24 Mar 2022 20:20:46 -0500 Subject: [PATCH] add check on order of repos in backing links --- bin/museSetup.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/bin/museSetup.sh b/bin/museSetup.sh index e47fbbf..51fb416 100755 --- a/bin/museSetup.sh +++ b/bin/museSetup.sh @@ -955,7 +955,7 @@ do # the repos in this dir export MUSE_REPOS_BDIR="$TEMP0 $TEMP1" # all repos - export MUSE_REPOS="${MUSE_REPOS}$MUSE_REPOS_BDIR " + export MUSE_REPOS="${MUSE_REPOS_BDIR} $MUSE_REPOS" [ "$BDIR" == "$MUSE_WORK_DIR" ] && export MUSE_LOCAL_REPOS="$MUSE_REPOS_BDIR" # done sorting the repos @@ -1023,11 +1023,64 @@ do done # big loop over backing build dirs +# clean whitespace +export MUSE_LINK_ORDER=$(echo $MUSE_LINK_ORDER) +export MUSE_REPOS=$(echo $MUSE_REPOS) + if [ $MUSE_VERBOSE -gt 0 ]; then echo "MUSE_LINK_ORDER=$MUSE_LINK_ORDER" echo "MUSE_REPOS=$MUSE_REPOS" fi +# +# the next 30 lines checks if there were backing repos out of order, +# for example, if you have Offline locally, then you might have the +# backing chain: Offline -> TrkAna -> Offline +# this has chance of inconsistent builds and memory errors because +# TrkAna will see libraries from the first Offline, +# but expect them from the second +# + +QWARN="" +NR=$(echo $MUSE_REPOS | wc -w) +RARR=($MUSE_REPOS) +# loop over all repos +for IRU in ${!RARR[@]} +do + RU=${RARR[$IRU]} + # loop over all downstream repos + IRD=$(($IRU+1)) + while [ $IRD -lt $NR ] + do + RD=${RARR[$IRD]} + QFU="" + QFD="" + # check where they are in the link order + for RR in $MUSE_LINK_ORDER + do + if [ "$RU" == "$RR" ]; then + QFU="found" + # while in linkOrder loop, found upstream + # after downstream, which is wrong order + if [ "$QFD" ]; then + QWARN="yes" + if [ $MUSE_VERBOSE -gt 0 ]; then + echo "Repo order check found $RU ahead of $RD" + fi + fi + fi + [ "$RD" == "$RR" ] && QFD="found" + done + IRD=$(($IRD+1)) + done +done + +if [ "$QWARN" ]; then + echo "Warning - found repos in an unexpected link order," + echo " such as Offline upstream of TrkAna. This can lead to " + echo " inconsistent builds and memory errors." +fi + # # if build area is on cvmfs and contains a setup.sh script, typically written