5 # designed to work on Jenkins
6 # this is a proof of concept script
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"
16 # Get number of cores to use.
18 ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
20 if [ $ncores -lt 1 ]; then
23 echo "Building using $ncores cores."
25 # Environment setup, uses cvmfs.
27 echo "ls /cvmfs/larsoft.opensciencegrid.org"
28 ls /cvmfs/larsoft.opensciencegrid.org
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
35 source /cvmfs/larsoft.opensciencegrid.org/products/setup || exit 1
37 echo "No larsoft setup file found."
41 echo "ls /cvmfs/sbn.opensciencegrid.org"
42 ls /cvmfs/sbn.opensciencegrid.org
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
49 echo "Setting up sbn cvmfs"
50 source /cvmfs/sbn.opensciencegrid.org/products/sbn/setup || exit 1
52 echo "No sbn setup file found."
59 # Use system git on macos.
60 if ! uname | grep -q Darwin; then
63 setup gitflow || exit 1
64 export MRB_PROJECT=sbnana
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
77 source localProducts*/setup || exit 1
80 cd $MRB_SOURCE || exit 1
81 # make sure we get a read-only copy
82 mrb g -r sbnana@$SBNANA || exit 1
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}'`
88 #echo "sbnanaobj version: $SBNANAOBJ"
89 #mrb g -r sbnanaobj@$SBNANAOBJ || exit 1
91 cd $MRB_BUILDDIR || 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
97 mrb mp -n sbnana -- -j$ncores || exit 1
99 manifest=sbnana-*_MANIFEST.txt
103 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
104 if [ -f $manifest ]; then
105 mv $manifest $WORKSPACE/copyBack/ || exit 1
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