All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
buildLArIAT.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # build lariatsoft, lariatutil and lbne_raw_data
4 # use mrb
5 # designed to work on Jenkins
6 # this is a proof of concept script
7 
8 echo "lariatsoft version: $LARIAT"
9 echo "base qualifiers: $QUAL"
10 echo "larsoft qualifiers: $LARSOFT_QUAL"
11 echo "build type: $BUILDTYPE"
12 echo "workspace: $WORKSPACE"
13 
14 # Don't do ifdh build on macos.
15 
16 #if uname | grep -q Darwin; then
17 # if ! echo $QUAL | grep -q noifdh; then
18 # echo "Ifdh build requested on macos. Quitting."
19 # exit
20 # fi
21 #fi
22 
23 # Get number of cores to use.
24 
25 if [ `uname` = Darwin ]; then
26  #ncores=`sysctl -n hw.ncpu`
27  #ncores=$(( $ncores / 4 ))
28  ncores=4
29 else
30  ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
31 fi
32 if [ $ncores -lt 1 ]; then
33  ncores=1
34 fi
35 echo "Building using $ncores cores."
36 
37 # Environment setup, uses /grid/fermiapp or cvmfs.
38 
39 #echo "ls /cvmfs/lariat.opensciencegrid.org/products/lariat/"
40 #ls /cvmfs/lariat.opensciencegrid.org/products/lariat/
41 #echo
42 
43 if [ -f /grid/fermiapp/lariat/setup_lariat.sh ]; then
44  source /grid/fermiapp/lariat/setup_lariat.sh || exit 1
45 else
46  echo "No setup file found."
47  exit 1
48 fi
49 # skip around a version of mrb that does not work on macOS
50 
51 if [ `uname` = Darwin ]; then
52  if [[ x`which mrb | grep v1_17_02` != x ]]; then
53  unsetup mrb || exit 1
54  setup mrb v1_16_02 || exit 1
55  fi
56 fi
57 
58 # Use system git on macos.
59 
60 if ! uname | grep -q Darwin; then
61  setup git || exit 1
62 fi
63 setup gitflow || exit 1
64 export MRB_PROJECT=lariat
65 echo "Mrb path:"
66 which mrb
67 
68 set -x
69 rm -rf $WORKSPACE/temp || exit 1
70 mkdir -p $WORKSPACE/temp || exit 1
71 mkdir -p $WORKSPACE/copyBack || exit 1
72 rm -f $WORKSPACE/copyBack/* || exit 1
73 cd $WORKSPACE/temp || exit 1
74 mrb newDev -v $LARIAT -q $QUAL:$BUILDTYPE || exit 1
75 
76 set +x
77 source localProducts*/setup || exit 1
78 
79 # some shenanigans so we can use getopt v1_1_6
80 if [ `uname` = Darwin ]; then
81 # cd $MRB_INSTALL
82 # 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 || \
83 # { cat 1>&2 <<EOF
84 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
85 #EOF
86 # exit 1
87 # }
88 # tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
89  setup getopt v1_1_6 || exit 1
90 # which getopt
91 fi
92 
93 set -x
94 cd $MRB_SOURCE || exit 1
95 # make sure we get a read-only copy
96 mrb g -r -t $LARIAT lariatsoft || exit 1
97 
98 # Extract lariatutil version from lariatsoft product_deps
99 lariatutil_version=`grep lariatutil $MRB_SOURCE/lariatsoft/ups/product_deps | grep -v qualifier | awk '{print $2}'`
100 echo "lariatuitil version: $lariatutil_version"
101 mrb g -d lariatutil -t $lariatutil_version http://cdcvs.fnal.gov/projects/lardbt-lariatutil/ || exit 1
102 
103 # Extract lariatfragments version from lariatsoft product_deps
104 lariatfragments_version=`grep lariatfragments $MRB_SOURCE/lariatsoft/ups/product_deps | grep -v qualifier | awk '{print $2}'`
105 echo "ubuitil version: $lariatfragments_version"
106 mrb g -d lariatfragments -t $lariatfragments_version http://cdcvs.fnal.gov/projects/lariat-online-lariatfragments/ || exit 1
107 
108 cd $MRB_BUILDDIR || exit 1
109 mrbsetenv || exit 1
110 mrb b -j$ncores || exit 1
111 mrb mp -n lariat -- -j$ncores || exit 1
112 
113 manifest=lariat-*_MANIFEST.txt
114 
115 if echo $QUAL | grep -q nobeam; then
116  echo $QUAL
117 else
118 # add LariatBeamFiles to the manifest
119 # currently does not exist on scisoft
120  LariatBeamFiles_version=`grep LariatBeamFiles $MRB_SOURCE/lariatsoft/ups/product_deps | grep -v qualifier | awk '{print $2}'`
121  LariatBeamFiles_dot_version=`echo ${LariatBeamFiles_version} | sed -e 's/_/./g' | sed -e 's/^v//'`
122 # echo "LariatBeamFiles ${LariatBeamFiles_version} LariatBeamFiles-${LariatBeamFiles_dot_version}-noarch.tar.bz2" >> $manifest
123 fi
124 
125 LariatFilters_version=`grep LariatFilters $MRB_SOURCE/lariatsoft/ups/product_deps | grep -v qualifier | awk '{print $2}'`
126 LariatFilters_dot_version=`echo ${LariatFilters_version} | sed -e 's/_/./g' | sed -e 's/^v//'`
127 echo "LariatFilters ${LariatFilters_version} LariatFilters-${LariatFilters_dot_version}-noarch.tar.gz" >> $manifest
128 
129 # Extract larsoft version from product_deps.
130 
131 larsoft_version=`grep larsoft $MRB_SOURCE/lariatsoft/ups/product_deps | grep -v qualifier | awk '{print $2}'`
132 larsoft_dot_version=`echo ${larsoft_version} | sed -e 's/_/./g' | sed -e 's/^v//'`
133 
134 # Extract flavor.
135 
136 flvr=''
137 if uname | grep -q Darwin; then
138  flvr=`ups flavor -2`
139 else
140  flvr=`ups flavor -4`
141 fi
142 
143 # Construct name of larsoft manifest.
144 
145 larsoft_hyphen_qual=`echo $LARSOFT_QUAL | tr : - | sed 's/-noifdh//'`
146 larsoft_manifest=larsoft-${larsoft_dot_version}-${flvr}-${larsoft_hyphen_qual}-${BUILDTYPE}_MANIFEST.txt
147 echo "Larsoft manifest:"
148 echo $larsoft_manifest
149 echo
150 
151 # Fetch laraoft manifest from scisoft and append to lariatsoft manifest.
152 
153 curl --fail --silent --location --insecure http://scisoft.fnal.gov/scisoft/bundles/larsoft/${larsoft_version}/manifest/${larsoft_manifest} >> $manifest || exit 1
154 
155 # Special handling of noifdh builds goes here.
156 
157 if echo $QUAL | grep -q noifdh; then
158 
159  if uname | grep -q Darwin; then
160 
161  # If this is a macos build, then rename the manifest to remove noifdh qualifier in the name
162 
163  noifdh_manifest=`echo $manifest | sed 's/-noifdh//'`
164  mv $manifest $noifdh_manifest
165 
166  else
167 
168  # Otherwise (for slf builds), delete the manifest entirely.
169 
170  rm -f $manifest
171 
172  fi
173 fi
174 
175 # Save artifacts.
176 
177 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
178 manifest=lariat-*_MANIFEST.txt
179 if [ -f $manifest ]; then
180  mv $manifest $WORKSPACE/copyBack/ || exit 1
181 fi
182 #cp $MRB_BUILDDIR/lariatsoft/releaseDB/*.html $WORKSPACE/copyBack/
183 ls -l $WORKSPACE/copyBack/
184 cd $WORKSPACE || exit 1
185 rm -rf $WORKSPACE/temp || exit 1
186 set +x
187 
188 exit 0
then source grid fermiapp products dune setup_dune_fermiapp sh exit else echo No setup file found exit fi setup
process_name opflash particleana ie x
then cvmfs grid cern ch util cvmfs uptodate cvmfs uboone opensciencegrid org products fi source cvmfs uboone opensciencegrid org products setup_uboone sh exit else echo No setup file found exit fi if!uname grep q Darwin
Definition: build_larcv.sh:51
then setup git exit fi setup gitflow exit export MRB_PROJECT
do source
pdgs p
Definition: selectors.fcl:22
BEGIN_PROLOG g
then flvr
Definition: buildSBND.sh:128
then noifdh_manifest
Definition: buildSBND.sh:148
then cp usr lib64 libXmu so sbncode lib fi mrb mp n sbn j $ncores exit manifest
Definition: buildSBN.sh:115
then ncores
Definition: build_larcv.sh:26
then shift fi
do cd
g grid
do i e
esac echo uname r