6 # designed to work on Jenkins
8 echo "protoduneana version: $VERSION"
9 echo "base qualifiers: $QUAL"
10 QUAL=`echo ${QUAL} | sed -e "s/-/:/g"`
11 echo "modified base qualifiers: $QUAL"
12 echo "build type: $BUILDTYPE"
13 echo "workspace: $WORKSPACE"
15 # Don't do ifdh build on macos.
17 #if uname | grep -q Darwin; then
18 # if ! echo $QUAL | grep -q noifdh; then
19 # echo "Ifdh build requested on macos. Quitting."
24 # Get number of cores to use.
26 if [ `uname` = Darwin ]; then
27 #ncores=`sysctl -n hw.ncpu`
28 #ncores=$(( $ncores / 4 ))
31 ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
33 if [ $ncores -lt 1 ]; then
36 echo "Building using $ncores cores."
38 # use /grid/fermiapp for macOS builds and cvmfs for Linux
40 echo "ls /cvmfs/dune.opensciencegrid.org/products/dune/"
41 ls /cvmfs/dune.opensciencegrid.org/products/dune/
44 if [ `uname` = Darwin -a -f /grid/fermiapp/products/dune/setup_dune_fermiapp.sh ]; then
45 source /grid/fermiapp/products/dune/setup_dune_fermiapp.sh || exit 1
46 elif [ -f /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh ]; then
47 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
48 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/dune.opensciencegrid.org/products
50 source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh || exit 1
52 echo "No setup file found."
56 # Use git out of ups except use the system git on macos
58 if ! uname | grep -q Darwin; then
62 # skip around a version of mrb that does not work on macOS
64 if [ `uname` = Darwin ]; then
65 if [[ x`which mrb | grep v1_17_02` != x ]]; then
67 setup mrb v1_16_02 || exit 1
71 setup gitflow || exit 1
72 export MRB_PROJECT=dune
76 rm -rf $WORKSPACE/temp || exit 1
77 mkdir -p $WORKSPACE/temp || exit 1
78 mkdir -p $WORKSPACE/copyBack || exit 1
79 rm -f $WORKSPACE/copyBack/* || exit 1
80 cd $WORKSPACE/temp || exit 1
81 mrb newDev -v $VERSION -q $QUAL:$BUILDTYPE || exit 1
82 source localProducts*/setup || exit 1
84 if [ `uname` = Darwin ]; then
85 setup getopt v1_1_6 || exit 1
88 cd $MRB_SOURCE || exit 1
91 until [ $ntries -ge $maxtries ]
94 mrb g -r -t $VERSION --repo-type github -g DUNE protoduneana && break
98 if [ $ntries = $maxtries ]; then
99 echo "Could not clone protoduneana using mrb g. Quitting."
104 cd $MRB_BUILDDIR || exit 1
106 mrb b -j$ncores || exit 1
107 mrb mp -n protoduneana -- -j$ncores || exit 1
109 # add dune_pardata to the manifest
111 manifest=protoduneana-*_MANIFEST.txt
117 PLATFORM=$(uname -r | grep -o "el[0-9]"|sed s'/el/slf/')
120 PLATFORM=$(uname -r | awk -F. '{print "d"$1}')
124 cd $MRB_SOURCE || exit 1
129 if uname | grep -q Darwin; then
135 # find our set qualifier from artdaq_core's qualifier
137 SQUAL=`ups active | grep artdaq_core | tr : '\n' | grep ^s | awk '{print $1}'`
138 echo "Set qualifier from artdaq_core: $SQUAL"
142 echo "Moving tarballs to copyBack"
144 cd $MRB_BUILDDIR || exit 1
146 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
148 echo "Moving manifest to copyBack"
150 manifest=protoduneana-*_MANIFEST.txt
151 if [ -f $manifest ]; then
152 mv $manifest $WORKSPACE/copyBack/ || exit 1
154 ls -l $WORKSPACE/copyBack/
155 cd $WORKSPACE || exit 1
156 rm -rf $WORKSPACE/temp || exit 1