All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
build_uboonedaq_datatypes.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 #------------------------------------------------------------------
4 #
5 # Name: build_uboonedaq_datatypes.sh
6 #
7 # Purpose: Build debug and prof flavors of uboonedaq_datatypes
8 # on Jenkins.
9 #
10 # Created: 25-Jun-2015 H. Greenlee
11 #
12 #------------------------------------------------------------------
13 
14 echo "uboonedaq_datatypes version: $VERSION"
15 echo "Qualifier: $QUAL"
16 echo "build type: $BUILDTYPE"
17 echo "workspace: $WORKSPACE"
18 
19 # Make a workspace without colons.
20 
21 export WORKSPACE2=`echo $WORKSPACE | tr : -`
22 echo "workspace 2: $WORKSPACE2"
23 
24 
25 # Get number of cores to use.
26 
27 if [ `uname` = Darwin ]; then
28  #ncores=`sysctl -n hw.ncpu`
29  #ncores=$(( $ncores / 4 ))
31 else
32  ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
33 fi
34 if [ $ncores -lt 1 ]; then
35  ncores=1
36 fi
37 echo "Building using $ncores cores."
38 
39 # Interpret build type.
40 
41 opt=''
42 if [ $BUILDTYPE = debug ]; then
43  opt='-d'
44 elif [ $BUILDTYPE = prof ]; then
45  opt='-p'
46 else
47  echo "Unknown build type $BUILDTYPE"
48  exit 1
49 fi
50 
51 # Environment setup, uses /grid/fermiapp or cvmfs.
52 
53 if [ -f /grid/fermiapp/products/uboone/setup_uboone.sh ]; then
54  source /grid/fermiapp/products/uboone/setup_uboone.sh || exit 1
55 elif [ -f /cvmfs/uboone.opensciencegrid.org/products/setup_uboone.sh ]; then
56  if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
57  /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/uboone.opensciencegrid.org/products
58  fi
59  source /cvmfs/uboone.opensciencegrid.org/products/setup_uboone.sh || exit 1
60 else
61  echo "No setup file found."
62  exit 1
63 fi
64 
65 # Use system git on macos.
66 
67 if ! uname | grep -q Darwin; then
68  setup git || exit 1
69 fi
70 
71 # Set up working area.
72 
73 set -x
74 rm -rf $WORKSPACE2/temp || exit 1
75 mkdir -p $WORKSPACE2/temp || exit 1
76 mkdir -p $WORKSPACE/copyBack || exit 1
77 rm -f $WORKSPACE/copyBack/* || exit 1
78 cd $WORKSPACE2/temp || exit 1
79 export UBOONEDAQ_HOME_DIR=`pwd`
80 
81 # Check for supported combination of base qualifier and OS.
82 if [[ `uname -s` == Darwin ]] && [[ $QUAL == e* ]]; then
83  echo "${QUAL} build not supported on `uname -s`"
84  echo "${QUAL} build not supported on `uname -s`" > $WORKSPACE/copyBack/skipping_build
85  exit 0
86 fi
87 
88 set +x
89 
90 # Make build area.
91 
92 mkdir -p build
93 
94 # Make install area.
95 
96 mkdir -p install
97 
98 # Make source area and check out sources.
99 
100 mkdir -p srcs
101 cd srcs
102 git clone http://cdcvs.fnal.gov/projects/uboonedaq-datatypes
103 #git clone https://github.com/hgreenlee/uboonedaq_datatypes
104 #mv uboonedaq_datatypes uboonedaq-datatypes
105 cd uboonedaq-datatypes
106 
107 # Make sure repository is up to date and check out desired tag.
108 
109 git checkout master
110 git pull
111 git checkout $VERSION
112 
113 # Initialize build area.
114 
115 cd ${UBOONEDAQ_HOME_DIR}/build
116 source ${UBOONEDAQ_HOME_DIR}/srcs/uboonedaq-datatypes/projects/ups/setup_for_development $opt ${QUAL}:offline
117 
118 # Run cmake.
119 
120 if [[ $QUAL =~ ^c ]]; then
121  env CC=clang CXX=clang++ FC=gfortran cmake -DCMAKE_INSTALL_PREFIX="${UBOONEDAQ_HOME_DIR}/install" -DCMAKE_BUILD_TYPE=${CETPKG_TYPE} "${CETPKG_SOURCE}"
122 else
123  env CC=gcc CXX=g++ FC=gfortran cmake -DCMAKE_INSTALL_PREFIX="${UBOONEDAQ_HOME_DIR}/install" -DCMAKE_BUILD_TYPE=${CETPKG_TYPE} "${CETPKG_SOURCE}"
124 fi
125 
126 # Run make
127 
128 make -j$ncores
129 stat=$?
130 if [ $stat -ne 0 ]; then
131  exit $stat
132 fi
133 make install
134 stat=$?
135 if [ $stat -ne 0 ]; then
136  exit $stat
137 fi
138 
139 
140 # Make distribution tarball
141 
142 cd ${UBOONEDAQ_HOME_DIR}/install
143 dot_version=`echo $VERSION | sed -e 's/_offline//' | sed -e 's/_/\./g' | sed -e 's/^v//'`
144 subdir=`echo $CET_SUBDIR | sed -e 's/\./-/g'`
145 #qual=`echo $CETPKG_QUAL | sed -e 's/:offline//' | sed -e 's/:/-/g'`
146 qual=`echo $CETPKG_QUAL | sed -e 's/:/-/g'`
147 tarballname=uboonedaq_datatypes-${dot_version}-${subdir}-${qual}.tar.bz2
148 echo "Making ${tarballname}"
149 tar cjf ${UBOONEDAQ_HOME_DIR}/${tarballname} uboonedaq_datatypes
150 
151 # Save artifacts.
152 
153 mv ${UBOONEDAQ_HOME_DIR}/${tarballname} $WORKSPACE/copyBack/ || exit 1
154 ls -l $WORKSPACE/copyBack/
155 cd $WORKSPACE2 || exit 1
156 rm -rf $WORKSPACE2/temp || exit 1
157 set +x
158 
159 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