Commit 95fafeb4 authored by Andrea Valassi's avatar Andrea Valassi
Browse files

Attempt patches for CORALCOOL-2856


git-svn-id: file:///git/lcgcool.svndb/cool/trunk@19888 4525493e-7705-40b1-a816-d608a930855b
parent d9cb4d59
......@@ -3,19 +3,23 @@ if [ "$BASH_SOURCE" != "$0" ]; then # See CORALCOOL-2823
echo "ERROR! This script was sourced?" > /dev/stderr
return 1
fi
topdir=`dirname $0`
topdir=`cd $topdir; pwd -P`
topdirl=`dirname $0`
topdirl=`cd $topdirl; pwd -L`
topdirp=`cd $topdirl; pwd -P`
# Check optional arguments
skipcheck=0
if [ "$1" == "-q" ] || [ "$1" == "--quiet" ]; then
skipcheck=1
msg=0
if [ "$1" == "-q" ]; then
msg=q
shift
elif [ "$1" == "-v" ]; then
msg=v
shift
fi
# Check mandatory arguments
if [ "$1" == "" ]; then
echo "Usage: $0 [-q|--quiet] command [arguments]"
echo "Usage: $0 [-q|-v] command [arguments]"
exit 1
fi
......@@ -23,17 +27,23 @@ fi
# was relocated (CORALCOOL-2829; new relocation replacing CORALCOOL-2787)
# [Do not relocate in build.x86/TMP.install (i.e. if envxmlnew == envxmlold)]
# Relocate also python and all other externals for relocations out of lcgcmake
# If pythonExecutable is not found, try appending LCG_VERSION (CORALCOOL-2856)
envxmlold=@env_release_xml@
envxmlnew=$topdir/env/@env_xml_basename@
###echo envxmlold is $envxmlold
###echo envxmlnew is $envxmlnew
envxmlnew=$topdirp/env/@env_xml_basename@
pythonExecutable=@PYTHON_EXECUTABLE_REALPATH@
lcgversion=@LCG_VERSION@
if [ "$msg" == "v" ]; then
echo envxmlold is $envxmlold
echo envxmlnew is $envxmlnew
fi
project=`basename $envxmlnew .xenv`
projsysold=`more $envxmlnew | grep variable=\"${project}SYS\" | tr "<" " " | tr ">" " " | awk '{print $3}'`
if [ -d $projsysold ]; then projsysold=`cd $projsysold; pwd -P`; fi
projsysnew=$topdir
###echo projsysold is $projsysold
###echo projsysnew is $projsysnew
projsysnew=$topdirl
if [ "$msg" == "v" ]; then
echo projsysold is $projsysold
echo projsysnew is $projsysnew
fi
if [ "$envxmlnew" != "$envxmlold" ] && [ "$projsysnew" != "$projsysold" ]; then # project was relocated
if [ "$project" == "CORAL" ]; then
export CORALSYS=$projsysnew
......@@ -44,15 +54,34 @@ if [ "$envxmlnew" != "$envxmlold" ] && [ "$projsysnew" != "$projsysold" ]; then
lcgrelold_lcgcmake=`dirname $lcgrelold_lcgcmake`
lcgrelold_lcgcmake=`dirname $lcgrelold_lcgcmake`
lcgrelold=`more $envxmlnew | grep variable=\"LCG_releases_base\" | tr "<" " " | tr ">" " " | awk '{print $3}'`
###echo lcgrelold_lcgcmake is $lcgrelold_lcgcmake
###echo lcgrelold is $lcgrelold
if [ "$msg" == "v" ]; then
echo lcgrelold_lcgcmake is $lcgrelold_lcgcmake
echo lcgrelold is $lcgrelold
fi
if [ "$lcgrelold" == "$lcgrelold_lcgcmake" ]; then # lcgcmake dir structure
lcgrelnew_lcgcmake=`dirname $projsysnew`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
###echo lcgrelnew_lcgcmake is $lcgrelnew_lcgcmake
export LCG_releases_base=$lcgrelnew_lcgcmake
pythonExecutable=`echo ${pythonExecutable} | sed "s|${lcgrelold_lcgcmake}|${lcgrelnew_lcgcmake}|"`
if [ "$LCG_releases_base" != "" ]; then
if [ "$msg" == "v" ]; then
echo LCG_releases_base is $LCG_releases_base
fi
pythonExecutable=`echo ${pythonExecutable} | sed "s|${lcgrelold_lcgcmake}|${LCG_releases_base}|"`
else
lcgrelnew_lcgcmake=`dirname $projsysnew`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
if [ "$msg" == "v" ]; then
echo lcgrelnew_lcgcmake is $lcgrelnew_lcgcmake
fi
export LCG_releases_base=$lcgrelnew_lcgcmake
pythonExecutable=`echo ${pythonExecutable} | sed "s|${lcgrelold_lcgcmake}|${lcgrelnew_lcgcmake}|"`
if [ ! -f ${pythonExecutable} ] && [ "$lcgversion" != "" ]; then
lcgrelnew_lcgcmake2=$lcgrelnew_lcgcmake/$lcgversion
if [ "$msg" == "v" ]; then
echo lcgrelnew_lcgcmake2 is $lcgrelnew_lcgcmake2
fi
export LCG_releases_base=$lcgrelnew_lcgcmake2
pythonExecutable=`echo ${pythonExecutable} | sed "s|${lcgrelnew_lcgcmake}|${lcgrelnew_lcgcmake2}|"`
fi
fi
fi
fi
......@@ -66,9 +95,9 @@ unset PYTHONPATH
# Run the specified command in the correct runtime environment
# [Make sure the minimum PATH is defined in case this is run through 'env -i']
PATH=$PATH:/usr/local/bin:/bin:/usr/bin ${pythonExecutable} $topdir/env/xenv --xml=$envxmlnew "$@"
PATH=$PATH:/usr/local/bin:/bin:/usr/bin ${pythonExecutable} $topdirl/env/xenv --xml=$envxmlnew "$@"
status=$?
if [ "$skipcheck" == "0" ] && [ "$status" != "0" ]; then
if [ "$msg" != "q" ] && [ "$status" != "0" ]; then
echo "ERROR! Failed to execute command \"$*\""
exit $status
fi
......
......@@ -3,8 +3,8 @@ if [ "$BASH_SOURCE" != "$0" ]; then # See CORALCOOL-2823
echo "ERROR! This script was sourced?" > /dev/stderr
return 1
fi
topdir=`dirname $0`
topdir=`cd $topdir; pwd -P`
topdirl=`dirname $0`
topdirl=`cd $topdirl; pwd -L`
# Check arguments
if [ "$1" != "" ]; then
......@@ -13,57 +13,11 @@ if [ "$1" != "" ]; then
fi
# Check if .bashrc exists
if [ ! -f $topdir/env/.bashrc ]; then
echo "ERROR! $topdir/env/.bashrc does not exist"
if [ ! -f $topdirl/env/.bashrc ]; then
echo "ERROR! $topdirl/env/.bashrc does not exist"
exit 1
fi
# Override CORALSYS/COOLSYS and LCG_releases_base if this installation
# was relocated (CORALCOOL-2829; new relocation replacing CORALCOOL-2787)
# Relocate also python and all other externals for relocations out of lcgcmake
# [Do not relocate in build.x86/TMP.install (i.e. if envxmlnew == envxmlold)]
envxmlold=@env_release_xml@
envxmlnew=$topdir/env/@env_xml_basename@
###echo envxmlold is $envxmlold
###echo envxmlnew is $envxmlnew
pythonExecutable=@PYTHON_EXECUTABLE_REALPATH@
project=`basename $envxmlnew .xenv`
projsysold=`more $envxmlnew | grep variable=\"${project}SYS\" | tr "<" " " | tr ">" " " | awk '{print $3}'`
if [ -d $projsysold ]; then projsysold=`cd $projsysold; pwd -P`; fi
projsysnew=$topdir
###echo projsysold is $projsysold
###echo projsysnew is $projsysnew
if [ "$envxmlnew" != "$envxmlold" ] && [ "$projsysnew" != "$projsysold" ]; then # project was relocated
if [ "$project" == "CORAL" ]; then
export CORALSYS=$projsysnew
else
export COOLSYS=$projsysnew
fi
lcgrelold_lcgcmake=`dirname $projsysold`
lcgrelold_lcgcmake=`dirname $lcgrelold_lcgcmake`
lcgrelold_lcgcmake=`dirname $lcgrelold_lcgcmake`
lcgrelold=`more $envxmlnew | grep variable=\"LCG_releases_base\" | tr "<" " " | tr ">" " " | awk '{print $3}'`
###echo lcgrelold_lcgcmake is $lcgrelold_lcgcmake
###echo lcgrelold is $lcgrelold
if [ "$lcgrelold" == "$lcgrelold_lcgcmake" ]; then # lcgcmake dir structure
lcgrelnew_lcgcmake=`dirname $projsysnew`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
lcgrelnew_lcgcmake=`dirname $lcgrelnew_lcgcmake`
###echo lcgrelnew_lcgcmake is $lcgrelnew_lcgcmake
export LCG_releases_base=$lcgrelnew_lcgcmake
pythonExecutable=`echo ${pythonExecutable} | sed "s|${lcgrelold_lcgcmake}|${lcgrelnew_lcgcmake}|"`
fi
fi
# Old workaround for CORALCOOL-2803 on cc7
# [This was wrong as it did not identify and fix the real issue!]
###export PYTHONHOME=`dirname ${pythonExecutable}`
###export PYTHONHOME=`dirname ${PYTHONHOME}`
# Add protections against pre-existing PYTHONHOME and PYTHONPATH
unset PYTHONHOME
unset PYTHONPATH
# Enter a bash shell (with minimal rc) in the correct runtime environment
# [Make sure the minimum PATH is defined in case this is run through 'env -i']
PATH=$PATH:/usr/local/bin:/bin:/usr/bin ${pythonExecutable} $topdir/env/xenv --xml=$envxmlnew bash --rcfile $topdir/env/.bashrc
$topdirl/cc-run bash --rcfile $topdirl/env/.bashrc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment