return 1
fi
- if ! parseConfig $@; then
+ if ! parseConfig "$@"; then
${0}
return 1
fi
done < <(grep -v "LD_LIBRARY_PATH" /tmp/gclient_env_${UID})
fi
- updateQA $@
+ updateQA "$@"
}
updateQA()
{
umask 0002
- parseConfig $@
+ parseConfig "$@"
#be paranoid and make some full paths
[[ ! -f ${inputList} ]] && echo "no input list: ${inputList}" && return 1
echo qaFile=$qaFile
echo highPtTree=$highPtTree
+ echo ocdbStorage=${ocdbStorage}
+ echo
#what if we have a zip archive?
if [[ "$qaFile" =~ .*.zip$ ]]; then
fi
local var="${opt%%=*}"
local value="${opt#*=}"
- echo "${var} = ${value}"
+ echo "${var}=${value}"
export ${var}="${value}"
done
}
dataType=""
local shortRunNumber=""
+ oldIFS=${IFS}
local IFS="/"
declare -a path=( $1 )
+ IFS="${oldIFS}"
local dirDepth=$(( ${#path[*]}-1 ))
i=0
for ((x=${dirDepth};x>=0;x--)); do
[[ -z ${legoTrainRunNumber} ]] && pass=${path[$((dirDepth-1))]}
[[ "${dataType}" =~ ^sim$ ]] && pass="passMC" && runNumber=${shortRunNumber}
+ #modify the OCDB: set the year
+ ocdbStorage=$(setYear ${year} ${ocdbStorage})
+
#if [[ -z ${dataType} || -z ${year} || -z ${period} || -z ${runNumber}} || -z ${pass} ]];
- if [[ -z ${runNumber}} ]];
+ if [[ -z ${runNumber}} ]]
then
#error condition
return 1
return 0 # success
}
-main $@
+setYear()
+{
+ #set the year
+ # ${1} - year to be set
+ # ${2} - where to set the year
+ local year1=$(guessYear ${1})
+ local year2=$(guessYear ${2})
+ local path=${2}
+ [[ ${year1} -ne ${year2} && -n ${year2} && -n ${year1} ]] && path=${2/\/${year2}\//\/${year1}\/}
+ echo ${path}
+ return 0
+}
+
+guessYear()
+{
+ #guess the year from the path, pick the rightmost one
+ local IFS="/"
+ declare -a pathArray=( ${1} )
+ local field
+ local year
+ for field in ${pathArray[@]}; do
+ [[ ${field} =~ ^20[0-9][0-9]$ ]] && year=${field}
+ done
+ echo ${year}
+ return 0
+}
+
+main "$@"