All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
build_larcv_stand_alone.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 #------------------------------------------------------------------
4 #
5 # Name: build_larcv_stand_alone.sh
6 #
7 # Purpose: Build debug and prof flavors of larcv without larlite on Jenkins.
8 #
9 # Created: 4-Aug-2017 H. Greenlee
10 #
11 #------------------------------------------------------------------
12 
13 echo "larcv ups version: $LARCV_VERSION"
14 echo "larcv git tag: $LARCV_TAG"
15 echo "qualifier: $QUAL"
16 echo "build type: $BUILDTYPE"
17 echo "workspace: $WORKSPACE"
18 
19 # Get number of cores to use.
20 
21 if [ `uname` = Darwin ]; then
22  #ncores=`sysctl -n hw.ncpu`
23  #ncores=$(( $ncores / 4 ))
25 else
26  ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
27 fi
28 if [ $ncores -lt 1 ]; then
29  ncores=1
30 fi
31 echo "Building using $ncores cores."
32 
33 # Environment setup, uses /grid/fermiapp or cvmfs.
34 
35 if [ -f /grid/fermiapp/products/uboone/setup_uboone.sh ]; then
36  source /grid/fermiapp/products/uboone/setup_uboone.sh || exit 1
37 elif [ -f /cvmfs/uboone.opensciencegrid.org/products/setup_uboone.sh ]; then
38  if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
39  /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/uboone.opensciencegrid.org/products
40  fi
41  source /cvmfs/uboone.opensciencegrid.org/products/setup_uboone.sh || exit 1
42 else
43  echo "No setup file found."
44  exit 1
45 fi
46 
47 # Use system git on macos.
48 
49 if ! uname | grep -q Darwin; then
50  setup git || exit 1
51 fi
52 
53 # Set up working area.
54 
55 set -x
56 rm -rf $WORKSPACE/temp || exit 1
57 mkdir -p $WORKSPACE/temp || exit 1
58 mkdir -p $WORKSPACE/copyBack || exit 1
59 rm -f $WORKSPACE/copyBack/* || exit 1
60 cd $WORKSPACE/temp || exit 1
61 export HOME_DIR=`pwd`
62 
63 # Check for supported combination of base qualifier and OS.
64 if [[ `uname -s` == Darwin ]] && [[ $QUAL == e* ]]; then
65  echo "${QUAL} build not supported on `uname -s`"
66  echo "${QUAL} build not supported on `uname -s`" > $WORKSPACE/copyBack/skipping_build
67  exit 0
68 fi
69 
70 set +x
71 
72 set +x
73 
74 # Make an installation directory with relocatable dbconfig file.
75 
76 mkdir -p ${HOME_DIR}/install/.upsfiles
77 cat <<EOF > ${HOME_DIR}/install/.upsfiles/dbconfig
78 FILE = DBCONFIG
79 AUTHORIZED_NODES = *
80 VERSION_SUBDIR = 1
81 PROD_DIR_PREFIX = \${UPS_THIS_DB}
82 UPD_USERCODE_DIR = \${UPS_THIS_DB}/.updfiles
83 EOF
84 
85 # Make source area and check out sources.
86 
87 mkdir -p ${HOME_DIR}/srcs
88 cd ${HOME_DIR}/srcs
89 
90 # Check out larcv.
91 
92 #git clone https://github.com/LArbys/LArCV
93 git clone https://github.com/hgreenlee/LArCV
94 cd LArCV
95 git checkout $LARCV_TAG
96 rm -rf .git
97 cd ..
98 
99 # Set up the correct version of compiler.
100 
101 if [[ $QUAL =~ ^c ]]; then
102  compiler_version=`ups depend -M ${HOME_DIR}/srcs/LArCV/ups -m larcv.table -q ${QUAL}:${BUILDTYPE} larcv | sed -n 's/^.*__\(clang .*\)$/\1/p'`
103 else
104  compiler_version=`ups depend -M ${HOME_DIR}/srcs/LArCV/ups -m larcv.table -q ${QUAL}:${BUILDTYPE} larcv | sed -n 's/^.*__\(gcc .*\)$/\1/p'`
105 fi
106 echo "setup $compiler_version"
107 setup $compiler_version
108 
109 # Set up the correct version of root.
110 
111 root_version=`ups depend -M ${HOME_DIR}/srcs/LArCV/ups -m larcv.table -q ${QUAL}:${BUILDTYPE} larcv | sed -n 's/^.*__\(root .*\)$/\1/p'`
112 echo "setup $root_version"
113 setup $root_version
114 
115 # Build larcv.
116 
117 cd ${HOME_DIR}/srcs/LArCV
118 source configure.sh || exit 1
119 if [[ $QUAL =~ ^c ]]; then
120  export LARCV_CXX=clang++
121 else
122  export LARCV_CXX=g++
123 fi
124 echo "LARCV_CXX=$LARCV_CXX"
125 make -j$ncores || exit 1
126 
127 # Assemble larcv ups product.
128 
129 install_dir=${HOME_DIR}/install/larcv/$LARCV_VERSION
130 subdir=`get-directory-name subdir ${QUAL}:${BUILDTYPE}`
131 flavor_dir=${install_dir}/$subdir
132 mkdir -p $flavor_dir
133 cp -r . $flavor_dir
134 cp -r ups $install_dir
135 
136 # Declare larcv ups product in temporary products area.
137 
138 if uname | grep -q Darwin; then
139  flavor=`ups flavor -2`
140 else
141  flavor=`ups flavor -4`
142 fi
143 ups declare -z ${HOME_DIR}/install -r larcv/$LARCV_VERSION -m larcv.table -f $flavor -q ${QUAL}:${BUILDTYPE} -U ups larcv $LARCV_VERSION
144 
145 # Make distribution tarball
146 
147 cd ${HOME_DIR}/install
148 dot_version=`echo $LARCV_VERSION | sed -e 's/_/\./g' | sed -e 's/^v//'`
149 subdir=`echo $subdir | sed -e 's/\./-/g'`
150 #qual=`echo $CETPKG_QUAL | sed -e 's/:/-/g'`
151 tarballname=larcv-${dot_version}-${subdir}.tar.bz2
152 echo "Making ${tarballname}"
153 tar cjf ${HOME_DIR}/${tarballname} larcv
154 
155 # Save artifacts.
156 
157 mv ${HOME_DIR}/*.bz2 $WORKSPACE/copyBack/ || exit 1
158 ls -l $WORKSPACE/copyBack/
159 cd $WORKSPACE || exit 1
160 #rm -rf $WORKSPACE/temp || exit 1
161 set +x
162 
163 exit 0
then source grid fermiapp products dune setup_dune_fermiapp sh exit else echo No setup file found exit fi setup
process_name uboone
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
do source
pdgs p
Definition: selectors.fcl:22
then source cvmfs dune opensciencegrid org products dune setup_dune sh exit elif[-f/grid/fermiapp/products/dune/setup_dune_fermiapp.sh]
then ncores
Definition: build_larcv.sh:26
then shift fi
g grid
do i e