6 # designed to work on Jenkins
8 echo "protoduneana version: $VERSION"
9 echo "base qualifiers: $QUAL"
10 echo "build type: $BUILDTYPE"
11 echo "workspace: $WORKSPACE"
13 # Don't do ifdh build on macos.
15 #if uname | grep -q Darwin; then
16 # if ! echo $QUAL | grep -q noifdh; then
17 # echo "Ifdh build requested on macos. Quitting."
22 # Get number of cores to use.
24 if [ `uname` = Darwin ]; then
25 #ncores=`sysctl -n hw.ncpu`
26 #ncores=$(( $ncores / 4 ))
29 ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
31 if [ $ncores -lt 1 ]; then
34 echo "Building using $ncores cores."
36 # use /grid/fermiapp for macOS builds and cvmfs for Linux
38 echo "ls /cvmfs/dune.opensciencegrid.org/products/dune/"
39 ls /cvmfs/dune.opensciencegrid.org/products/dune/
42 if [ `uname` = Darwin -a -f /grid/fermiapp/products/dune/setup_dune_fermiapp.sh ]; then
43 source /grid/fermiapp/products/dune/setup_dune_fermiapp.sh || exit 1
44 elif [ -f /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh ]; then
45 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
46 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/dune.opensciencegrid.org/products
48 source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh || exit 1
50 echo "No setup file found."
54 # Use git out of ups except use the system git on macos
56 if ! uname | grep -q Darwin; then
60 # skip around a version of mrb that does not work on macOS
62 if [ `uname` = Darwin ]; then
63 if [[ x`which mrb | grep v1_17_02` != x ]]; then
65 setup mrb v1_16_02 || exit 1
69 setup gitflow || exit 1
70 export MRB_PROJECT=dune
74 rm -rf $WORKSPACE/temp || exit 1
75 mkdir -p $WORKSPACE/temp || exit 1
76 mkdir -p $WORKSPACE/copyBack || exit 1
77 rm -f $WORKSPACE/copyBack/* || exit 1
78 cd $WORKSPACE/temp || exit 1
79 mrb newDev -v $VERSION -q $QUAL:$BUILDTYPE || exit 1
80 source localProducts*/setup || exit 1
82 if [ `uname` = Darwin ]; then
83 setup getopt v1_1_6 || exit 1
86 cd $MRB_SOURCE || exit 1
89 until [ $ntries -ge $maxtries ]
92 mrb g -r -t $VERSION protoduneana && break
96 if [ $ntries = $maxtries ]; then
97 echo "Could not clone protoduneana using mrb g. Quitting."
102 cd $MRB_BUILDDIR || exit 1
104 mrb b -j$ncores || exit 1
105 mrb mp -n protoduneana -- -j$ncores || exit 1
107 # add dune_pardata to the manifest
109 manifest=protoduneana-*_MANIFEST.txt
115 PLATFORM=$(uname -r | grep -o "el[0-9]"|sed s'/el/slf/')
118 PLATFORM=$(uname -r | awk -F. '{print "d"$1}')
122 cd $MRB_SOURCE || exit 1
127 if uname | grep -q Darwin; then
133 # find our set qualifier from artdaq_core's qualifier
135 SQUAL=`ups active | grep artdaq_core | tr : '\n' | grep ^s | awk '{print $1}'`
136 echo "Set qualifier from artdaq_core: $SQUAL"
140 echo "Moving tarballs to copyBack"
142 cd $MRB_BUILDDIR || exit 1
144 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
146 echo "Moving manifest to copyBack"
148 manifest=protoduneana-*_MANIFEST.txt
149 if [ -f $manifest ]; then
150 mv $manifest $WORKSPACE/copyBack/ || exit 1
152 ls -l $WORKSPACE/copyBack/
153 cd $WORKSPACE || exit 1
154 rm -rf $WORKSPACE/temp || exit 1