5 # designed to work on Jenkins
     6 # this is a proof of concept script
     8 ls /cvmfs/argoneut.opensciencegrid.org
    10 echo "argoneutcode version: $ARGONEUTVER"
    11 echo "base qualifiers: $QUAL"
    12 echo "build type: $BUILDTYPE"
    13 echo "workspace: $WORKSPACE"
    15 if [ `uname` = Darwin ]; then
    16   #ncores=`sysctl -n hw.ncpu`
    17   #ncores=$(( $ncores / 4 ))
    20   ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
    22 if [ $ncores -lt 1 ]; then
    25 echo "Building using $ncores cores."
    27 #source /grid/fermiapp/products/argoneut/setup_argoneut_fermiapp.sh || exit 1
    28 #source /grid/fermiapp/products/argoneut/setup_argoneut.sh || exit 1
    30 if [ `uname` = Darwin -a -f /grid/fermiapp/products/argoneut/setup_argoneut_fermiapp.sh ]; then
    31   source /grid/fermiapp/products/argoneut/setup_argoneut_fermiapp.sh || exit 1
    32 elif [ -f /cvmfs/argoneut.opensciencegrid.org/products/argoneut/setup_argoneut.sh ]; then
    33   source /cvmfs/argoneut.opensciencegrid.org/products/argoneut/setup_argoneut.sh || exit 1
    35   echo "No setup file found."
    40 # skip around a version of mrb that does not work on macOS
    42 if [ `uname` = Darwin ]; then
    43   if [[ x`which mrb | grep v1_17_02` != x ]]; then
    45     setup mrb v1_16_02 || exit 1
    50 if ! uname | grep -q Darwin; then
    53 setup gitflow || exit 1
    54 export MRB_PROJECT=argoneut
    59 rm -rf $WORKSPACE/temp || exit 1
    60 mkdir -p $WORKSPACE/temp || exit 1
    61 mkdir -p $WORKSPACE/copyBack || exit 1
    62 rm -f $WORKSPACE/copyBack/* || exit 1
    63 cd $WORKSPACE/temp || exit 1
    64 mrb newDev  -v $ARGONEUTVER -q $QUAL:$BUILDTYPE || exit 1
    67 source localProducts*/setup || exit 1
    69 # some shenanigans so we can use getopt v1_1_6
    70 if [ `uname` = Darwin ]; then
    72 #  curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 || \
    74 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
    78 #  tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
    79   setup getopt v1_1_6  || exit 1
    84 cd $MRB_SOURCE  || exit 1
    85 # make sure we get a read-only copy
    86 mrb g -r -t $ARGONEUTVER argoneutcode || exit 1
    87 cd $MRB_BUILDDIR || exit 1
    89 mrb b -j$ncores || exit 1
    90 mrb mp -j$ncores || exit 1
    91 mv *.bz2  $WORKSPACE/copyBack/ || exit 1
    92 ls -l $WORKSPACE/copyBack/
    93 cd $WORKSPACE || exit 1
    94 rm -rf $WORKSPACE/temp || exit 1