@@ -11,13 +11,13 @@ set -o pipefail
1111
1212cleanBuild=false
1313runSpotBugs=false
14- downloadMaps=true
15- downloadNets=true
16- downloadSqlites=true
1714runUnitTests=false
18- dataRetrieval=lfs
1915installClara=false
2016downloadData=false
17+ auxRetrieval=lfs
18+ auxDownloadMaps=true
19+ auxDownloadNets=true
20+ auxDownloadSqlites=true
2121
2222# ###############################################################################
2323# usage
@@ -32,17 +32,18 @@ GENERAL OPTIONS
3232 --no-progress no download progress printouts
3333 --help show this message
3434
35- DATA RETRIEVAL OPTIONS
35+ AUXILIARY DATA RETRIEVAL OPTIONS
3636 How to retrieve magnetic field maps, neural network models, etc.
37- Choose only one; default is `--' $dataRetrieval ' `
37+ Choose only one; default is `--' $auxRetrieval ' `
3838 --lfs use Git Large File Storage (requires `git-lfs`)
3939 --cvmfs use CernVM-FS (requires `/cvfms`)
4040 --https use clasweb HTTPS (field maps only)
41- Additional options
42- --nomaps do not download/overwrite field maps
43- --nonets do not download/overwrite neural networks
44- --nosqlites do not download/overwrite SQLite files for CCDB/RCDB
45- --wipe remove retrieved data
41+ --wipe remove ALL retrieved auxiliary data and exit
42+ Options for disabling downloads:
43+ --no-aux ignore ALL auxiliary data
44+ --no-maps ignore field maps
45+ --no-nets ignore neural networks
46+ --no-sqlites ignore CCDB/RCDB SQLite files
4647
4748TESTING OPTIONS
4849 --spotbugs also run spotbugs plugin
@@ -64,17 +65,8 @@ wgetArgs=()
6465for xx in $@
6566do
6667 case $xx in
67- --spotbugs) runSpotBugs=true ;;
68- -n) runSpotBugs=false ;;
69- --nomaps) downloadMaps=false ;;
70- --nonets) downloadNets=false ;;
71- --nosqlites) downloadSqlites=false ;;
72- --unittests) runUnitTests=true ;;
73- --clean) cleanBuild=true ;;
74- --depana)
75- echo " ERROR: option \` $xx \` has been removed; dependency tree printout and analysis now happen automatically in the Maven build lifecycle" >&2
76- exit 1
77- ;;
68+ --clara) installClara=true ;;
69+ --clean) cleanBuild=true ;;
7870 --quiet)
7971 mvnArgs+=(--quiet --batch-mode)
8072 wgetArgs+=(--quiet)
8375 mvnArgs+=(--no-transfer-progress)
8476 wgetArgs+=(--no-verbose)
8577 ;;
86- --cvmfs) dataRetrieval=cvmfs ;;
87- --lfs) dataRetrieval=lfs ;;
88- --https) dataRetrieval=https ;;
89- --wipe) dataRetrieval=wipe ;;
90- --clara) installClara=true ;;
91- --data) downloadData=true ;;
78+ --lfs) auxRetrieval=lfs ;;
79+ --cvmfs) auxRetrieval=cvmfs ;;
80+ --https) auxRetrieval=https ;;
81+ --wipe) auxRetrieval=wipe ;;
82+ --no-aux|--noaux)
83+ auxDownloadMaps=false
84+ auxDownloadNets=false
85+ auxDownloadSqlites=false
86+ ;;
87+ --no-maps|--nomaps) auxDownloadMaps=false ;;
88+ --no-nets|--nonets) auxDownloadNets=false ;;
89+ --no-sqlites|--nosqlites) auxDownloadSqlites=false ;;
90+ --spotbugs) runSpotBugs=true ;;
91+ -n) runSpotBugs=false ;;
92+ --unittests) runUnitTests=true ;;
93+ --data) downloadData=true ;;
94+ --depana)
95+ echo " ERROR: option \` $xx \` has been removed; dependency tree printout and analysis now happen automatically in the Maven build lifecycle" >&2
96+ exit 1
97+ ;;
9298 --xrootd)
9399 echo " ERROR: option \` $xx \` has been removed; use \` --help\` for guidance" >&2
94100 exit 1
101107 esac
102108done
103109
110+ echo " ---------------------- ARGUMENTS ----------------------"
111+ print_arg () {
112+ printf " %30s = " " $1 "
113+ shift
114+ echo " $@ "
115+ }
116+ print_arg " cleanBuild" " $cleanBuild "
117+ print_arg " runSpotBugs" " $runSpotBugs "
118+ print_arg " runUnitTests" " $runUnitTests "
119+ print_arg " installClara" " $installClara "
120+ print_arg " downloadData" " $downloadData "
121+ print_arg " auxRetrieval" " $auxRetrieval "
122+ print_arg " auxDownloadMaps" " $auxDownloadMaps "
123+ print_arg " auxDownloadNets" " $auxDownloadNets "
124+ print_arg " auxDownloadSqlites" " $auxDownloadSqlites "
125+ print_arg " mvnArgs" " ${mvnArgs[@]:- } "
126+ print_arg " wgetArgs" " ${wgetArgs[@]:- } "
127+ echo " -------------------------------------------------------"
128+
104129
105130# ###############################################################################
106131# setup
@@ -142,20 +167,20 @@ if $cleanBuild; then
142167fi
143168
144169# wipe retrieved data (field maps, NN models, etc.)
145- if [ " $dataRetrieval " = " wipe" ]; then
170+ if [ " $auxRetrieval " = " wipe" ]; then
146171 git submodule deinit --all --force
147172fi
148173
149174# print cleanup note and exit
150- if $cleanBuild || [ " $dataRetrieval " = " wipe" ]; then
151- [ " $dataRetrieval " = " wipe" ] && echo " [+] REMOVED RETRIEVED DATA" || echo " [+] NOTE: retrieved data not removed; use \` --wipe\` if you need to remove them"
175+ if $cleanBuild || [ " $auxRetrieval " = " wipe" ]; then
176+ [ " $auxRetrieval " = " wipe" ] && echo " [+] REMOVED RETRIEVED DATA" || echo " [+] NOTE: retrieved data not removed; use \` --wipe\` if you need to remove them"
152177 $cleanBuild && echo " [+] DONE CLEANING; rerun without \` --clean\` to build"
153178 exit
154179fi
155180
156181
157182# ###############################################################################
158- # download field maps, NN models, etc.
183+ # download auxiliary files
159184# ###############################################################################
160185
161186# check if a command exists
@@ -164,7 +189,7 @@ command_exists () {
164189}
165190
166191# check data-retrieval options, and prepare accordingly
167- case $dataRetrieval in
192+ case $auxRetrieval in
168193 lfs)
169194 if ! command_exists git-lfs ; then
170195 echo ' ERROR: `git-lfs` not found; please install it, or use a different data-retrieval option other than `--lfs`' >&2
@@ -182,7 +207,7 @@ case $dataRetrieval in
182207 https)
183208 ;;
184209 * )
185- echo " ERROR: data retrieval option ' $dataRetrieval ' is not supported" >&2
210+ echo " ERROR: data retrieval option \` -- $auxRetrieval \` is not supported" >&2
186211 exit 1
187212 ;;
188213esac
@@ -202,7 +227,7 @@ download_lfs() {
202227# download a magnetic field map
203228download_map () {
204229 ret=0
205- case $dataRetrieval in
230+ case $auxRetrieval in
206231 cvmfs)
207232 notify_retrieval ' field map' ' cvmfs'
208233 cp $1 ./
@@ -226,23 +251,23 @@ download_map () {
226251 ;;
227252 * )
228253 ret=1
229- echo " ERROR::::::::::: called 'download_map' with bad 'dataRetrieval' ." >&2
254+ echo " ERROR::::::::::: called 'download_map' with bad 'auxRetrieval' option \` -- $auxRetrieval \` ." >&2
230255 ;;
231256 esac
232257 return $ret
233258}
234259
235260# download the default field maps, as defined in libexec/env.sh:
236261# (and duplicated in etc/services/reconstruction.yaml):
237- if $downloadMaps ; then
238- case $dataRetrieval in
262+ if $auxDownloadMaps ; then
263+ case $auxRetrieval in
239264 lfs)
240265 notify_retrieval ' field maps' ' lfs'
241266 download_lfs etc/data/magfield
242267 ;;
243268 cvmfs|https)
244269 webDir=https://clasweb.jlab.org/clas12offline/magfield
245- if [ " $dataRetrieval " = " cvmfs" ]; then
270+ if [ " $auxRetrieval " = " cvmfs" ]; then
246271 webDir=/cvmfs/oasis.opensciencegrid.org/jlab/hallb/clas12/sw/noarch/data/magfield
247272 fi
248273 mkdir -p $magfield_dir
@@ -253,22 +278,22 @@ if $downloadMaps; then
253278 if [ $? -ne 0 ]; then
254279 echo " ERROR::::::::::: Could not download field map:" >&2
255280 echo " $webDir /$map " >&2
256- echo " One option is to download manually into etc/data/magfield and then run this build script with --nomaps " >&2
281+ echo " One option is to download manually into \` etc/data/magfield\` and then run this build script with \` --no-maps \` " >&2
257282 exit 1
258283 fi
259284 done
260285 cd -
261286 ;;
262287 * )
263- echo " ERROR: data retrieval option ' $dataRetrieval ' not supported for field maps" >&2
288+ echo " ERROR: data retrieval option \` -- $auxRetrieval \` not supported for field maps" >&2
264289 exit 1
265290 ;;
266291 esac
267292fi
268293
269294# download neural networks
270- if $downloadNets ; then
271- case $dataRetrieval in
295+ if $auxDownloadNets ; then
296+ case $auxRetrieval in
272297 lfs)
273298 notify_retrieval ' neural networks' ' lfs'
274299 download_lfs etc/data/nnet
@@ -285,8 +310,8 @@ if $downloadNets; then
285310fi
286311
287312# download neural networks
288- if $downloadSqlites ; then
289- case $dataRetrieval in
313+ if $auxDownloadSqlites ; then
314+ case $auxRetrieval in
290315 lfs)
291316 notify_retrieval ' ccdb/rcdb SQLite files' ' lfs'
292317 download_lfs etc/data/sqlite
299324
300325# download validation data
301326if $downloadData ; then
302- case $dataRetrieval in
327+ case $auxRetrieval in
303328 lfs)
304329 notify_retrieval ' validation data' ' lfs'
305330 download_lfs validation/advanced-tests/data
0 commit comments