All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
build-larsoft-py3.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # pull source code in ${working_dir}/source
4 # build in ${working_dir}/build
5 # copyback directory is ${working_dir}/copyBack
6 
8 {
9  cat 1>&2 <<EOF
10 Usage: $(basename ${0}) [-h]
11  env WORKSPACE=<workspace> LARVER=<larsoft version> QUAL=<qualifier> BUILDTYPE=<debug|prof> $(basename ${0})
12 
13 Options:
14 
15  -h This help.
16 
17 EOF
18 }
19 
21  for label in "${labels[@]}"; do
22  for wanted in "$@"; do
23  [[ "${label}" == "${wanted}" ]] && return 0
24  done
25  done
26  return 1
27 }
28 
29 
30 while getopts :h OPT; do
31  case ${OPT} in
32  h)
33  usage
34  exit 1
35  ;;
36  *)
37  usage
38  exit 1
39  esac
40 done
41 shift `expr $OPTIND - 1`
43 
44 working_dir="${WORKSPACE:-$(pwd)}"
45 version="${1:-${LARVER}}"
46 #objver=${LAROBJ}
47 qual_set="${2:-${QUAL}}"
48 oIFS=${IFS}; IFS=:; quals=(${qual_set//-/:}); IFS=$oIFS; unset oIFS
49 build_type="${3:-${BUILDTYPE}}"
50 
51 labels=()
52 for onequal in "${quals[@]}"; do
53  case ${onequal} in
54  e[679]|e1[0-9]|c[0-9])
55  basequal=${onequal}
56  ;;
57  s7[0-9]|s8[0-9]|s9[0-9])
58  squal=${onequal}
59  ;;
60  *)
61  labels+=${onequal}
62  esac
63 done
64 
65 case ${build_type} in
66  debug) ;;
67  prof) ;;
68  *)
69  usage
70  exit 1
71 esac
72 
73 # create copyBack so artifact copy does not fail on early exit
74 rm -rf "${working_dir}/copyBack"
75 mkdir -p "${working_dir}/copyBack" || exit 1
76 
77 # Find platform flavor.
78 OS=`uname`
79 if [ "${OS}" = "Linux" ]
80 then
81  id=`lsb_release -is`
82  if [ "${id}" = "Ubuntu" ]
83  then
84  flvr=u`lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d"."`
85  else
86  flvr=slf`lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d"."`
87  fi
88 elif [ "${OS}" = "Darwin" ]
89 then
90  flvr=d`uname -r | cut -f1 -d"."`
91  # set locale
92  echo
93  locale
94  echo
95  export LANG=C
96  export LC_ALL=$LANG
97  locale
98  echo
99 else
100  echo "ERROR: unrecognized operating system ${OS}"
101  exit 1
102 fi
103 
104 # Check supported builds.
105 if [[ `uname -s` == Darwin ]]; then
106  OSnum=`uname -r | cut -f1 -d"."`
107  xver=`xcodebuild -version | grep Xcode | cut -f2 -d" " | cut -f1 -d"."`
108  xcver=`xcodebuild -version | grep Xcode`
109  if { [[ ${basequal} =~ ^e(9$|[1-9][0-9]) ]] && \
110  [[ ${xver} < 7 ]] && \
111  [[ ${OSnum} > 13 ]]; }; then
112  # XCode too old on this platform.
113  echo "${basequal} build not supported on `uname -s`${OSnum} with ${xcver}"
114  echo "${basequal} build not supported on `uname -s`${OSnum} with ${xcver}" > \
115  "${working_dir}/copyBack/skipping_build"
116  exit 0
117  elif { [[ "$basequal" == e* ]] || \
118  { [[ "$basequal" == c* ]] && (( $OSnum < 15 )); }; }; then
119  if want_unsupported; then
120  echo "Building unsupported ${basequal} on `uname -s`${OSnum} due to \$CET_BUILD_UNSUPPORTED=${CET_BUILD_UNSUPPORTED}"
121  else
122  # Don't normally support GCC builds on MacOS.
123  msg="${basequal} build not supported on `uname -s`${OSnum} -- export CET_BUILD_UNSUPPORTED=1 to override."
124  echo "$msg"
125  echo "$msg" > "${working_dir}/copyBack/skipping_build"
126  exit 0
127  fi
128  fi
129  if have_label py3; then
130  msg="We are not building for Python3 on Darwin."
131  echo "${msg}"
132  echo "${msg}" > "${working_dir}/copyBack/skipping_build"
133  exit 0
134  fi
135 elif [[ "${flvr}" == slf6 ]] && have_label py3; then
136  msg="Python3 builds not supported on SLF6."
137  echo "${msg}"
138  echo "${msg}" > "${working_dir}/copyBack/skipping_build"
139  exit 0
140 fi
141 
142 dotver=`echo ${version} | sed -e 's/_/./g' | sed -e 's/^v//'`
143 
144 echo "building the larsoft distribution for ${version} ${dotver} ${qual_set} ${build_type}"
145 echo "build flavor is ${flvr}"
146 echo ""
147 
148 qualdir=`echo ${qual_set} | sed -e 's%:%-%'`
149 
150 set -x
151 
152 blddir=${working_dir}/build
153 srcdir=${working_dir}/source
154 # start with clean directories
155 rm -rf ${blddir}
156 rm -rf ${srcdir}
157 # now make the dfirectories
158 mkdir -p ${srcdir} || exit 1
159 mkdir -p ${blddir} || exit 1
160 
161 cd ${blddir} || exit 1
162 curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/bundles/tools/buildFW || exit 1
163 chmod +x buildFW
164 
165 cd ${blddir} || exit 1
166 echo
167 echo "begin build"
168 echo
169 (( ${#labels[@]} > 0 )) && lopt=-l
170 ./buildFW -t -b ${basequal} \
171  ${lopt} $(IFS=:; printf '%s' "${labels[*]}") \
172  ${blddir} ${build_type} lar_product_stack-${version} || \
173  { mv ${blddir}/*.log "${working_dir}/copyBack/"
174  exit 1
175  }
176 ./buildFW -t -b ${basequal} -s ${squal} \
177  ${lopt} $(IFS=:; printf '%s' "${labels[*]}") \
178  ${blddir} ${build_type} larbase-${version} || \
179  { mv ${blddir}/*.log "${working_dir}/copyBack/"
180  exit 1
181  }
182 ./buildFW -t -b ${basequal} -s ${squal} \
183  ${lopt} $(IFS=:; printf '%s' "${labels[*]}") \
184  ${blddir} ${build_type} larsoft-${version} || \
185  { mv ${blddir}/*.log "${working_dir}/copyBack/"
186  exit 1
187  }
188 objver=`ls larsoftobj-cfg* | cut -f3 -d"-" | sed -e 's/\./_/g'`
189 ./buildFW -t -b ${basequal} \
190  ${lopt} $(IFS=:; printf '%s' "${labels[*]}") \
191  ${blddir} ${build_type} larsoftobj-${objver} || \
192  { mv ${blddir}/*.log "${working_dir}/copyBack/"
193  exit 1
194  }
195 
196 echo
197 echo "move files"
198 echo
199 # get these out of the way
200 mv ${blddir}/*source* ${srcdir}/
201 mv ${blddir}/g*noarch* ${srcdir}/
202 mv ${blddir}/larsoft_data*.bz2 ${srcdir}/
203 #
204 mv ${blddir}/*.bz2 "${working_dir}/copyBack/"
205 mv ${blddir}/*.txt "${working_dir}/copyBack/"
206 rm -rf ${srcdir}
207 rm -rf ${blddir}
208 
209 exit 0
* labels
*usage exit esac done shift expr $OPTIND OPTIND
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]
have_label()
shift
Definition: fcl_checks.sh:26
usage
Definition: doGit.sh:21
then flvr
Definition: buildSBND.sh:128
while getopts
while getopts h
then shift fi
do cd
then basequal
Definition: buildUboone2.sh:26
do case in h help echo Usage
Definition: file_to_url.sh:42
then QUAL
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
do i e
T copy(T const &v)
s7[0-9] s8[0-9] s9[0-9] squal
esac echo uname r
physics pm2 e1