#!/usr/bin/env bash #------------------------------------------------------------------------------ # assumptions: # ------------ # 1. current directory is the top-most directory of the test release # 2. # # "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 -o maxopt # # to create private (maxopt) version ProductionExe_5.3.1pasha_maxopt.tar.gz # # create_tarball.csh 5.3.1:pasha maxopt # # missing part (may be): setup fcp #------------------------------------------------------------------------------ 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 :o:p:r:vx: OPT; do case $OPT in p) # offline version export patch=${OPTARG} if [ .$DEBUG_SCRIPT != "." ] ; then echo patch=$patch ; fi ;; o) # 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 #----------------------------------------------------------------------- WORK_DIR=$PWD BUILD_DIR=$WORK_DIR/build_production tag=$release$patch . $WORK_DIR/cdfopr/scripts/common_procedures #---------------------------------------------------------------------- $HOME/scripts/ticket source ~cdfsoft/cdf2.shrc setup cdfsoft2 $release srt_setup -a SRT_QUAL=$optmode echo [make_production_tarball]: BFARCH=$BFARCH #----------------------------------------------------------------------- label=$tag if [ .$optmode != ".default" ] ; then label=${label}_${optmode} ; fi v=`cat .base_release` if [ $v != $release ] ; then echo inconsistent version of offline: $v != $version fi #----------------------------------------------------------------------- echo "########################################" echo "Going to create tarball for "$tag" release patch "$patch echo "########################################" echo "Setup cdfsoft2 " $release optimization = $optmode export PRODUCTION_EXE=$WORK_DIR/bin/$BFARCH/ProductionExe # export CONCATENATION_EXE=$WORK_DIR/bin/$BFARCH/AC++Dump tarball=$WORK_DIR/ProductionExe_$label.tar #----------------------------------------------------------------------- production_exe=$WORK_DIR/bin/$BFARCH/ProductionExe # concatenation_exe=$WORK_DIR/bin/$BFARCH/AC++Dump if [ ! -e $production_exe ] ; then make Production._prod if [ $? != 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 #------------------------------------------------------------------------------ # create $BUILD_DIR, subdirectories in there and start copying files #------------------------------------------------------------------------------ echo .... checkpoint 1: creating subdirectories if [ -d $BUILD_DIR ] ; then rm -rf $BUILD_DIR ; fi mkdir -p $BUILD_DIR/bin/$BFARCH mkdir -p $BUILD_DIR/shlib/$BFARCH mkdir -p $BUILD_DIR/cint/include mkdir -p $BUILD_DIR/include mkdir -p $BUILD_DIR/dbt mkdir -p $BUILD_DIR/CLHEP/HepPDT/data mkdir -p $BUILD_DIR/DBManager/farmsonly cd $BUILD_DIR/bin/$BFARCH ln -s $production_exe ln -s $concatenation_exe ln -s $WORK_DIR/bin/$BFARCH/cdfopr ln -s $WORK_DIR/bin/$BFARCH/cdfprd ln -s $CDFSOFT2_DIR/bin/$BFARCH/DFCFarmTool ln -s $CDFSOFT2_DIR/bin/$BFARCH/DFCFileTool ln -s $CDFSOFT2_DIR/bin/$BFARCH/Edm_DescribeFile ln -s $CDFSOFT2_DIR/bin/$BFARCH/getFileInfo ln -s $DCAP_DIR/bin/dccp ln -s $WORK_DIR/cdfopr/scripts/DFCQuery ln -s $WORK_DIR/cdfopr $BUILD_DIR/cdfopr ln -s $WORK_DIR/cdfprd $BUILD_DIR/cdfprd ln -s $WORK_DIR/TclUtils $BUILD_DIR/TclUtils ln -s $WORK_DIR/Production $BUILD_DIR/Production #----------------------------------------------------------------------- # copy some basic files and SAM scripts #----------------------------------------------------------------------- cp $WORK_DIR/.base_release $BUILD_DIR/. cp $WORK_DIR/GNUmakefile $BUILD_DIR/. cp $WORK_DIR/cdfopr/farm/SamPostRun $BUILD_DIR/. cp $WORK_DIR/cdfopr/farm/SamPreRun $BUILD_DIR/. echo tarring up $CDFGEOM 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/. cp $DBMANAGER_DIR/iomap_cdfofprd_direct.txt $BUILD_DIR/DBManager/farmsonly/ #----------------------------------------------------------------------- # binaries for which shared libs also need to be available #----------------------------------------------------------------------- exec_list="" # for exe in ProductionExe AC++Dump DFCFarmTool DFCFileTool \ for exe in ProductionExe DFCFarmTool DFCFileTool \ Edm_DescribeFile sqlplus getFileInfo dccp ; do exec_list=$exec_list" "$BUILD_DIR/bin/$BFARCH/$exe done echo ... \$exec_list=$exec_list #----------------------------------------------------------------------- # Oracle, diskcache_i, dcap, fcp, root includes # some of DCACHE and DCAP libs are loaded at run-time, # not at startup, so they do not appear in ldd listing #----------------------------------------------------------------------- get_oracle get_fcp get_diskcache_and_dcap_libs get_root_include_files #----------------------------------------------------------------------- # get all other shared libraries #----------------------------------------------------------------------- cd $BUILD_DIR get_shared_libs $exec_list #----------------------------------------------------------------------- # copy Python, $PYTHON_DIR will be $PWD/python # on SL3 setup cdfsoft2 doesn't setup python, do it by hands to ensure # use of known version of Python # copy SAM stuff, CafSubmit, error checking binary # use SAM v6 explicitly... for production 6.1.0 #----------------------------------------------------------------------- get_python get_sam get_CafSubmit #----------------------------------------------------------------------- # copy perl #----------------------------------------------------------------------- get_perl #----------------------------------------------------------------------- setup ecrc v3_1 echo tarring up ecrc: $SETUP_ECRC cp $ECRC_DIR/ecrc $BUILD_DIR/bin/$BFARCH #----------------------------------------------------------------------- # RCP database: Production Farm needs full copy, so $1=1 #----------------------------------------------------------------------- get_rcpdb 1 #----------------------------------------------------------------------- # Creating source_me and source_me_bash - both needed on the farm # want all the paths and directory names to be short - start from "./" # assume execution on the Farm happens in ./ (what BUILD_DIR is) - this # is an important assumption ! #------------------------------------------------------------------------------ . $WORK_DIR/cdfopr/scripts/create_production_source_me_bash $BUILD_DIR/source_me #------------------------------------------------------------------------------ # finally make list of directories to be deleted in the end of the job and # pack contents of build_dir #---------------------------------------------------------------------- cd $BUILD_DIR $WORK_DIR/cdfopr/farm/do_remove_list.csh export DOT_FILES=".base_release .cafrc" create_tarball $BUILD_DIR $tarball #------------------------------------------------------------------------------ # we are in $BUILD_DIR, quick test that ProductionExe runs at all #------------------------------------------------------------------------------ echo "# Running an essentiality test" ./cdfopr/scripts/test_production_tarball $tarball 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 fi #------------------------------------------------------------------------------ # now the current directory is again the topmost dir of the test release #------------------------------------------------------------------------------ if [ $rc != 0 ] ; then exit $rc ; fi