5 # designed to work on Jenkins
6 # this is a proof of concept script
8 echo "sbndqm version: $SBNDQM_VERSION"
9 echo "sbndqm tag: $SBNDQM"
10 #echo "sbncode tag: $SBNCODE"
11 echo "sbndaq_onlin tag: $SBNDAQ_ONLINE"
12 echo "base qualifiers: $QUAL"
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/fermilab.opensciencegrid.org/products/artdaq/"
28 ls /cvmfs/fermilab.opensciencegrid.org/products/artdaq
31 if [ -f /cvmfs/fermilab.opensciencegrid.org/products/artdaq/setup ]; then
32 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
33 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/fermilab.opensciencegrid.org/products/artdaq
35 source /cvmfs/fermilab.opensciencegrid.org/products/artdaq/setup || exit 1
37 echo "No fermilab artdaq setup file found."
41 echo "ls /cvmfs/larsoft.opensciencegrid.org"
42 ls /cvmfs/larsoft.opensciencegrid.org
45 if [ -f /cvmfs/larsoft.opensciencegrid.org/products/setup ]; then
46 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
47 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/larsoft.opensciencegrid.org/products
49 source /cvmfs/larsoft.opensciencegrid.org/products/setup || exit 1
51 echo "No larsoft setup file found."
55 echo "ls /cvmfs/sbn.opensciencegrid.org"
56 ls /cvmfs/sbn.opensciencegrid.org
59 if [ -f /cvmfs/sbn.opensciencegrid.org/products/sbn/setup ]; then
60 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
61 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/sbn.opensciencegrid.org/products/sbn
63 echo "Setting up sbn cvmfs"
64 source /cvmfs/sbn.opensciencegrid.org/products/sbn/setup || exit 1
66 echo "No sbn setup file found."
73 setup gitflow || exit 1
74 export MRB_PROJECT=sbndqm
79 rm -rf $WORKSPACE/temp || exit 1
80 mkdir -p $WORKSPACE/temp || exit 1
81 mkdir -p $WORKSPACE/copyBack || exit 1
82 rm -f $WORKSPACE/copyBack/* || exit 1
83 cd $WORKSPACE/temp || exit 1
84 mrb newDev -v $SBNDQM_VERSION -q $QUAL:$BUILDTYPE || exit 1
87 source localProducts*/setup || exit 1
90 cd $MRB_SOURCE || exit 1
91 # make sure we get a read-only copy
92 mrb g -r sbndqm@$SBNDQM || exit 1
95 #if [ -z "$SBNCODE" ]; then
96 # # Extract sbncode version from sbncode product_deps
97 # SBNCODE=`grep sbncode $MRB_SOURCE/sbndqm/ups/product_deps | grep -v qualifier | awk '{print $2}'`
99 #echo "sbncode version: $SBNCODE"
100 #mrb g -r sbncode@$SBNCODE || exit 1
102 if [ -z "$SBNDAQ_ONLINE" ]; then
103 # Extract sbnobj version from sbncode product_deps
104 SBNDAQ_ONLINE=`grep sbndaq_online $MRB_SOURCE/sbndqm/ups/product_deps | grep -v qualifier | awk '{print $2}'`
106 echo "sbndaq_online version: $SBNDAQ_ONLINE"
107 mrb g -r sbndaq_online@$SBNDAQ_ONLINE || exit 1
109 cd $MRB_BUILDDIR || exit 1
111 mrb b -j$ncores || exit 1
112 if uname | grep -q Linux; then
113 cp /usr/lib64/libXmu.so.6 sbncode/lib
115 mrb mp -n sbndqm -- -j$ncores || exit 1
117 manifest=sbndqm-*_MANIFEST.txt
119 # Extract larsoft version from product_deps.
120 sbncode_version=`grep sbncode $MRB_SOURCE/sbndqm/ups/product_deps | grep -v qualifier | awk '{print $2}'`
121 sbncode_dot_version=`echo ${sbncode_version} | sed -e 's/_/./g' | sed -e 's/^v//'`
126 # Construct name of larsoft manifest.
128 sbncode_hyphen_qual=`echo $QUAL | tr : - | sed 's/-noifdh//'`
129 sbncode_manifest=sbn-${sbncode_dot_version}-${flvr}-${sbncode_hyphen_qual}-${BUILDTYPE}_MANIFEST.txt
130 echo "sbncode manifest:"
131 echo $sbncode_manifest
134 # Fetch larsoft manifest from scisoft and append to sbncode manifest.
136 curl --fail --silent --location --insecure http://scisoft.fnal.gov/scisoft/bundles/sbn/${sbncode_version}/manifest/${sbncode_manifest} >> $manifest || exit 1
138 if echo $QUAL | grep -q noifdh; then
139 # Delete the manifest entirely.
145 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
146 manifest=sbndqm-*_MANIFEST.txt
147 if [ -f $manifest ]; then
148 mv $manifest $WORKSPACE/copyBack/ || exit 1
150 cp $MRB_BUILDDIR/sbndqm/releaseDB/*.html $WORKSPACE/copyBack/
151 ls -l $WORKSPACE/copyBack/
152 cd $WORKSPACE || exit 1
153 rm -rf $WORKSPACE/temp || exit 1