#!/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_ac++dump_tarball -r 4.10.4:e . # make_ac++dump_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_ac++dump_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_ac++dump_tarball -r 6.0.0int4 -p a -o maxopt" echo " will create tarball AC++Dump_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_ac++dump tag=$release$patch . $WORK_DIR/cdfopr/scripts/common_procedures #---------------------------------------------------------------------- $HOME/scripts/ticket source ~cdfsoft/cdf2.shrc setup cdfsoft2 $release echo ... settting up tcl v8_3_1a setup tcl v8_3_1a srt_setup -a SRT_QUAL=$optmode echo [make_ac++dump_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 CONCATENATION_EXE=$WORK_DIR/bin/$BFARCH/AC++Dump tarball=$WORK_DIR/AC++Dump_$label.tar #----------------------------------------------------------------------- concatenation_exe=$WORK_DIR/bin/$BFARCH/AC++Dump 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/Production mkdir -p $BUILD_DIR/TclUtils/scripts mkdir -p $BUILD_DIR/dbt mkdir -p $BUILD_DIR/DBManager/farmsonly cd $BUILD_DIR/bin/$BFARCH ln -s $concatenation_exe 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/scripts $BUILD_DIR/TclUtils/scripts #----------------------------------------------------------------------- # 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/. cp $WORK_DIR/Production/farm_concatenation.csh $BUILD_DIR/Production; cp $TNS_ADMIN/tnsnames.ora $BUILD_DIR/dbt/tnsnames.ora cp $BFIELDM $BUILD_DIR/dbt/bfieldmap.dbt 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 AC++Dump 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 SAM stuff, CafSubmit, error checking binary #----------------------------------------------------------------------- # get_CafSubmit #----------------------------------------------------------------------- setup ecrc v3_1 echo tarring up ecrc: $SETUP_ECRC cp $ECRC_DIR/ecrc $BUILD_DIR/bin/$BFARCH #----------------------------------------------------------------------- # 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_ac++dump_source_me $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" create_tarball $BUILD_DIR $tarball #------------------------------------------------------------------------------ # we are in $BUILD_DIR, quick test that ProductionExe runs at all #------------------------------------------------------------------------------ echo "# Running an essentiality test" export EXEFILE=$CONCATENATION_EXE ./cdfopr/scripts/test_ac++dump_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