3 echo inside garana build script
8 PROJECT_SOURCE_GIT_PREFIX=${PROJECT_SOURCE_GIT_PREFIX:-'https://github.com/DUNE'}
9 PRODUCTS=${PRODUCTS:-'/cvmfs/larsoft.opensciencegrid.org/products/root'}
11 ROOT_VERSION=${ROOT_VERSION:-"v6_22_06"}
14 PRODUCTS=$(for d in $(echo $PRODUCTS | tr ":" " "); do [[ -d $d ]] && echo -n "$d:"; done)
15 PRODUCTS=${PRODUCTS::-1}
18 PROJECT_SOURCE_GIT=${PROJECT_SOURCE_GIT:-${PROJECT_SOURCE_GIT_PREFIX}/${PROJECT_NAME}$( [[ ${PROJECT_SOURCE_GIT_PREFIX} =~ github ]] && echo ".git")}
22 Usage: $(basename ${0}) [-h]
23 $(basename ${0}) <branchtag> <qual_set> <buildtype>
24 WORKSPACE=<workspace> BRANCHTAG=<develop|master|vN_NN_NN> QUAL=<qualifiers> BUILDTYPE=<debug|prof> $(basename ${0})
30 while getopts :h OPT; do
41 shift $(expr $OPTIND - 1)
45 working_dir="${WORKSPACE:-$(pwd)}"
46 branchtag="${1:-${BRANCHTAG}}"
47 qual_set="${2:-${QUAL}}"
48 build_type="${3:-${BUILDTYPE}}"
50 IFS=':' read -r -a quals <<< "$qual_set"
52 for onequal in "${quals[@]}"; do
54 e[679]|e1[0-9]|c[0-9])
61 echo "ERROR: unsupported build qualifier \"${onequal}\""
68 qual_set="${basequal}"
69 [[ ! -z "${pyqual+x}" ]] && qual_set="${qual_set}:${pyqual}"
70 qual_set="${qual_set}:${squal}"
72 manifest_qual_set="${squal}:${basequal}"
73 [[ ! -z "${pyqual+x}" ]] && manifest_qual_set="${manifest_qual_set}:${pyqual}"
76 debug) build_type_flag="-d" ;;
77 prof) build_type_flag="-p" ;;
79 echo "ERROR: build type must be debug or prof"
86 # Find platform flavor.
88 if [ "${OS}" = "Linux" ]
91 if [ "${id}" = "Ubuntu" ]
93 flvr=u$(lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d".")
95 flvr=slf$(lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d".")
98 echo "ERROR: unrecognized operating system ${OS}"
103 echo "build variables"
104 echo " working_dir=${working_dir}"
105 echo " branchtag=${branchtag}"
106 echo " qual_set=${qual_set}"
107 echo " build_type=${build_type}"
113 product_name=${PROJECT_NAME//-/_}
115 src_dir=${working_dir}/source
116 build_dir=${working_dir}/build
117 products_dir=${working_dir}/products
118 copyback_dir=${working_dir}/copyBack
122 # start with clean directories
125 rm -rf ${copyback_dir}
126 # now make the dfirectories
127 mkdir -p ${src_dir} || exit 1
128 mkdir -p ${build_dir} || exit 1
129 mkdir -p ${copyback_dir} || exit 1
134 echo "checkout source"
136 cd ${src_dir} || exit 1
137 git clone ${PROJECT_SOURCE_GIT} ${product_name}
138 cd ${product_name} || exit 1
139 git checkout ${branchtag}
144 echo "pull products from scisoft"
147 [[ ! -d ${products_dir} ]] && mkdir -p ${products_dir}
148 cd ${products_dir} || exit 1
149 curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/bundles/tools/pullProducts || exit 1
150 curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/bundles/tools/pullPackage || exit 1
151 chmod +x pullProducts pullPackage
152 ./pullProducts ${products_dir} ${flvr} root-${root_version} ${manifest_qual_set//:/-} ${build_type} 2>&1 |tee ${products_dir}/pullproducts.log
154 ./pullPackage ${products_dir} sl7 python-v3_7_2 2>&1 |tee -a ${products_dir}/pullProducts.log
157 echo "generate manifest using product_deps and pull products from scisoft"
160 source ${products_dir}/setup || exit 1
164 [[ -d ${python3env_dir} ]] && rm -rf ${python3env_dir}
165 python3 -m venv ${python3env_dir}
166 source ${python3env_dir}/bin/activate
167 pip install --upgrade pip
170 local_manifest=${product_name}-current-Linux64bit+3.10-2.17-${manifest_qual_set//:/-}-${build_type}_MANIFEST.txt
172 python3 ${src_dir}/${product_name}/for-jenkins/generate-manifest.py \
173 -p ${src_dir}/${product_name}/ups/product_deps \
174 -m ${products_dir}/${local_manifest} \
175 -q ${qual_set}:${build_type}
177 #sed -i '/windriver/d' ${products_dir}/${local_manifest}
179 cd ${products_dir} || exit 1
181 ./pullProducts -l ${products_dir} ${flvr} ${product_name}-current ${manifest_qual_set//:/-} ${build_type} 2>&1 |tee -a ${products_dir}/pullproducts.log
184 table_qual_set="+${qual_set//:/+:}+:${build_type}"
187 cat ${products_dir}/garana/*/ups/garana.table | \
188 sed -n '/+e19:+prof/,/^$/p' | \
189 sed 's/setupRequired(/.\/pullPackage ${products_dir} sl7 /g' | \
190 sed 's/)//g;s/+//g;s/^[ \t]*//;s/[ \t]*$//;/^\s*$/d;s/:/-/g;s/-q//g;s/\(.*\)-/\1 /'| \
192 sed 's/ v/-v/g' | bash
197 product_version=$(cat ${src_dir}/${product_name}/ups/product_deps | grep -E "^parent.*${product_name}.*v.*"| grep -Eo "v[0-9]_[0-9]{2}_[0-9]{2}.*")
198 echo "building the ${product_name} distribution for ${product_version} ${qual_set} ${build_type}"
200 [[ -d ${build_dir} ]] && rm -rf ${build_dir}
201 [[ ! -d ${build_dir} ]] && mkdir -p ${build_dir}
202 cd ${build_dir} || exit 1
203 source ${products_dir}/setup || exit 1
204 source ${src_dir}/${product_name}/ups/setup_for_development ${build_type_flag} ${qual_set//:/ }
205 export MRB_QUALS="${qual_set}:${build_type}"
206 previnstall_dir=${products_dir}/${product_name}/${product_version}
207 [[ -d ${previnstall_dir} ]] && rm -rf ${previnstall_dir}{,version}
209 buildtool -I "${products_dir}" -pi -j$(nproc) 2>&1 | tee ${build_dir}/build-${product_name}.log || \
210 { mv ${build_dir}/*.log ${copyback_dir}/
214 buildtool -t -j$(nproc) 2>&1 | tee ${build_dir}/test-${product_name}.log || \
215 { mv ${build_dir}/*.log ${copyback_dir}/
222 mv ${build_dir}/{*.bz2,*.log} ${copyback_dir}/
223 mv ${products_dir}/*.log ${copyback_dir}/
230 rm -rf "${build_dir}"