3 # build uboonecode and ubutil
5 # designed to work on Jenkins
6 # this is a proof of concept script
8 echo
"uboonecode version: $UBOONE"
9 echo
"base qualifiers: $QUAL"
10 echo
"larsoft qualifiers: $LARSOFT_QUAL"
11 echo
"build type: $BUILDTYPE"
12 echo
"workspace: $WORKSPACE"
14 # Don't do ifdh build on macos.
16 #if uname | grep -q Darwin; then
17 # if ! echo $QUAL | grep -q noifdh; then
18 # echo "Ifdh build requested on macos. Quitting."
23 # Get number of cores to use.
25 if [ `uname` =
Darwin ]; then
26 #ncores=`sysctl -n hw.ncpu`
27 #ncores=$(( $ncores / 4 ))
32 if [ $ncores -lt 1 ]; then
35 echo
"Building using $ncores cores."
37 # Environment setup, uses /grid/fermiapp or cvmfs.
39 echo
"ls /cvmfs/uboone.opensciencegrid.org"
43 if [ `uname` =
Darwin -
a -f /
grid/fermiapp/products/
uboone/setup_uboone_bluearc.sh ]; then
45 elif [ -f /cvmfs/
uboone.opensciencegrid.org/products/setup_uboone.sh ]; then
46 if [ -
x /cvmfs/
grid.cern.ch/util/cvmfs-uptodate ]; then
47 /cvmfs/
grid.cern.ch/util/cvmfs-uptodate /cvmfs/
uboone.opensciencegrid.org/products
51 echo
"No setup file found."
55 # Use system git on macos.
57 if ! uname | grep -
q Darwin; then
61 # skip around a version of mrb that does not work on macOS
63 if [ `uname` =
Darwin ]; then
64 if [[
x`which
mrb | grep v1_17_02` !=
x ]]; then
75 rm -rf $WORKSPACE/temp ||
exit 1
78 rm -f $WORKSPACE/copyBack
84 echo
"PRODUCTS=$PRODUCTS"
86 # some shenanigans so we can use getopt v1_1_6
87 if [ `uname` =
Darwin ]; then
89 # 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 || \
91 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
95 # tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
102 # make sure we get a read-only copy
105 # Extract ubutil version from uboonecode product_deps
106 ubutil_version=`grep ubutil $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
107 echo
"ubuitil version: $ubutil_version"
108 mrb g -
r -t $ubutil_version ubutil ||
exit 1
110 # Extract uboonedata version from uboonecode product_deps (if any).
111 uboonedata_version=`grep uboonedata $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
112 echo
"uboonedata version: $uboonedata_version"
113 if [
x$uboonedata_version !=
x ]; then
114 mrb g -
r -t $uboonedata_version uboonedata ||
exit 1
118 cd $MRB_BUILDDIR ||
exit 1
121 if uname | grep -
q Linux; then
122 cp /usr/lib64/libXmu.so.6 uboonecode/lib
126 # add uboone_photon_propagation to the manifest.
129 if [
x$uboonedata_version !=
x ]; then
130 uboone_photon_propagation_version=`grep uboone_photon_propagation $MRB_SOURCE/uboonedata/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
131 uboone_photon_propagation_dot_version=`echo ${uboone_photon_propagation_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
133 if [
x$uboone_photon_propagation_version !=
x ]; then
134 echo
"uboone_photon_propagation ${uboone_photon_propagation_version} uboone_photon_propagation-${uboone_photon_propagation_dot_version}-noarch.tar.bz2" >> $manifest
137 # add uboone_data to the manifest.
140 uboone_data_version=`grep uboone_data $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
141 uboone_data_dot_version=`echo ${uboone_data_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
142 if [
x$uboone_data_version !=
x ]; then
143 echo
"uboone_data ${uboone_data_version} uboone_data-${uboone_data_dot_version}-noarch.tar.bz2" >> $manifest
146 # add uboone_example_data to the manifest.
149 uboone_example_data_version=`grep ^uboone_example_data $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
150 uboone_example_data_dot_version=`echo ${uboone_example_data_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
151 if [
x$uboone_example_data_version !=
x ]; then
152 echo
"uboone_example_data ${uboone_example_data_version} uboone_example_data-${uboone_example_data_dot_version}-noarch.tar.bz2" >> $manifest
155 # add uboonedaq_datatypes to the manifest
158 uboonedaq_datatypes_version=`grep uboonedaq_datatypes $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
159 uboonedaq_datatypes_dot_version=`echo ${uboonedaq_datatypes_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
162 qual=`echo $QUAL | sed
's/:*noifdh:*//'`
163 if [
x$uboonedaq_datatypes_version !=
x ]; then
164 echo
"uboonedaq_datatypes ${uboonedaq_datatypes_version} uboonedaq_datatypes-${uboonedaq_datatypes_dot_version}-${os}-${plat}-${qual}-${BUILDTYPE}.tar.bz2" >> $manifest
167 # add swtrigger to the manifest
170 swtrigger_version=`grep swtrigger $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
171 swtrigger_dot_version=`echo ${swtrigger_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
174 qual=`echo $QUAL | sed
's/:*noifdh:*//'`
175 if [
x$swtrigger_version !=
x ]; then
176 echo
"swtrigger ${swtrigger_version} swtrigger-${swtrigger_dot_version}-${os}-${plat}-${qual}-${BUILDTYPE}.tar.bz2" >> $manifest
179 # add larlite to the manifest
182 larlite_version=`grep larlite $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
183 larlite_dot_version=`echo ${larlite_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
186 qual=`echo $QUAL | sed
's/:*noifdh:*//'`
187 if [
x$larlite_version !=
x ]; then
188 echo
"larlite ${larlite_version} larlite-${larlite_dot_version}-${os}-${plat}-${qual}-${BUILDTYPE}.tar.bz2" >> $manifest
191 # add larcv to the manifest
194 larcv_version=`grep larcv $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
195 larcv_dot_version=`echo ${larcv_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
198 qual=`echo $QUAL | sed
's/:*noifdh:*//'`
199 if [
x$larcv_version !=
x ]; then
200 echo
"larcv ${larcv_version} larcv-${larcv_dot_version}-${os}-${plat}-${qual}-${BUILDTYPE}.tar.bz2" >> $manifest
203 # add larbatch to the manifest.
206 larbatch_version=`grep larbatch $MRB_SOURCE/ubutil/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
207 larbatch_dot_version=`echo ${larbatch_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
208 if [
x$larbatch_version !=
x ]; then
209 echo
"larbatch ${larbatch_version} larbatch-${larbatch_dot_version}-noarch.tar.bz2" >> $manifest
212 # Extract larsoft version from product_deps.
214 larsoft_version=`grep larsoft $MRB_SOURCE/uboonecode/ups/product_deps | grep -v qualifier | awk
'{print $2}'`
215 larsoft_dot_version=`echo ${larsoft_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
220 if uname | grep -
q Darwin; then
226 # Construct name of larsoft manifest.
228 larsoft_hyphen_qual=`echo $LARSOFT_QUAL | tr : - | sed
's/-noifdh//'`
229 larsoft_manifest=larsoft-${larsoft_dot_version}-${
flvr}-${larsoft_hyphen_qual}-${BUILDTYPE}_MANIFEST.txt
230 echo
"Larsoft manifest:"
231 echo $larsoft_manifest
234 # Fetch laraoft manifest from scisoft and append to uboonecode manifest.
235 # Filter out larbatch because we already added that.
237 curl --fail --silent --location --insecure http:
239 # Special handling of noifdh builds goes here.
241 if echo $QUAL | grep -
q noifdh; then
243 if uname | grep -
q Darwin; then
245 # If this is a macos build, then rename the manifest to remove noifdh qualifier in the name
248 mv $manifest $noifdh_manifest
252 # Otherwise (for slf builds), delete the manifest entirely.
261 mv *.bz2 $WORKSPACE/copyBack/ ||
exit 1
263 if [ -f $manifest ]; then
264 mv $manifest $WORKSPACE/copyBack/ ||
exit 1
266 cp $MRB_BUILDDIR/uboonecode/releaseDB
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
then setup git exit fi setup gitflow exit export MRB_PROJECT
then source cvmfs dune opensciencegrid org products dune setup_dune sh exit elif[-f/grid/fermiapp/products/dune/setup_dune_fermiapp.sh]
then echo Invalid dCache scratch not copying back else ifdh ls
then cp usr lib64 libXmu so sbncode lib fi mrb mp n sbn j $ncores exit manifest
then echo Work directory not specified exit fi echo Work directory