3 # build sbndcode and sbndutil 
    5 # designed to work on Jenkins 
    6 # this is a proof of concept script 
    8 echo 
"sbndcode version: $SBND_VERSION" 
    9 echo 
"base qualifiers: $QUAL" 
   10 echo 
"larsoft qualifiers: $SQUAL" 
   11 echo 
"build type: $BUILDTYPE" 
   12 echo 
"workspace: $WORKSPACE" 
   14 # Get number of cores to use. 
   17   #ncores=`sysctl -n hw.ncpu` 
   18   #ncores=$(( $ncores / 4 )) 
   23 if [ $ncores -lt 1 ]; then
 
   26 echo 
"Building using $ncores cores." 
   28 # Environment setup, uses /grid/fermiapp or cvmfs. 
   30 echo 
"ls /cvmfs/sbnd.opensciencegrid.org" 
   31 ls /cvmfs/
sbnd.opensciencegrid.org
 
   34 if [ -f /
grid/fermiapp/products/
sbnd/setup_sbnd.sh ]; then
 
   36 elif [ -f /cvmfs/
sbnd.opensciencegrid.org/products/setup_sbnd.sh ]; then
 
   37   if [ -
x /cvmfs/
grid.cern.ch/util/cvmfs-uptodate ]; then
 
   38     /cvmfs/
grid.cern.ch/util/cvmfs-uptodate /cvmfs/
sbnd.opensciencegrid.org/products
 
   40   source /cvmfs/
sbnd.opensciencegrid.org/products/setup_sbnd.sh || 
exit 1
 
   42   echo 
"No setup file found." 
   45 # skip around a version of mrb that does not work on macOS 
   47 if [ `uname` = 
Darwin ]; then
 
   48   if [[ 
x`which 
mrb | grep v1_17_02` != 
x ]]; then
 
   54 # Use system git on macos. 
   65 rm -rf $WORKSPACE/temp || 
exit 1
 
   68 rm -f $WORKSPACE/copyBack
 
   75 # some shenanigans so we can use getopt v1_1_6 
   76 if [ `uname` = 
Darwin ]; then
 
   78 #  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 || \ 
   80 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed 
   84 #  tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1 
   91 # make sure we get a read-only copy 
   94 # get sbndutil, extracting version from sbndcode product_deps if not specified 
   95 if [ -
z "$SBNDUTIL" ]; then
 
   96   sbndutil_version=`grep sbndutil $MRB_SOURCE/sbndcode/ups/product_deps | grep -v qualifier | awk 
'{print $2}'`
 
   97   echo 
"sbndutil version: $sbndutil_version" 
   98   mrb g -
r -t $sbndutil_version sbndutil || 
exit 1
 
  100   echo 
"sbndutil version: $SBNDUTIL" 
  104 cd $MRB_BUILDDIR || 
exit 1
 
  107 if uname | grep -
q Linux; then
 
  108   cp /usr/lib64/libXmu.so.6 sbndcode/lib
 
  112 # add sbnd_data to the manifest 
  115 sbnd_data_version=`grep sbnd_data $MRB_SOURCE/sbndcode/ups/product_deps | grep -v qualifier | awk 
'{print $2}'`
 
  116 sbnd_data_dot_version=`echo ${sbnd_data_version} | sed -
e 's/_/./g' | sed -
e 's/^v//'`
 
  117 echo 
"sbnd_data          ${sbnd_data_version}       sbnd_data-${sbnd_data_dot_version}-noarch.tar.bz2" >>  $manifest
 
  119 # Extract sbncode version from product_deps. 
  120 sbncode_version=`grep sbncode $MRB_SOURCE/sbndcode/ups/product_deps | grep -v qualifier | awk 
'{print $2}'`
 
  121 sbncode_dot_version=`echo ${sbncode_version} |  sed -
e 's/_/./g' | sed -
e 's/^v//'`
 
  127 if uname | grep -
q Darwin; then
 
  133 # Construct name of sbncode manifest. 
  135 sbncode_hyphen_qual=`echo $QUAL | tr : - | sed 
's/-noifdh//'`
 
  136 sbncode_manifest=sbn-${sbncode_dot_version}-${
flvr}-${sbncode_hyphen_qual}-${BUILDTYPE}_MANIFEST.txt
 
  137 echo 
"sbncode manifest:" 
  138 echo $sbncode_manifest
 
  141 # Fetch sbncode manifest from scisoft and append to sbndcode manifest. 
  143 curl --fail --silent --location --insecure http:
 
  145 if echo $QUAL | grep -
q noifdh; then
 
  146   if uname | grep -
q Darwin; then
 
  147    # If this is a macos build, then rename the manifest to remove noifdh qualifier in the name 
  149     mv $manifest $noifdh_manifest
 
  151    # Otherwise (for slf builds), delete the manifest entirely. 
  158 mv *.bz2  $WORKSPACE/copyBack/ || 
exit 1
 
  160 if [ -f $manifest ]; then
 
  161   mv $manifest  $WORKSPACE/copyBack/ || 
exit 1
 
  163 cp $MRB_BUILDDIR/sbndcode/releaseDB
 
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
 
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
 
stream1 can override from command line with o or output services user sbnd