All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
buildSBNANA.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # build sbncode
4 # use mrb
5 # designed to work on Jenkins
6 # this is a proof of concept script
7 
8 echo "sbnana version: $SBNANA_VERSION"
9 echo "sbnana tag/commit/branch: $SBNANA"
10 #echo "sbnanaobj tag/commit/branch: $SBNANAOBJ"
11 echo "base qualifiers: $QUAL"
12 echo "s qualifier: $SQUAL"
13 echo "build type: $BUILDTYPE"
14 echo "workspace: $WORKSPACE"
15 
16 # Get number of cores to use.
17 
18 ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
19 
20 if [ $ncores -lt 1 ]; then
22 fi
23 echo "Building using $ncores cores."
24 
25 # Environment setup, uses cvmfs.
26 
27 echo "ls /cvmfs/larsoft.opensciencegrid.org"
28 ls /cvmfs/larsoft.opensciencegrid.org
29 echo
30 
31 if [ -f /cvmfs/larsoft.opensciencegrid.org/products/setup ]; then
32  if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
33  /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/larsoft.opensciencegrid.org/products
34  fi
35  source /cvmfs/larsoft.opensciencegrid.org/products/setup || exit 1
36 else
37  echo "No larsoft setup file found."
38  exit 1
39 fi
40 
41 echo "ls /cvmfs/sbn.opensciencegrid.org"
42 ls /cvmfs/sbn.opensciencegrid.org
43 echo
44 
45 if [ -f /cvmfs/sbn.opensciencegrid.org/products/sbn/setup ]; then
46  if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
47  /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/sbn.opensciencegrid.org/products/sbn
48  fi
49  echo "Setting up sbn cvmfs"
50  source /cvmfs/sbn.opensciencegrid.org/products/sbn/setup || exit 1
51 else
52  echo "No sbn setup file found."
53  exit 1
54 fi
55 
56 #setup mrb
57 setup mrb || exit 1
58 
59 # Use system git on macos.
60 if ! uname | grep -q Darwin; then
61  setup git || exit 1
62 fi
63 setup gitflow || exit 1
64 export MRB_PROJECT=sbnana
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 $SBNANA_VERSION -q $QUAL:$BUILDTYPE || exit 1
75 
76 set +x
77 source localProducts*/setup || exit 1
78 
79 set -x
80 cd $MRB_SOURCE || exit 1
81 # make sure we get a read-only copy
82 mrb g -r sbnana@$SBNANA || exit 1
83 
84 if [ -z "$SBNANAOBJ" ]; then
85  # Extract sbananobj version from sbncode product_deps
86  SBNANAOBJ=`grep sbnanaobj $MRB_SOURCE/sbnana/ups/product_deps | grep -v qualifier | awk '{print $2}'`
87 fi
88 echo "sbnanaobj version: $SBNANAOBJ"
89 mrb g -r sbnanaobj@$SBNANAOBJ || exit 1
90 
91 cd $MRB_BUILDDIR || exit 1
92 mrbsetenv || exit 1
93 mrb b -j$ncores || exit 1
94 if uname | grep -q Linux; then
95  cp /usr/lib64/libXmu.so.6 sbncode/lib
96 fi
97 mrb mp -n sbnana -- -j$ncores || exit 1
98 
99 manifest=sbnana-*_MANIFEST.txt
100 
101 # Save artifacts.
102 
103 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
104 if [ -f $manifest ]; then
105  mv $manifest $WORKSPACE/copyBack/ || exit 1
106 fi
107 cp $MRB_BUILDDIR/sbnana/releaseDB/*.html $WORKSPACE/copyBack/
108 ls -l $WORKSPACE/copyBack/
109 cd $WORKSPACE || exit 1
110 rm -rf $WORKSPACE/temp || exit 1
111 set +x
112 
113 exit 0
process_name opflash particleana ie ie ie z
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
then echo Invalid dCache scratch not copying back else ifdh ls
Definition: run_job.sh:111
BEGIN_PROLOG g
then SBNANAOBJ
Definition: buildSBN.sh:95
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
then echo echo For Linux