buildArgoNeuT.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # build argoneutcode
4 # use mrb
5 # designed to work on Jenkins
6 # this is a proof of concept script
7 df
8 ls /cvmfs/argoneut.opensciencegrid.org
9 
10 echo "argoneutcode version: $ARGONEUTVER"
11 echo "base qualifiers: $QUAL"
12 echo "build type: $BUILDTYPE"
13 echo "workspace: $WORKSPACE"
14 
15 if [ `uname` = Darwin ]; then
16  #ncores=`sysctl -n hw.ncpu`
17  #ncores=$(( $ncores / 4 ))
18  ncores=4
19 else
20  ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
21 fi
22 if [ $ncores -lt 1 ]; then
23  ncores=1
24 fi
25 echo "Building using $ncores cores."
26 
27 #source /grid/fermiapp/products/argoneut/setup_argoneut_fermiapp.sh || exit 1
28 #source /grid/fermiapp/products/argoneut/setup_argoneut.sh || exit 1
29 
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
34 else
35  echo "No setup file found."
36  exit 1
37 fi
38 
39 
40 # skip around a version of mrb that does not work on macOS
41 
42 if [ `uname` = Darwin ]; then
43  if [[ x`which mrb | grep v1_17_02` != x ]]; then
44  unsetup mrb || exit 1
45  setup mrb v1_16_02 || exit 1
46  fi
47 fi
48 
49 
50 if ! uname | grep -q Darwin; then
51  setup git || exit 1
52 fi
53 setup gitflow || exit 1
54 export MRB_PROJECT=argoneut
55 echo "Mrb path:"
56 which mrb
57 
58 #set -x
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
65 #set +x
66 
67 source localProducts*/setup || exit 1
68 
69 # some shenanigans so we can use getopt v1_1_6
70 if [ `uname` = Darwin ]; then
71 # cd $MRB_INSTALL
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 || \
73 # { cat 1>&2 <<EOF
74 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
75 #EOF
76 # exit 1
77 # }
78 # tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
79  setup getopt v1_1_6 || exit 1
80 # which getopt
81 fi
82 
83 #set -x
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
88 mrbsetenv || 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
95 set +x
96 
97 exit 0