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