#!/usr/bin/env bash #------------------------------------------------------------------------------ # assumptions: # ------------ # 1. current directory is the top-most directory of the test release # 2. # # call : create_tarball.csh version[:patch] [optmode] # # "patch" is used only to label the tarball, no extra checkouts # # examples: # make_production_tarball -r 4.10.4:e . # make_production_tarball -r 5.1.0pre9 -q maxopt # # to create private (maxopt) version ProductionExe_5.3.1pasha_maxopt.tar.gz # # create_tarball.csh 5.3.1:pasha maxopt #------------------------------------------------------------------------------ release=99.1.1 patch= optmode=default REDEFINED_ENV_VARS= #----------------------------------------------------------------------- usage() { echo "usage: make_production_tarball -r release -p patch -o optmode " echo " tag = {version}{patch}" echo " version - version of the frozen release" echo " patch - version of the patch" echo "example: make_production_tarball -r 6.0.0int4 -p a -o maxopt" echo " will create tarball ProductionExe_6.0.0int4a_maxopt.tar.gz" exit } export OPTIND=1 while getopts :p:q:r:vx: OPT; do case $OPT in p) # offline version export patch=${OPTARG} if [ .$DEBUG_SCRIPT != "." ] ; then echo patch=$patch ; fi ;; q) # output node name optmode=${OPTARG} ;; r) # offline version export release=$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo release=$release ; fi ;; v) # debug script, # should go first export DEBUG_SCRIPT="yes" ;; x) # export export $OPTARG REDEFINED_ENV_VARS=${REDEFINED_ENV_VARS}" -x "$OPTARG if [ .$DEBUG_SCRIPT != "." ] ; then echo export $OPTARG fi ;; *) echo "**** wrong input parameter": $OPTARG usage exit -1 ;; esac done #----------------------------------------------------------------------- $HOME/scripts/ticket source ~cdfsoft/cdf2.shrc echo emoe! WORK_DIR=$PWD tag=$release$patch label=$tag if [ .$optmode != ".default" ] ; then label=${label}_${optmode} ; fi echo emoe-2 release=$release, optmode=$optmode, patch=$patch v=`cat .base_release` echo v=$v if [ $v != $release ] ; then echo inconsistent version of offline: $v != $version fi echo emoe -1 #----------------------------------------------------------------------- # the name of the tarball and the name of the executable will # diverge soon - prepare for that (today they are the same) #----------------------------------------------------------------------- echo "########################################" echo "Going to create tarball for "$tag" release" echo "########################################" echo "Setup cdfsoft2 " $release optimization = $optmode setup cdfsoft2 $release srt_setup -a SRT_QUAL=$optmode export PRODUCTION_EXE=bin/${BFARCH}/ProductionExe export CONCATENATION_EXE=bin/${BFARCH}/AC++Dump tarball=$WORK_DIR/ProductionExe_$label.tar #----------------------------------------------------------------------- production_exe=bin/${BFARCH}/ProductionExe concatenation_exe=bin/${BFARCH}/AC++Dump if [ ! -e $production_exe ] ; then make Production._prod rc=$? if [ $rc != 0 ] ; then echo "$production_exe did not compile. Aborting." exit fi fi echo $production_exe : OK if [ ! -f $concatenation_exe ] ; then if [ ! -d FrameMods ] ; then addpkg FrameMods ; fi make FrameMods.bin if [ $? != 0 ] ; then echo "$concatenation_exe did not compile. Aborting." exit fi fi echo $concatenation_exe : OK #------------------------------------------------------------------------------ # start building the tarball #------------------------------------------------------------------------------ echo .... checkpoint 1 if [ $production_exe != $PRODUCTION_EXE ] ; then cp $production_exe $PRODUCTION_EXE cp $concatenation_exe $CONCATENATION_EXE fi cp ${CDFSOFT2_DIR}/bin/${BFARCH}/DFCFarmTool ${WORK_DIR}/bin/${BFARCH}/ cp ${CDFSOFT2_DIR}/bin/${BFARCH}/DFCFileTool ${WORK_DIR}/bin/${BFARCH}/ cp ${CDFSOFT2_DIR}/bin/${BFARCH}/Edm_DescribeFile ${WORK_DIR}/bin/${BFARCH}/ #----------------------------------------------------------------------- # start building the tarball #----------------------------------------------------------------------- echo .... checkpoint 2 cd $WORK_DIR tar -chf $tarball $PRODUCTION_EXE $CONCATENATION_EXE .base_release GNUmakefile tar -rhf $tarball Production/*.tcl Production/strip_event.csh cdfopr tar -rhf $tarball Production/farm_concatenation.csh tar -rhf $tarball bin/${BFARCH}/DFCFarmTool tar -rhf $tarball bin/${BFARCH}/DFCFileTool tar -rhf $tarball bin/${BFARCH}/Edm_DescribeFile tar -rhf $tarball TclUtils/scripts/*.tcl # set symlinks for the libraries ln -s /usr/lib/libreadline.so.4 lib/libreadline.so.3 ln -s /usr/lib/libhistory.so.4 lib/libhistory.so.3 ln -s /usr/lib/libncurses.so.5 lib/libncurses.so.4 echo .... checkpoint 3 tar -rf $tarball lib/libreadline.so.3 lib/libhistory.so.3 lib/libncurses.so.4 rm lib/libreadline.so.3 lib/libhistory.so.3 lib/libncurses.so.4 #------------------------------------------------------------------------------ # do it only for KCC #------------------------------------------------------------------------------ if [ ."`echo $BFARCH | grep KCC`" != "." ] ; then echo tarring up KAI libraries from ${KCC_BASE}/lib cd $KCC_BASE ; tar -hrf $tarball lib/libKCC.so fi echo tarring up Oracle libraries from ${ORACLE_HOME}/lib oracle_version=`echo $SETUP_ORACLE_CLIENT | awk '{ print $2 }' | cut -d "_" -f1 ` if [ $oracle_version == "v9" ] ; then cd $ORACLE_HOME ; tar -hrf $tarball lib/libclntsh.so.9.0 lib/libwtc9.so fi if [ $oracle_version == "v8" ] ; then cd $ORACLE_HOME ; tar -hrf $tarball lib/libclntsh.so.8.0 lib/libwtc8.so fi echo tarring up ROOT libraries and include files from ${ROOTSYS} cd $ROOTSYS tar -rhf $tarball lib/libNew.so lib/libCore.so lib/libRint.so lib/libCint.so \ lib/libDCache.so lib/libGraf.so lib/libGraf3d.so lib/libHist.so \ lib/libHtml.so lib/libMatrix.so lib/libMinuit.so \ lib/libPostscript.so lib/libProof.so lib/libTree.so lib/libEG.so \ lib/libPhysics.so lib/libGpad.so lib/libGui.so lib/libGX11.so \ lib/libTreeViewer.so lib/libX3d.so \ cint/include/bool.h cint/MAKEINFO include/RQ_OBJECT.h #----------------------------------------------------------------------- # copy DCACHE libs #----------------------------------------------------------------------- echo tarring up DCACHE libs if [ ."`env | grep DISKCACHE_I_DIR`" != "." ] ; then cd $DISKCACHE_I_DIR ; tar -hrf $tarball lib/*.so fi if [ ."`env | grep DCAP_DIR`" != "." ] ; then cd $DCAP_DIR ; tar -hrf $tarball lib/libdcap.so ; fi #----------------------------------------------------------------------- # copy FRONTIER libs #----------------------------------------------------------------------- echo tarring up FRONTIER libs if [ ."`env | grep FRONTIER_CLIENT_DIR`" != "." ] ; then cd $FRONTIER_CLIENT_DIR ; tar -hrf $tarball lib/*.so* fi #----------------------------------------------------------------------- # copy .cafrc #----------------------------------------------------------------------- if [ -e $PWD/.cafrc ] ; then echo tarring up $PWD/.cafrc tar -hrf $tarball .cafrc elif [ -e $HOME/.cafrc ] ; then echo tarring up $HOME/.cafrc cd $HOME ; tar -hrf $tarball .cafrc fi #----------------------------------------------------------------------- # copy scattered database-type files into one directory #----------------------------------------------------------------------- build_dir=$WORK_DIR/tmp/scratch mkdir -p ${build_dir}/dbt mkdir -p ${build_dir}/CLHEP/HepPDT/data mkdir -p ${build_dir}/DBManager/farmsonly cp $CDFGEOM ${build_dir}/dbt/geom99.dab cp $TNS_ADMIN/tnsnames.ora ${build_dir}/dbt/tnsnames.ora cp $BFIELDM ${build_dir}/dbt/bfieldmap.dbt cp $HEPTBL ${build_dir}/dbt/heptabl.dbt cp $PARTICLEDB_DIR/src/partprop.dbt ${build_dir}/dbt/partprop.dbt cp $PROJECT_DIR/CLHEP/HepPDT/data/pdg_mass.tbl ${build_dir}/CLHEP/HepPDT/data/. #------------------------------------------------------------------------------ # iomap.txt: this file should be used for farms executables: #------------------------------------------------------------------------------ echo " creating iomap file specific for farms use " echo " ------------------------------------------ " cp $DBMANAGER_DIR/iomap_cdfofprd_direct.txt ${build_dir}/DBManager/farmsonly/ cd $build_dir tar -rhf $tarball * # echo " tarring up RCP database " echo " -------------------- " cd $BFDIST tar -rhf $tarball rcpdb #----------------------------------------------------------------------- # Creating source_file - the farm is using tcsh... #----------------------------------------------------------------------- cd $WORK_DIR echo 'setenv WORK_DIR $PWD' > source_me echo 'setenv PROJECT_DIR $PWD' >> source_me echo "setenv BFARCH $BFARCH" >> source_me echo "setenv SRT_BASE_RELEASE $SRT_BASE_RELEASE" >> source_me echo "setenv SRT_PRIVATE_CONTEXT $PWD" >> source_me echo "setenv PRODUCTION_EXE $PRODUCTION_EXE" >> source_me echo "setenv CONCATENATION_EXE $CONCATENATION_EXE" >> source_me echo "setenv EXEFILE $PRODUCTION_EXE" >> source_me echo 'setenv LD_LIBRARY_PATH $PWD/lib' >> source_me echo 'setenv LD_LIBRARY_PATH $PWD/lib' >> source_me echo 'setenv BFIELDM $PWD/dbt/bfieldmap.dbt' >> source_me echo 'setenv CDFGEOM $PWD/dbt/geom99.dab' >> source_me echo 'setenv ROOTSYS $PWD' >> source_me echo 'setenv TNS_ADMIN $PWD/dbt' >> source_me echo 'setenv RCP_SCRIPT_BASE $PWD/rcpdb' >> source_me echo 'setenv RCP_FILESYSTEMDB_READONLY_DIR $PWD/rcpdb' >> source_me echo 'setenv RCP_DB_NAMES_FILE $PWD/rcpdb/dbnames.txt' >> source_me echo 'setenv RCP_DATABASE_PATH level3/FileSystemDB:official/FileSystemDB/' >> source_me echo "setenv TCL_TAG $TCL_TAG" >> source_me echo 'setenv HEPTBL $PWD/dbt/heptabl.dbt' >> source_me echo 'setenv CDFPARP $PWD/dbt/partprop.dbt' >> source_me echo 'setenv IOMAP_FILE $PWD/DBManager/farmsonly/iomap_cdfofprd_direct.txt' >> source_me cat source_me tar -rf $tarball ./source_me #------------------------------------------------------------------------------ # quick test that ProductionExe runs at all #------------------------------------------------------------------------------ echo "# Running an essentiality test" cdfopr/scripts/test_production_tarball $tarball $WORK_DIR $PRODUCTION_EXE rc=$? echo rc = $rc cd $WORK_DIR if [ $rc == 0 ] ; then #------------------------------------------------------------------------------ # ProductionExe runs, gzip and rename the tarball #------------------------------------------------------------------------------ echo "# everything is OK, gzipping the tarball" gzip $tarball # mv $tarball.gz `basename $tarball .tar.gz`.tgz fi #------------------------------------------------------------------------------ # now the current directory is again the topmost dir of the test release #------------------------------------------------------------------------------ if [ $rc != 0 ] ; then exit $rc ; fi