build-larsoft-rc.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 
7 # this script is just for building release candidates
8 
9 usage()
10 {
11  cat 1>&2 <<EOF
12 Usage: $(basename ${0}) [-h]
13  $(basename ${0}) <version> <qual_set> <build_type>
14 
15 Options:
16 
17  -h This help.
18 
19 Arguments:
20 
21  qual_set Supported qualifier sets: s8:e7, s11:e7
22 
23 EOF
24 }
25 
26 while getopts :h OPT; do
27  case ${OPT} in
28  h)
29  usage
30  exit 1
31  ;;
32  *)
33  usage
34  exit 1
35  esac
36 done
37 shift `expr $OPTIND - 1`
38 OPTIND=1
39 
40 working_dir=${WORKSPACE}
41 version=${LARVER}
42 qual_set="${QUAL}"
43 build_type=${BUILDTYPE}
44 objver=${LAROBJ}
45 
46 case ${qual_set} in
47  s30:e9)
48  basequal=e9
49  squal=s30
50  artver=v1_17_07
51  nuver=v1_24_00
52  oldver=v05_03_00_rc1
53  ;;
54  s31:e9)
55  basequal=e9
56  squal=s31
57  artver=v1_18_05
58  nuver=v1_25_05
59  oldver=v06_00_00_rc2
60  ;;
61  s33:e10)
62  basequal=e10
63  squal=s33
64  artver=v2_00_02
65  nuver=v2_00_00
66  oldver=v06_00_00_rc4
67  ;;
68  s36:e10)
69  basequal=e10
70  squal=s36
71  artver=v2_00_03
72  nuver=v2_00_01
73  oldver=v06_00_00_rc4
74  ;;
75  s41:e10)
76  basequal=e10
77  squal=s41
78  artver=v2_03_00
79  nuver=v2_04_01
80  oldver=v06_06_00
81  ;;
82  s42:e10)
83  basequal=e10
84  squal=s42
85  artver=v2_04_00
86  nuver=v2_04_03
87  oldver=v06_08_00
88  ;;
89  *)
90  usage
91  exit 1
92 esac
93 
94 case ${build_type} in
95  debug) ;;
96  prof) ;;
97  *)
98  usage
99  exit 1
100 esac
101 
102 # check XCode
103 if [[ `uname -s` == Darwin ]]
104 then
105  OSnum=`uname -r | cut -f1 -d"."`
106  xver=`xcodebuild -version | grep Xcode | cut -f2 -d" " | cut -f1 -d"."`
107  xcver=`xcodebuild -version | grep Xcode`
108  if [[ ${basequal} == e9 ]] && [[ ${xver} < 7 ]] && [[ ${OSnum} > 13 ]]
109  then
110  echo "${basequal} build not supported on `uname -s`${OSnum} with ${xcver}"
111  exit 0
112  fi
113 fi
114 
115 dotver=`echo ${version} | sed -e 's/_/./g' | sed -e 's/^v//'`
116 
117 echo "building the larsoft base distribution for ${version} ${dotver} ${qual_set} ${build_type}"
118 
119 OS=`uname`
120 if [ "${OS}" = "Linux" ]
121 then
122  id=`lsb_release -is`
123  if [ "${id}" = "Ubuntu" ]
124  then
125  flvr=u`lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d"."`
126  else
127  flvr=slf`lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d"."`
128  fi
129 elif [ "${OS}" = "Darwin" ]
130 then
131  flvr=d`uname -r | cut -f1 -d"."`
132 else
133  echo "ERROR: unrecognized operating system ${OS}"
134  exit 1
135 fi
136 echo "build flavor is ${flvr}"
137 echo ""
138 
139 qualdir=`echo ${qual_set} | sed -e 's%:%-%'`
140 
141 set -x
142 
143 blddir=${working_dir}/build
144 srcdir=${working_dir}/source
145 # start with clean directories
146 rm -rf ${blddir}
147 rm -rf ${srcdir}
148 rm -rf $WORKSPACE/copyBack
149 # now make the dfirectories
150 mkdir -p ${srcdir} || exit 1
151 mkdir -p ${blddir} || exit 1
152 mkdir -p $WORKSPACE/copyBack || exit 1
153 
154 cd ${blddir} || exit 1
155 curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/bundles/tools/pullProducts || exit 1
156 chmod +x pullProducts
157 # source code tarballs MUST be pulled first
158 ./pullProducts ${blddir} source lar_product_stack-${version} || \
159  { cat 1>&2 <<EOF
160 ERROR: pull of lar_product_stack-${version} source failed
161 EOF
162  exit 1
163  }
164 ./pullProducts ${blddir} source larbase-${version} || \
165  { cat 1>&2 <<EOF
166 ERROR: pull of larbase-${version} source failed
167 EOF
168  exit 1
169  }
170 ./pullProducts ${blddir} source larsoftobj-${objver} || \
171  { cat 1>&2 <<EOF
172 ERROR: pull of larsoftobj-${objver} source failed
173 EOF
174  exit 1
175  }
176 ./pullProducts ${blddir} source larsoft-${version} || \
177  { cat 1>&2 <<EOF
178 ERROR: pull of larsoft-${version} failed
179 EOF
180  exit 1
181  }
182 mv ${blddir}/*source* ${srcdir}/
183 
184 cd ${blddir} || exit 1
185 echo
186 echo "begin build"
187 echo
188 ${WORKSPACE}/artutilscripts/tools/newBuild -t -b ${basequal} ${blddir} ${build_type} lar_product_stack-${version} || \
189  { mv ${blddir}/*.log $WORKSPACE/copyBack/
190  exit 1
191  }
192 ${WORKSPACE}/artutilscripts/tools/newBuild -t -b ${basequal} -s ${squal} ${blddir} ${build_type} larbase-${version} || \
193  { mv ${blddir}/*.log $WORKSPACE/copyBack/
194  exit 1
195  }
196 ${WORKSPACE}/artutilscripts/tools/newBuild -t -b ${basequal} ${blddir} ${build_type} larsoftobj-${objver} || \
197  { mv ${blddir}/*.log $WORKSPACE/copyBack/
198  exit 1
199  }
200 ${WORKSPACE}/artutilscripts/tools/newBuild -t -b ${basequal} -s ${squal} ${blddir} ${build_type} larsoft-${version} || \
201  { mv ${blddir}/*.log $WORKSPACE/copyBack/
202  exit 1
203  }
204 
205 echo
206 echo "move files"
207 echo
208 mv ${blddir}/*.bz2 $WORKSPACE/copyBack/
209 mv ${blddir}/*.txt $WORKSPACE/copyBack/
210 rm -rf ${srcdir}
211 rm -rf ${blddir}
212 
213 exit 0