buildDUNEutil.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # build dunecode
4 # use mrb
5 # designed to work on Jenkins
6 # this is a proof of concept script
7 
8 echo "duneutil version: $DUNEUTILVER"
9 echo "base qualifiers: $QUAL"
10 echo "build type: $BUILDTYPE"
11 echo "workspace: $WORKSPACE"
12 
13 echo "----------------------------"
14 echo "ls /grid/fermiapp/products/dune"
15 ls /grid/fermiapp/products/dune
16 echo "----------------------------"
17 echo "ls /cvmfs/dune.opensciencegrid.org/products/dune"
18 ls /cvmfs/dune.opensciencegrid.org/products/dune
19 echo "----------------------------"
20 
21 
22 # Don't do ifdh build on macos.
23 
24 #if uname | grep -q Darwin; then
25 # if ! echo $QUAL | grep -q noifdh; then
26 # echo "Ifdh build requested on macos. Quitting."
27 # exit
28 # fi
29 #fi
30 
31 # Get number of cores to use.
32 
33 if [ `uname` = Darwin ]; then
34  #ncores=`sysctl -n hw.ncpu`
35  #ncores=$(( $ncores / 4 ))
36  ncores=1
37 else
38  ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
39 fi
40 if [ $ncores -lt 1 ]; then
41  ncores=1
42 fi
43 echo "Building using $ncores cores."
44 
45 if [ `uname` = Darwin -a -f /grid/fermiapp/products/dune/setup_dune_fermiapp.sh ]; then
46  source /grid/fermiapp/products/dune/setup_dune_fermiapp.sh || exit 1
47 elif [ -f /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh ]; then
48  if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
49  /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/dune.opensciencegrid.org/products
50  fi
51  source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh || exit 1
52 else
53  echo "No setup file found."
54  exit 1
55 fi
56 
57 # Use system git on macos.
58 
59 if ! uname | grep -q Darwin; then
60  setup git || exit 1
61 fi
62 
63 # skip around a version of mrb that does not work on macOS
64 
65 if [ `uname` = Darwin ]; then
66  if [[ x`which mrb | grep v1_17_02` != x ]]; then
67  unsetup mrb || exit 1
68  setup mrb v1_16_02 || exit 1
69  fi
70 fi
71 
72 setup gitflow || exit 1
73 export MRB_PROJECT=dune
74 echo "Mrb path:"
75 which mrb
76 
77 set -x
78 rm -rf $WORKSPACE/temp || exit 1
79 mkdir -p $WORKSPACE/temp || exit 1
80 mkdir -p $WORKSPACE/copyBack || exit 1
81 rm -f $WORKSPACE/copyBack/* || exit 1
82 cd $WORKSPACE/temp || exit 1
83 mrb newDev -v $DUNEUTILVER -q $QUAL:$BUILDTYPE || exit 1
84 set +x
85 
86 source localProducts*/setup || exit 1
87 
88 # some shenanigans so we can use getopt v1_1_6
89 if [ `uname` = Darwin ]; then
90 # cd $MRB_INSTALL
91 # 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 || \
92 # { cat 1>&2 <<EOF
93 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
94 #EOF
95 # exit 1
96 # }
97 # tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
98  setup getopt v1_1_6 || exit 1
99 # which getopt
100 fi
101 
102 set -x
103 cd $MRB_SOURCE || exit 1
104 # make sure we get a read-only copy
105 mrb g -r -t $DUNEUTILVER duneutil || exit 1
106 cd $MRB_BUILDDIR || exit 1
107 mrbsetenv || exit 1
108 mrb b -j$ncores || exit 1
109 mrb mp -j$ncores || exit 1
110 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
111 ls -l $WORKSPACE/copyBack/
112 cd $WORKSPACE || exit 1
113 rm -rf $WORKSPACE/temp || exit 1
114 set +x
115 
116 exit 0