#!/usr/bin/env bash #------------------------------------------------------------------------------ # call: make_tarball [-v debug_mode] -j job [-r release] [-o opt_level] \ # [-p patch] [-f flavor] # # build tarballs for the jobs: # # Production cdfSim stnfit trigsim stnmaker stnmaker_prod runMC # # example: # make_tarball -j stnmaker -r 5.1.0pre10 # make_tarball -j MCProd -r v5_3_3_v2 # make_tarball -j Production -r 6.1.0pre2 -o maxopt # # if CDF_TARBALL_DIR variable is defined, tarball is moved to there # -f : non-default flavor: KCC_4_0 , for example #----------------------------------------------------------------------- export WORK_DIR=$PWD export JOB= export RELEASE= export DEBUG_SCRIPT=none export RELEASE=`cat ./.base_release` export OPTMODE=default export FLAVOR= cmd="echo ... do nothing" #----------------------------------------------------------------------- export OPTIND=1 while getopts :f:j:o:p:r:v: OPT; do case $OPT in f) # version export FLAVOR=$OPTARG if [ $DEBUG_SCRIPT != "none" ] ; then echo FLAVOR=$FLAVOR ; fi ;; j) # version export JOB=$OPTARG if [ $DEBUG_SCRIPT != "none" ] ; then echo JOB=$OPTARG ; fi ;; o) # VERSION export OPTMODE=$OPTARG if [ $DEBUG_SCRIPT != "none" ] ; then echo OPTMODE=$OPTMODE ; fi ;; p) # patch export PATCH=$OPTARG if [ $DEBUG_SCRIPT != "none" ] ; then echo PATCH=$PATCH ; fi ;; r) # VERSION export RELEASE=$OPTARG if [ $DEBUG_SCRIPT != "none" ] ; then echo RELEASE=$OPTARG ; fi ;; v) # debug script, # should go first export DEBUG_SCRIPT=$OPTARG ;; *) echo OTHER: $OPT $OPTARG usage echo **** bailing out **** ; exit -1 ;; esac done #------------------------------------------------------------------------------ label=$RELEASE if [ .$PATCH != "." ] ; then label=${RELEASE}_$PATCH ; cmd=$cmd" -p $PATCH" ; fi if [ $OPTMODE != "default" ] ; then label=${label}_${OPTMODE} cmd=$cmd" -q $OPTMODE" ; fi source ~cdfsoft/cdf2.shrc setup cdfsoft2 $RELEASE srt_setup -a SRT_QUAL=$OPTMODE case $JOB in Production ) cmd="$WORK_DIR/cdfopr/scripts/make_production_tarball -r $RELEASE" tarball=ProductionExe_$label.tar.gz ;; cdfSim ) tarball=cdfSim.tgz files="bin/$BFARCH/run_cdfSim.sh cdfopr jobs \ bin/$BFARCH/cdfSim lib \ ./GNUmakefile ./.base_release ./.cafrc" cmd="tar -zhcf $tarball $files" ;; MCProd ) #----------------------------------------------------------------------- # create Reda's $tarball (not zipped !), add few more things and gzip it # remember that that gzip changes the file name #----------------------------------------------------------------------- tarball=$PWD/MCProd_$label.tar mcProduction/scripts/build_tarball -t $tarball -z no # files="./GNUmakefile ./.base_release ./.cafrc cdfopr" tar -rhf $tarball $files gzip $tarball tarball=$PWD/MCProd_$label.tar.gz rc=$? ;; root ) tarball=root_$label.tgz files="cdfopr \ shlib \ .base_release .cafrc .rootrc rootlogon.C GNUmakefile \ Stntuple Electroweak" cmd="tar -zhcf $tarball $files" ;; stnfit ) tarball=stnfit_$label.tgz files="cdfopr \ bin/$BFARCH/stnfit.exe shlib \ .base_release .cafrc .rootrc rootlogon.C GNUmakefile \ murat/ana/scripts \ Stntuple/scripts Stntuple/ana Stntuple/db Electroweak" cmd="tar -zhcf $tarball $files" ;; stnmaker ) tarball=stnmaker_$label.tgz files="bin/$BFARCH/stnmaker.exe \ cdfopr TclUtils \ Stntuple/test/stnmaker \ Stntuple/scripts \ ./GNUmakefile ./.base_release .cafrc" cmd="tar -zhcf $tarball $files" ;; stnmaker_prod ) tarball=stnmaker_prod_$label.tgz files="bin/$BFARCH/stnmaker_prod.exe \ Stntuple/test/prod \ Stntuple/scripts \ cdfopr TclUtils \ ./GNUmakefile ./.base_release .cafrc" cmd="tar -zhcf $tarball $files" ;; test_caf ) tarball=test_caf.tgz files=" cdfopr .cafrc" cmd="tar -zhcf $tarball $files" ;; * ) echo job=$OPTARG is not known ;; esac if [ $DEBUG_SCRIPT != "none" ] ; then echo $cmd ; fi if [ $DEBUG_SCRIPT != "debug_only" ] ; then $cmd ; rc=$? ; echo tarball $tarball created with code=$rc ls -l $tarball if [[ $rc == 0 && .$CDF_TARBALL_DIR != "." ]] ; then echo moving $tarball to $CDF_TARBALL_DIR mv $tarball $CDF_TARBALL_DIR/. fi fi echo ...all done... #-----------------------------------------------------------------------