Skip to content

Commit

Permalink
fix probelm with tarball setup.sh return code
Browse files Browse the repository at this point in the history
  • Loading branch information
rlcee committed Apr 7, 2021
1 parent 4602bc6 commit 0721bc5
Showing 1 changed file with 60 additions and 8 deletions.
68 changes: 60 additions & 8 deletions bin/museTarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ if [ $MUSE_VERBOSE -gt 0 ]; then
echo "Extra files: $EXTRAS"
fi

# some regex to categorize dirs
linkReg="^link/*"
cvmfsReg="^/cvmfs/*"

# create an empty tarball
tar -cf $TBALL -T /dev/null
Expand All @@ -114,35 +117,84 @@ if [ "$RELEASE" == "false" ] ; then # for grid tarball
# also exclude *.cc and .git
FLAGS=" $FLAGS -X $MUSE_DIR/config/tarExcludeGrid.txt"
# put it in a Code subdirectory
# last transform prevents /cvmfs from becoming Code/cvmfs
FLAGS=" $FLAGS --transform=s|^|Code/| --transform=s|^Code//cvmfs|/cvmfs| "
fi

# tar any extra files
[ -n "$EXTRAS" ] && tar $FLAGS $EXTRAS


#
# examine the PRODUCTS path and if there are local areas,
# then include them in the tarball
#
PRODPATH=""
NPP=0
for DD in $(echo $PRODUCTS | tr ":" " " )
do
if [[ ! "$DD" =~ $cvmfsReg ]]; then
if [ $MUSE_VERBOSE -gt 0 ]; then
echo "taring local PRODUCTS area $DD"
fi
LPP=localProducts$NPP
ln -s $DD $LPP
tar $FLAGS -h $LPP
rm -f $LPP
PRODPATH="\$CODE_DIR/$LPP:$PRODPATH"
NPP=$(($NPP+1))
fi
done
if [ -n "$PRODPATH" ]; then
PRODPATH="export PRODUCTS=$PRODPATH\$PRODUCTS"
fi


#
# if this tarball is for the grid, add a setup file
#

if [ "$RELEASE" == "false" ] ; then # for grid tarball
# create a fake setup.sh
if [ -f "setup.sh" ]; then
mv setup.sh setup.sh-$(date +%s)
fi

# figure out the ops that are needed explicitly in the setup
USE_OPTS="$MUSE_OPTS"
[[ ! "$USE_OPTS" =~ "$MUSE_BUILD" ]] && USE_OPTS="$MUSE_BUILD $USE_OPTS"
[[ ! "$USE_OPTS" =~ "$MUSE_COMPILER_E" ]] && USE_OPTS="$MUSE_COMPILER_E $USE_OPTS"
[[ ! "$USE_OPTS" =~ "$MUSE_ENVSET" ]] && USE_OPTS="$MUSE_ENVSET $USE_OPTS"

#
# this is the file that the grid job will source
#

cat >> setup.sh <<EOF
setup muse
CODE_DIR=\$(dirname \$(readlink -f \$BASH_SOURCE))
muse setup \$CODE_DIR -q $MUSE_BUILD $MUSE_COMPILER_E $MUSE_ENVSET $MUSE_OPTS
[ -f \$CODE_DIR/setup_pre.sh ] && source \$CODE_DIR/setup_pre.sh
$PRODPATH
setup muse
muse setup \$CODE_DIR -q $USE_OPTS
RC=\$?
[ -f \$CODE_DIR/setup_post.sh ] && source \$CODE_DIR/setup_post.sh
return \$RC
EOF

# echo "setup muse" > setup.sh
# TEMP=" -q $MUSE_BUILD $MUSE_COMPILER_E $MUSE_ENVSET $MUSE_OPTS"
# echo "muse setup Code $TEMP " >> setup.sh

tar $FLAGS setup.sh
rm setup.sh

# allow user scripts before and after the "muse setup"
[ -f setup_pre.sh ] && tar $FLAGS setup_pre.sh
[ -f setup_post.sh ] && tar $FLAGS setup_post.sh
fi

# if muse directory exists, include it
[ -d muse ] && tar $FLAGS muse

#
# now the builds
linkReg="^link/*"
cvmfsReg="^/cvmfs/*"
#
for REPO in $MUSE_REPOS
do
# follow links by default
Expand Down

0 comments on commit 0721bc5

Please sign in to comment.