Browse code

Continue rewrite of fetch system and adapt all tests to it.

Nat! authored on 22-08-2017 18:12:21
Showing 53 changed files
... ...
@@ -46,6 +46,7 @@ src/mulle-bootstrap-dependency-resolve.sh
46 46
 src/mulle-bootstrap-fetch.sh
47 47
 src/mulle-bootstrap-functions.sh
48 48
 src/mulle-bootstrap-gcc.sh
49
+src/mulle-bootstrap-git.sh
49 50
 src/mulle-bootstrap-init.sh
50 51
 src/mulle-bootstrap-local-environment.sh
51 52
 src/mulle-bootstrap-logging.sh
... ...
@@ -76,6 +77,15 @@ src/mulle-bootstrap-build-plugins/xcodebuild.sh
76 77
 )
77 78
 
78 79
 
80
+set( SCM_PLUGIN_SCRIPTS
81
+src/mulle-bootstrap-scm-plugins/git.sh
82
+src/mulle-bootstrap-scm-plugins/svn.sh
83
+src/mulle-bootstrap-scm-plugins/symlink.sh
84
+src/mulle-bootstrap-scm-plugins/tar.sh
85
+src/mulle-bootstrap-scm-plugins/zip.sh
86
+)
87
+
88
+
79 89
 INSTALL( FILES ${SCRIPTS}
80 90
 PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
81 91
             GROUP_EXECUTE GROUP_READ
... ...
@@ -98,6 +108,12 @@ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
98 108
             WORLD_EXECUTE WORLD_READ
99 109
 DESTINATION "libexec/mulle-bootstrap/mulle-bootstrap-build-plugins")
100 110
 
111
+INSTALL( FILES ${SCM_PLUGIN_SCRIPTS}
112
+PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
113
+            GROUP_EXECUTE GROUP_READ
114
+            WORLD_EXECUTE WORLD_READ
115
+DESTINATION "libexec/mulle-bootstrap/mulle-bootstrap-scm-plugins")
116
+
101 117
 #
102 118
 # CPack and project specific stuff
103 119
 #
... ...
@@ -209,6 +209,13 @@ main()
209 209
       install -v -m "${mode}" "${i}" "${PLUGIN_DIR}" || exit 1
210 210
    done
211 211
 
212
+   PLUGIN_DIR="${libexec}/mulle-bootstrap-scm-plugins"
213
+   for i in src/mulle-bootstrap-scm-plugins/*.sh
214
+   do
215
+      mkdir -p "${PLUGIN_DIR}" 2> /dev/null
216
+      install -v -m "${mode}" "${i}" "${PLUGIN_DIR}" || exit 1
217
+   done
218
+
212 219
    if [ -d "test" ]
213 220
    then
214 221
       # use attractive colors :)
... ...
@@ -29,15 +29,15 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 #
32
-MULLE_EXECUTABLE_VERSION_MAJOR=3
33
-MULLE_EXECUTABLE_VERSION_MINOR=11
32
+MULLE_EXECUTABLE_VERSION_MAJOR=4
33
+MULLE_EXECUTABLE_VERSION_MINOR=0
34 34
 MULLE_EXECUTABLE_VERSION_PATCH=0
35 35
 
36 36
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
37 37
 
38 38
 
39 39
 MULLE_EXECUTABLE_FUNCTIONS_MIN="3.9"
40
-MULLE_EXECUTABLE_FUNCTIONS_MAX="4"
40
+MULLE_EXECUTABLE_FUNCTIONS_MAX="5"
41 41
 
42 42
 
43 43
 #
... ...
@@ -264,6 +264,7 @@ bootstrap_libexec_path()
264 264
 bootstrap_init()
265 265
 {
266 266
    MULLE_BOOTSTRAP_LIBEXEC_PATH="`bootstrap_libexec_path "$0"`"
267
+
267 268
    if [ -z "${MULLE_BOOTSTRAP_LIBEXEC_PATH}" ]
268 269
    then
269 270
       echo "Fatal Error: Could not find libexec for ${MULLE_EXECUTABLE} ($PWD)" >&2
... ...
@@ -284,7 +285,7 @@ bootstrap_init()
284 285
    #
285 286
    case "${1}" in
286 287
       library-path)
287
-         echo "${libexecpath}"
288
+         echo "${MULLE_BOOTSTRAP_LIBEXEC_PATH}"
288 289
          exit 0
289 290
       ;;
290 291
 
... ...
@@ -551,7 +552,7 @@ bootstrap_main()
551 552
       ;;
552 553
 
553 554
       git)
554
-         . mulle-bootstrap-scm.sh
555
+         . mulle-bootstrap-git.sh
555 556
 
556 557
          git_main "$@" || exit 1
557 558
       ;;
... ...
@@ -695,7 +696,6 @@ export MULLE_EXECUTABLE_PID
695 696
 
696 697
 bootstrap_init "$@" # needs params
697 698
 
698
-
699 699
 main()
700 700
 {
701 701
    if ! bootstrap_main "$@"
... ...
@@ -568,8 +568,9 @@ bootstrap_auto_final()
568 568
    local name
569 569
    local url
570 570
    local branch
571
-   local scm
572 571
    local tag
572
+   local scm
573
+   local scmoptions
573 574
    local stashdir
574 575
 
575 576
    local clone
... ...
@@ -105,7 +105,7 @@ fetch_brew_if_needed()
105 105
       fail "brew was not successfully installed (PATH=$PATH)"
106 106
    fi
107 107
 
108
-   if 1
108
+   if :
109 109
    then
110 110
       "${BREW}" update
111 111
    fi
... ...
@@ -583,7 +583,6 @@ brew_initialize()
583 583
 
584 584
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
585 585
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ]         && . mulle-bootstrap-functions.sh
586
-   [ -z "${MULLE_BOOTSTRAP_SCM_SH}" ]               && . mulle-bootstrap-scm.sh
587 586
 
588 587
    BREW="${ADDICTIONS_DIR}/bin/brew"
589 588
 
... ...
@@ -231,7 +231,6 @@ test_autoconf()
231 231
          return 1
232 232
       fi
233 233
    fi
234
-   projectfile="${srcdir}/${projectfile}"
235 234
    projectdir="`dirname -- "${projectfile}"`"
236 235
 
237 236
    tools_environment_autoconf "${name}" "${projectdir}"
... ...
@@ -356,7 +356,6 @@ test_cmake()
356 356
       log_fluff "There is no CMakeLists.txt file in \"${srcdir}\""
357 357
       return 1
358 358
    fi
359
-   projectfile="${srcdir}/${projectfile}"
360 359
    projectdir="`dirname -- "${projectfile}"`"
361 360
 
362 361
    tools_environment_cmake "${name}" "${projectdir}"
... ...
@@ -372,6 +371,8 @@ test_cmake()
372 371
       fail "No make available"
373 372
    fi
374 373
 
374
+   log_verbose "Found cmake project file \"${projectfile}\""
375
+
375 376
    PROJECTFILE="${projectfile}"
376 377
 
377 378
    return 0
... ...
@@ -238,7 +238,6 @@ test_configure()
238 238
       log_fluff "There is no configure project in \"${srcdir}\""
239 239
       return 1
240 240
    fi
241
-   projectfile="${srcdir}/${projectfile}"
242 241
    projectdir="`dirname -- "${projectfile}"`"
243 242
 
244 243
    if ! [ -x "${projectdir}/configure" ]
... ...
@@ -44,11 +44,11 @@ build_script()
44 44
    log_entry "build_script" "$@"
45 45
 
46 46
    local script="$1"
47
-   local configuration="$1"
48
-   local srcdir="$2"
49
-   local builddir="$3"
50
-   local name="$4"
51
-   local sdk="$5"
47
+   local configuration="$2"
48
+   local srcdir="$3"
49
+   local builddir="$4"
50
+   local name="$5"
51
+   local sdk="$6"
52 52
 
53 53
    local project
54 54
    local schemename
... ...
@@ -485,7 +485,6 @@ test_xcodebuild()
485 485
          log_fluff "There is no Xcode project in \"${srcdir}\""
486 486
          return 1
487 487
       fi
488
-      projectfile="${srcdir}/${projectfile}"
489 488
    fi
490 489
    projectdir="`dirname -- "${projectfile}"`"
491 490
 
... ...
@@ -1086,9 +1086,11 @@ install_tars()
1086 1086
 
1087 1087
 build_main()
1088 1088
 {
1089
+   log_entry "build_main" "$@"
1090
+
1089 1091
    local  clean
1090 1092
 
1091
-   log_entry "::: build begin :::" "$@"
1093
+   log_debug "::: build begin :::"
1092 1094
 
1093 1095
    [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
1094 1096
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]        && . mulle-bootstrap-settings.sh
... ...
@@ -89,13 +89,15 @@ _collect_stashdir()
89 89
 {
90 90
    log_debug ":_collect_stashdir:" "$*"
91 91
 
92
-   # local reposdir="$1"  # ususally .bootstrap.repos
93
-   # local name="$2"      # name of the clone
94
-   # local url="$3"       # URL of the clone
95
-   # local branch="$4"    # branch of the clone
96
-   # local scm="$5"       # scm to use for this clone
97
-   # local tag="$6"       # tag to checkout of the clone
98
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
92
+   # local reposdir="$1"     # ususally .bootstrap.repos
93
+   # local name="$2"         # name of the clone
94
+   # local url="$3"          # URL of the clone
95
+   # local branch="$4"       # branch of the clone
96
+   # local tag="$5"          # tag to checkout of the clone
97
+   # local scm="$6"          # scm to use for this clone
98
+   # local scmoptions="$7"   # options to use on scm
99
+
100
+   local stashdir="$8"  # stashdir of this clone (absolute or relative to $PWD)
99 101
 
100 102
    is_minion_bootstrap_project "${stashdir}" && return
101 103
 
... ...
@@ -157,13 +159,14 @@ print_stashdir_deep_embedded_minion_repositories()
157 159
 
158 160
 _collect_embedded_stashdir()
159 161
 {
160
-   # local reposdir="$1"  # ususally .bootstrap.repos
161
-   # local name="$2"      # name of the clone
162
-   # local url="$3"       # URL of the clone
163
-   # local branch="$4"    # branch of the clone
164
-   # local scm="$5"       # scm to use for this clone
165
-   # local tag="$6"       # tag to checkout of the clone
166
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
162
+#   local reposdir="$1"     # ususally .bootstrap.repos
163
+#   local name="$2"         # name of the clone
164
+#   local url="$3"          # URL of the clone
165
+#   local branch="$4"       # branch of the clone
166
+#   local tag="$5"          # tag to checkout of the clone
167
+#   local scm="$6"          # scm to use for this clone
168
+#   local scmoptions="$7"   # options to use on scm
169
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
167 170
 
168 171
    stashparentdir="`dirname -- "${stashdir}"`"
169 172
 
... ...
@@ -95,6 +95,7 @@ defer_main()
95 95
 
96 96
    local masterpath
97 97
    local minionpath
98
+   local masterversion
98 99
 
99 100
    minionpath="${PWD}"
100 101
    minionpath="`absolutepath "${minionpath}"`"
... ...
@@ -134,6 +135,20 @@ defer_main()
134 135
       fail "\"${masterpath}\" contains a .bootstrap folder. It can't be used as a master"
135 136
    fi
136 137
 
138
+   if is_master_bootstrap_project "${masterpath}"
139
+   then
140
+      masterversion="`get_master_bootstrap_version "${masterpath}"`"
141
+      if [ -z "${masterversion}" ]
142
+      then
143
+         fail "Minion \"${minionpath}\" can not acquire version of master at \"${masterpath}\""
144
+      fi
145
+
146
+      if [ "${masterversion}" != "${MULLE_EXECUTABLE_VERSION_MAJOR}" ]
147
+      then
148
+         fail "Minion \"${minionpath}\" version ${MULLE_EXECUTABLE_VERSION_MAJOR} mismatch with master at \"${masterpath}\" having version ${masterversion}"
149
+      fi
150
+   fi
151
+
137 152
    if master_owns_minion_bootstrap_project "${masterpath}" "${minionpath}"
138 153
    then
139 154
       if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NONE" ]
... ...
@@ -48,9 +48,10 @@ MULLE_BOOTSTRAP_FETCH_SH="included"
48 48
 # name="$2"       # name of the clone
49 49
 # url="$3"        # URL of the clone
50 50
 # branch="$4"     # branch of the clone
51
-# scm="$5"        # scm to use for this clone
52
-# tag="$6"        # tag to checkout of the clone
53
-# stashdir="$7"     # stashdir of this clone (absolute or relative to $PWD)
51
+# tag="$5"        # tag to checkout of the clone
52
+# scm="$6"        # scm to use for this clone
53
+# scmoptions="$7" # scmoptions
54
+# stashdir="$8"   # stashdir of this clone (absolute or relative to $PWD)
54 55
 #
55 56
 
56 57
 fetch_usage()
... ...
@@ -112,6 +113,8 @@ assert_sane_parameters()
112 113
 #
113 114
 check_tars()
114 115
 {
116
+   log_entry "check_tars" "$@"
117
+
115 118
    local tarballs
116 119
    local tar
117 120
 
... ...
@@ -145,13 +148,14 @@ log_action()
145 148
 {
146 149
    local action="$1" ; shift
147 150
 
148
-   local reposdir="$1"  # ususally .bootstrap.repos
149
-   local name="$2"      # name of the clone
150
-   local url="$3"       # URL of the clone
151
-   local branch="$4"    # branch of the clone
152
-   local scm="$5"       # scm to use for this clone
153
-   local tag="$6"       # tag to checkout of the clone
154
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
151
+   local reposdir="$1"     # ususally .bootstrap.repos
152
+   local name="$2"         # name of the clone
153
+   local url="$3"          # URL of the clone
154
+   local branch="$4"       # branch of the clone
155
+   local tag="$5"          # tag to checkout of the clone
156
+   local scm="$6"          # scm to use for this clone
157
+   local scmoptions="$7"   # options to use on scm
158
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
155 159
 
156 160
    assert_sane_parameters "empty reposdir is ok"
157 161
 
... ...
@@ -171,52 +175,15 @@ log_action()
171 175
 #
172 176
 ###
173 177
 #
174
-link_command()
175
-{
176
-#   local reposdir="$1"  # ususally .bootstrap.repos
177
-#   local name="$2"      # name of the clone
178
-   local url="$3"       # URL of the clone
179
-   local branch="$4"    # branch of the clone
180
-#   local scm="$5"       # scm to use for this clone
181
-   local tag="$6"       # tag to checkout of the clone
182
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
183
-
184
-   assert_sane_parameters "empty reposdir is ok"
185
-
186
-   local absolute
187
-
188
-   absolute="`read_config_setting "absolute_symlinks" "NO"`"
189
-   if ! exekutor create_symlink "${url}" "${stashdir}" "${absolute}"
190
-   then
191
-      return 1
192
-   fi
193
-
194
-   local branchlabel
195
-
196
-   branchlabel="branch"
197
-   if [ -z "${branch}" -a ! -z "${tag}" ]
198
-   then
199
-      branchlabel="tag"
200
-      branch="${tag}"
201
-   fi
202
-
203
-   if [ "${branch}" != "master" ]
204
-   then
205
-      log_warning "The intended ${branchlabel} ${C_RESET_BOLD}${branch}${C_WARNING} \
206
-will be ignored, because the repository is symlinked.
207
-If you want to checkout this ${branchlabel} do:
208
-   ${C_RESET_BOLD}(cd ${stashdir}; git checkout ${GITOPTIONS} \"${branch}\" )${C_WARNING}"
209
-   fi
210
-}
211
-
212
-
213 178
 can_symlink_it()
214 179
 {
215
-   local  directory="$1"
180
+   log_entry "can_symlink_it" "$@"
181
+
182
+   local directory="$1"
216 183
 
217 184
    if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" != "YES" ]
218 185
    then
219
-      log_fluff "Can't symlink it, because forbidden"
186
+      log_fluff "Can't symlink it, because it's been forbidden to create symlinks"
220 187
       return 1
221 188
    fi
222 189
 
... ...
@@ -244,179 +211,6 @@ So symlinking is the only way to go."
244 211
 }
245 212
 
246 213
 
247
-_git_search_local()
248
-{
249
-   log_entry "_git_search_local" "$@"
250
-
251
-   local directory="$1"
252
-   local name="$2"
253
-   local branch="$3"
254
-
255
-   [ $# -ne 3 ] && internal_fail "fail"
256
-
257
-   local found
258
-
259
-   if [ "${MULLE_FLAG_LOG_LOCALS}" = "YES" ]
260
-   then
261
-      log_trace "Checking local path \"${directory}\""
262
-   fi
263
-
264
-   if [ ! -z "${branch}" ]
265
-   then
266
-      found="${directory}/${name}.${branch}"
267
-      log_fluff "Looking for \"${found}\""
268
-
269
-      if [ -d "${found}" ]
270
-      then
271
-         log_fluff "Found \"${name}.${branch}\" in \"${directory}\""
272
-
273
-         echo "${found}"
274
-         return
275
-      fi
276
-   fi
277
-
278
-   found="${directory}/${name}.git"
279
-   log_fluff "Looking for \"${found}\""
280
-   if [ -d "${found}" ]
281
-   then
282
-      log_fluff "Found \"${name}.git\" in \"${directory}\""
283
-
284
-      echo "${found}"
285
-      return
286
-   fi
287
-
288
-   found="${directory}/${name}"
289
-   log_fluff "Looking for \"${found}\""
290
-   if [ -d "${found}" ]
291
-   then
292
-      log_fluff "Found \"${name}\" in \"${directory}\""
293
-
294
-      echo "${found}"
295
-      return
296
-   fi
297
-}
298
-
299
-
300
-git_search_local()
301
-{
302
-   log_entry "git_search_local [${LOCAL_PATH}]" "$@"
303
-
304
-   local name="$1"
305
-   local branch="$2"
306
-#   local url="$3"
307
-
308
-   local found
309
-   local directory
310
-   local realdir
311
-   local curdir
312
-
313
-   if [ "${MULLE_FLAG_LOG_LOCAL}" = "YES" -a -z "${LOCAL_PATH}" ]
314
-   then
315
-      log_trace "LOCAL_PATH is empty"
316
-   fi
317
-
318
-   curdir="`pwd -P`"
319
-   IFS=":"
320
-   for directory in ${LOCAL_PATH}
321
-   do
322
-      IFS="${DEFAULT_IFS}"
323
-
324
-      if [ ! -d "${directory}" ]
325
-      then
326
-         if [ "${MULLE_FLAG_LOG_LOCALS}" = "YES" ]
327
-         then
328
-            log_trace2 "Local path \"${realdir}\" does not exist"
329
-         fi
330
-         continue
331
-      fi
332
-
333
-      realdir="`realpath "${directory}"`"
334
-      if [ "${realdir}" = "${curdir}" ]
335
-      then
336
-         fail "Config setting \"search_path\" mistakenly contains \"${directory}\", which is the current directory"
337
-      fi
338
-
339
-      found="`_git_search_local "${realdir}" "${name}" "${branch}"`" || exit 1
340
-      if [ ! -z "${found}" ]
341
-      then
342
-         echo "${found}"
343
-         return
344
-      fi
345
-   done
346
-
347
-   IFS="${DEFAULT_IFS}"
348
-   return 1
349
-}
350
-
351
-
352
-_archive_search_local()
353
-{
354
-   log_entry "_archive_search_local" "$@"
355
-
356
-   local directory="$1"
357
-   local name="$2"
358
-   local filename="$3"
359
-
360
-   [ $# -ne 3 ] && internal_fail "fail"
361
-
362
-   local found
363
-
364
-   found="${directory}/${name}-${filename}"
365
-   log_fluff "Looking for \"${found}\""
366
-   if [ -f "${found}" ]
367
-   then
368
-      log_fluff "Found \"${name}\" in \"${directory}\" as \"${found}\""
369
-
370
-      echo "${found}"
371
-      return
372
-   fi
373
-
374
-   found="${directory}/${filename}"
375
-   log_fluff "Looking for \"${found}\""
376
-   if [ -f "${found}" ]
377
-   then
378
-      log_fluff "Found \"${name}\" in \"${directory}\" as \"${found}\""
379
-
380
-      echo "${found}"
381
-      return
382
-   fi
383
-}
384
-
385
-
386
-archive_search_local()
387
-{
388
-   log_entry "archive_search_local" "$@"
389
-
390
-   local name="$1"
391
-#   local branch="$2"
392
-   local url="$3"
393
-
394
-   local  filename
395
-
396
-   filename="`basename -- "${url}"`"
397
-
398
-   local found
399
-   local directory
400
-
401
-   IFS=":"
402
-   for directory in ${LOCAL_PATH}
403
-   do
404
-      IFS="${DEFAULT_IFS}"
405
-
406
-      found="`_archive_search_local "${directory}" "${name}" "${filename}"`" || exit 1
407
-      if [ ! -z "${found}" ]
408
-      then
409
-         found="`absolutepath "${found}"`"
410
-         echo "file:///${found}"
411
-         return
412
-      fi
413
-   done
414
-
415
-   IFS="${DEFAULT_IFS}"
416
-   return 1
417
-}
418
-
419
-
420 214
 mkdir_stashparent_if_missing()
421 215
 {
422 216
    local stashdir="$1"
... ...
@@ -438,13 +232,16 @@ mkdir_stashparent_if_missing()
438 232
 
439 233
 get_local_item()
440 234
 {
441
-   local reposdir="$1"  # ususally .bootstrap.repos
442
-   local name="$2"      # name of the clone, extensionless
443
-   local url="$3"       # URL of the clone
444
-   local branch="$4"    # branch of the clone
445
-   local scm="$5"       # scm to use for this clone
446
-   local tag="$6"       # tag to checkout of the clone
447
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
235
+   log_entry "get_local_item" "$@"
236
+
237
+   local reposdir="$1"     # ususally .bootstrap.repos
238
+   local name="$2"         # name of the clone
239
+   local url="$3"          # URL of the clone
240
+   local branch="$4"       # branch of the clone
241
+   local tag="$5"          # tag to checkout of the clone
242
+   local scm="$6"          # scm to use for this clone
243
+   local scmoptions="$7"   # options to use on scm
244
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
448 245
 
449 246
    if [ "${OPTION_ALLOW_SEARCH_LOCALS}" = "NO" ]
450 247
    then
... ...
@@ -452,82 +249,96 @@ get_local_item()
452 249
       return
453 250
    fi
454 251
 
455
-   case "${scm}" in
456
-      git*)
457
-         git_search_local "${name}" "${branch}" "${url}"
458
-      ;;
252
+   local operation
459 253
 
460
-      tar*|zip*)
461
-         archive_search_local "${name}" "${branch}" "${url}"
462
-      ;;
254
+   operation="`get_scm_function "${scm}" "search_local"`"
463 255
 
464
-      *)
465
-         log_fluff "Not searching caches because scm is \"${scm}\""
466
-      ;;
467
-   esac
256
+   if [ ! -z "${operation}" ]
257
+   then
258
+      "${operation}" "${url}" "${name}" "${branch}"
259
+   else
260
+      log_fluff "Not searching caches because scm \"${scm}\" does not support \"${operation}\""
261
+   fi
468 262
 }
469 263
 
470 264
 
471
-clone_or_symlink()
265
+do_operation()
472 266
 {
473
-   local reposdir="$1"  # ususally .bootstrap.repos
474
-   local name="$2"      # name of the clone, extensionless
475
-   local url="$3"       # URL of the clone
476
-   local branch="$4"    # branch of the clone
477
-   local scm="$5"       # scm to use for this clone
478
-   local tag="$6"       # tag to checkout of the clone
479
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
267
+   log_entry "do_operation" "$@"
480 268
 
269
+   local opname="$1" ; shift
481 270
 
482
-   assert_sane_parameters "empty reposdir is ok"
271
+   [ -z "${opname}" ] && internal_fail "operation is empty"
483 272
 
484
-   [ $# -le 7 ] || internal_fail "too many parameters"
273
+   log_action "${opname}" "$@"
485 274
 
486
-   local operation
487
-   local scmflagsdefault
275
+#   local reposdir="$1"     # ususally .bootstrap.repos
276
+   local name="$2"         # name of the clone
277
+#   local url="$3"          # URL of the clone
278
+#   local branch="$4"       # branch of the clone
279
+#   local tag="$5"          # tag to checkout of the clone
280
+   local scm="$6"          # scm to use for this clone
281
+#   local scmoptions="$7"   # options to use on scm
282
+#   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
488 283
 
489
-   case "${scm}" in
490
-      git*)
491
-         operation="git_clone"
492
-      ;;
284
+   [ -z "${scm}" ] && internal_fail "scm is empty"
493 285
 
494
-      svn*)
495
-         operation="svn_checkout"
496
-      ;;
286
+   script="`find_build_setting_file "${name}" "bin/${opname}.sh"`"
287
+   if [ ! -z "${script}" ]
288
+   then
289
+      run_script "${script}" "@"
290
+      return $?
291
+   fi
292
+
293
+   scm_operation "${opname}" "$@"
497 294
 
498
-      zip*)
499
-         operation="zip_unpack"
295
+   case $? in
296
+      0)
500 297
       ;;
501 298
 
502
-      tar*)
503
-         operation="tar_unpack"
299
+      111)
300
+         fail "SCM \"${scm}\" does not support ${opname}"
504 301
       ;;
505 302
 
506 303
       *)
507
-         fail "Unknown scm system \"${scm}\""
304
+         fail "SCM \"${scm}\" ${opname} failed for \"${name}\""
508 305
       ;;
509 306
    esac
307
+}
308
+
309
+##
310
+## CLONE
311
+##
312
+clone_or_symlink()
313
+{
314
+   log_entry "clone_or_symlink" "$@"
315
+
316
+   local reposdir="$1"     # ususally .bootstrap.repos
317
+   local name="$2"         # name of the clone
318
+   local url="$3"          # URL of the clone
319
+   local branch="$4"       # branch of the clone
320
+   local tag="$5"          # tag to checkout of the clone
321
+   local scm="$6"          # scm to use for this clone
322
+   local scmoptions="$7"   # options to use on scm
323
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
324
+
325
+   assert_sane_parameters "empty reposdir is ok"
326
+
327
+   [ $# -le 8 ] || internal_fail "too many parameters"
510 328
 
511 329
    local stashparent
330
+   local operation
512 331
 
513 332
    stashparent="`mkdir_stashparent_if_missing "${stashdir}"`"
514 333
 
515 334
    local found
516
-   local script
517
-
518
-   script="`find_root_setting_file "bin/clone.sh"`"
519
-
520
-   if [ ! -z "${script}" ]
521
-   then
522
-      run_script "${script}" "$@"
523
-      return $?
524
-   fi
335
+   local rval
525 336
 
526 337
    case "${url}" in
527 338
       /*)
528 339
          if can_symlink_it "${directory}"
529 340
          then
530
-            operation=link_command
341
+            scm="symlink"
531 342
          fi
532 343
       ;;
533 344
 
... ...
@@ -539,56 +350,50 @@ clone_or_symlink()
539 350
       ;;
540 351
 
541 352
       *)
542
-         found="`get_local_item "${reposdir}" \
543
-                                "${name}" \
544
-                                "${url}" \
545
-                                "${branch}" \
546
-                                "${scm}" \
547
-                                "${tag}" \
548
-                                "${stashdir}"`"
353
+         found="`get_local_item "$@"`"
549 354
 
550 355
          if [ ! -z "${found}" ]
551 356
          then
357
+            log_verbose "Using local item \"${found}\""
552 358
             url="${found}"
553 359
 
554 360
             case "${scm}" in
555
-               git*)
361
+               "git")
556 362
                   if can_symlink_it "${url}"
557 363
                   then
558
-                     operation=link_command
364
+                     scm="symlink"
365
+                     log_verbose "Using symlink to local item \"${found}\""
366
+                     url="`symlink_relpath "${url}" "${ROOT_DIR}"`"
559 367
                   fi
560 368
                ;;
561 369
             esac
562
-
563
-            case "${operation}" in
564
-               link_command)
565
-                 log_verbose "Using symlink to local item \"${found}\""
566
-
567
-                 # compatible to earlier code
568
-                 found="`symlink_relpath "${found}" "${ROOT_DIR}"`"
569
-               ;;
570
-
571
-               *)
572
-                 log_verbose "Using local item \"${found}\""
573
-               ;;
574
-            esac
575 370
          fi
576 371
       ;;
577 372
    esac
578 373
 
579
-   local rval
374
+   do_operation "clone" \
375
+                "${reposdir}" \
376
+                "${name}" \
377
+                "${url}" \
378
+                "${branch}" \
379
+                "${tag}" \
380
+                "${scm}" \
381
+                "${scmoptions}" \
382
+                "${stashdir}"
383
+   rval="$?"
384
+   case $rval in
385
+      0)
386
+      ;;
580 387
 
581
-   if ! "${operation}" "${reposdir}" \
582
-                       "${name}" \
583
-                       "${url}" \
584
-                       "${branch}" \
585
-                       "${scm}" \
586
-                       "${tag}" \
587
-                       "${stashdir}"
588
-   then
589
-      log_debug "Clone \"${operation}\" failed"
590
-      return 1
591
-   fi
388
+      111)
389
+         fail "SCM \"${scm}\" is unknown"
390
+      ;;
391
+
392
+      *)
393
+         log_debug "SCM \"${scm}\" clone failed"
394
+         return 1
395
+      ;;
396
+   esac
592 397
 
593 398
    if [ "${DONT_WARN_SCRIPTS}" != "YES" ]
594 399
    then
... ...
@@ -597,32 +402,31 @@ clone_or_symlink()
597 402
       warn_scripts_main "${stashdir}/.bootstrap" "${stashdir}" || fail "Ok, aborted"  #sic
598 403
    fi
599 404
 
600
-   if [ "${operation}" = "link_command" ]
405
+   if [ "${scm}" = "symlink" ]
601 406
    then
602
-      log_debug "Symlink \"${operation}\" successful"
407
+      log_debug "Symlink successful"
603 408
       return 2
604 409
    fi
605 410
 
606
-   log_debug "Clone \"${operation}\" successful"
411
+   log_debug "SCM \"${scm}\" clone was successful"
607 412
    return 0
608 413
 }
609 414
 
610
-##
611
-## CLONE
612
-##
415
+
613 416
 clone_repository()
614 417
 {
615
-   local reposdir="$1"  # ususally .bootstrap.repos
616
-   local name="$2"      # name of the clone
617
-   local url="$3"       # URL of the clone
618
-   local branch="$4"    # branch of the clone
619
-   local scm="$5"       # scm to use for this clone
620
-   local tag="$6"       # tag to checkout of the clone
621
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
418
+   log_entry "clone_repository" "$@"
622 419
 
623
-   [ $# -eq 7 ] || internal_fail "fail"
420
+   local reposdir="$1"     # ususally .bootstrap.repos
421
+   local name="$2"         # name of the clone
422
+   local url="$3"          # URL of the clone
423
+   local branch="$4"       # branch of the clone
424
+   local tag="$5"          # tag to checkout of the clone
425
+   local scm="$6"          # scm to use for this clone
426
+   local scmoptions="$7"   # options to use on scm
427
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
624 428
 
625
-   log_action "clone" "$@"
429
+   [ $# -eq 8 ] || internal_fail "fail"
626 430
 
627 431
    assert_sane_parameters "empty is ok"
628 432
 
... ...
@@ -660,41 +464,7 @@ Suggested fix:
660 464
 ##
661 465
 checkout_repository()
662 466
 {
663
-   local reposdir="$1"  # ususally .bootstrap.repos
664
-   local name="$2"      # name of the clone
665
-   local url="$3"       # URL of the clone
666
-   local branch="$4"    # branch of the clone
667
-   local scm="$5"       # scm to use for this clone
668
-   local tag="$6"       # tag to checkout of the clone
669
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
670
-
671
-   log_action "checkout" "$@"
672
-
673
-   local operation
674
-
675
-   case "${scm}" in
676
-      git*)
677
-         operation="git_checkout"
678
-      ;;
679
-      svn*)
680
-         operation="svn_checkout"
681
-      ;;
682
-      zip*|tar*)
683
-         log_info "No checkout for \"${scm}\""
684
-         return
685
-      ;;
686
-      *)
687
-         fail "Unknown scm system \"${scm}\""
688
-      ;;
689
-   esac
690
-
691
-   script="`find_build_setting_file "${name}" "bin/checkout.sh"`"
692
-   if [ ! -z "${script}" ]
693
-   then
694
-      run_script "${script}" "$@"
695
-   else
696
-      "${operation}" "$@"
697
-   fi
467
+   do_operation "checkout" "$@"
698 468
 }
699 469
 
700 470
 
... ...
@@ -702,81 +472,20 @@ checkout_repository()
702 472
 ## UPDATE
703 473
 ## this like git fetch, does not update repository
704 474
 ##
475
+
705 476
 update_repository()
706 477
 {
707
-   local reposdir="$1"  # ususally .bootstrap.repos
708
-   local name="$2"      # name of the clone
709
-   local url="$3"       # URL of the clone
710
-   local branch="$4"    # branch of the clone
711
-   local scm="$5"       # scm to use for this clone
712
-   local tag="$6"       # tag to checkout of the clone
713
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
714
-
715
-   log_action "update" "$@"
716
-
717
-   local operation
718
-
719
-   case "${scm}" in
720
-      git*)
721
-         operation="git_fetch"
722
-      ;;
723
-      svn*|zip*|tar*)
724
-         log_info "No update for \"${scm}\""
725
-         return
726
-      ;;
727
-      *)
728
-         fail "Unknown scm system \"${scm}\""
729
-      ;;
730
-   esac
731
-
732
-   script="`find_build_setting_file "${name}" "bin/update.sh"`"
733
-   if [ ! -z "${script}" ]
734
-   then
735
-      run_script "${script}" "$@"
736
-   else
737
-      "${operation}" "$@"
738
-   fi
478
+   do_operation "update" "$@"
739 479
 }
740 480
 
741 481
 
742 482
 ##
743 483
 ## UPGRADE
744 484
 ## This is a pull
745
-
485
+##
746 486
 upgrade_repository()
747 487
 {
748
-   local reposdir="$1"  # ususally .bootstrap.repos
749
-   local name="$2"      # name of the clone
750
-   local url="$3"       # URL of the clone
751
-   local branch="$4"    # branch of the clone
752
-   local scm="$5"       # scm to use for this clone
753
-   local tag="$6"       # tag to checkout of the clone
754
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
755
-
756
-   log_action "upgrade" "$@"
757
-
758
-   local operation
759
-
760
-   case "${scm}" in
761
-      git)
762
-         operation="git_pull"
763
-      ;;
764
-      svn|zip*|tar*)
765
-         log_info "No upgrade for \"${scm}\""
766
-         return
767
-      ;;
768
-      *)
769
-         fail "Unknown scm system \"${scm}\""
770
-      ;;
771
-   esac
772
-
773
-   script="`find_build_setting_file "${name}" "bin/upgrade.sh"`"
774
-   if [ ! -z "${script}" ]
775
-   then
776
-      run_script "${script}" "$@"
777
-   else
778
-      "${operation}" "$@"
779
-   fi
488
+   do_operation "upgrade" "$@"
780 489
 }
781 490
 
782 491
 
... ...
@@ -850,18 +559,24 @@ _update_operation_walk_deep_embedded_auto_repositories()
850 559
 ##
851 560
 update_repositories()
852 561
 {
562
+   log_entry "update_repositories" "$@"
563
+
853 564
    _update_operation_walk_repositories "update_repository"
854 565
 }
855 566
 
856 567
 
857 568
 update_embedded_repositories()
858 569
 {
570
+   log_entry "update_embedded_repositories" "$@"
571
+
859 572
    _update_operation_walk_embedded_repositories "update_repository"
860 573
 }
861 574
 
862 575
 
863 576
 update_deep_embedded_repositories()
864 577
 {
578
+   log_entry "update_deep_embedded_repositories" "$@"
579
+
865 580
    _update_operation_walk_deep_embedded_auto_repositories "update_repository"
866 581
 }
867 582
 
... ...
@@ -871,23 +586,45 @@ update_deep_embedded_repositories()
871 586
 ##
872 587
 upgrade_repositories()
873 588
 {
589
+   log_entry "upgrade_repositories" "$@"
590
+
874 591
    _update_operation_walk_repositories "upgrade_repository"
875 592
 }
876 593
 
877 594
 
878 595
 upgrade_embedded_repositories()
879 596
 {
597
+   log_entry "upgrade_embedded_repositories" "$@"
598
+
880 599
    _update_operation_walk_embedded_repositories "upgrade_repository"
881 600
 }
882 601
 
883 602
 
884 603
 upgrade_deep_embedded_repositories()
885 604
 {
605
+   log_entry "upgrade_deep_embedded_repositories" "$@"
606
+
886 607
    _update_operation_walk_deep_embedded_auto_repositories "upgrade_repository"
887 608
 }
888 609
 
889 610
 
890 611
 
612
+default_action_for_clone()
613
+{
614
+   local scm="$1"
615
+   local stashdir="$2"
616
+
617
+   if [ "${scm}" = "minion" ]
618
+   then
619
+      log_fluff "Not removing \"${stashdir}\" because it's a minion"
620
+   else
621
+      echo "remove"
622
+   fi
623
+
624
+   echo "clone"
625
+}
626
+
627
+
891 628
 ##
892 629
 ##
893 630
 ##
... ...
@@ -897,13 +634,14 @@ required_action_for_clone()
897 634
 
898 635
    local newclone="$1" ; shift
899 636
 
900
-   local newreposdir="$1"  # ususally .bootstrap.repos
901
-   local newname="$2"      # name of the clone
902
-   local newurl="$3"       # URL of the clone
903
-   local newbranch="$4"    # branch of the clone
904
-   local newscm="$5"       # scm to use for this clone
905
-   local newtag="$6"       # tag to checkout of the clone
906
-   local newstashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
637
+   local newreposdir="$1"    # ususally .bootstrap.repos
638
+   local newname="$2"        # name of the clone
639
+   local newurl="$3"         # URL of the clone
640
+   local newbranch="$4"      # branch of the clone
641
+   local newtag="$5"         # tag to checkout of the clone
642
+   local newscm="$6"         # scm to use for this clone
643
+   local newscmoptions="$7"  # scm to use for this clone
644
+   local newstashdir="$8"    # stashdir of this clone (absolute or relative to $PWD)
907 645
 
908 646
    local clone
909 647
 
... ...
@@ -935,31 +673,30 @@ required_action_for_clone()
935 673
    local name
936 674
    local url
937 675
    local branch
938
-   local scm
939 676
    local tag
677
+   local scm
678
+   local scmoptions
940 679
    local stashdir
941 680
 
942 681
    parse_clone "${clone}"
943 682
 
944 683
    log_debug "Change: \"${clone}\" -> \"${newclone}\""
945 684
 
685
+   #
686
+   # SCM change is big (except if old is symlink and new is git)
687
+   #
946 688
    if [ "${scm}" != "${newscm}" ]
947 689
    then
948 690
       if ! [ "${scm}" = "symlink" -a "${newscm}" = "git" ]
949 691
       then
950
-         log_fluff "SCM has changed from \"${scm}\" to \"${newscm}\", need to refetch"
951
-
952
-         if [ "${scm}" != "minion" ]
953
-         then
954
-            log_fluff "Not removing \"${stashdir}\" because it's a minion"
955
-            echo "remove"
956
-         fi
957
-
958
-         echo "clone"
692
+         default_action_for_clone "${scm}" "${stashdir}"
959 693
          return
960 694
       fi
961 695
    fi
962 696
 
697
+   #
698
+   # Handle positional changes
699
+   #
963 700
    if [ "${stashdir}" != "${newstashdir}" ]
964 701
    then
965 702
       if [ -e "${newstashdir}" ]
... ...
@@ -992,48 +729,60 @@ required_action_for_clone()
992 729
    fi
993 730
 
994 731
    #
995
-   # if scm is not git, don't try to be clever
732
+   # Check that the scm can actually do the supported operation
996 733
    #
997
-   case "${scm}" in
998
-      git*)
999
-      ;;
734
+   local have_set_url
735
+   local have_checkout
736
+   local have_upgrade
1000 737
 
1001
-      symlink*)
738
+   case "${scm}" in
739
+      symlink)
1002 740
          if [ -e "${newstashdir}" ]
1003 741
          then
1004 742
             log_fluff "\"${stashdir}\" is symlink. Ignoring possible differences."
1005 743
             return
1006 744
          fi
1007
-
1008
-         log_fluff "\"${newstashdir}\" is missing, reget."
1009
-         echo "clone"
1010
-         return
1011
-      ;;
1012
-
1013
-      *)
1014
-         log_fluff "Reget because scm is \"${scm}\"."
1015
-         echo "clone"
1016
-         return
1017 745
       ;;
1018 746
    esac
1019 747
 
748
+   have_upgrade="`git_scm_function "${scm}" "upgrade"`"
1020 749
    if [ "${branch}" != "${newbranch}" ]
1021 750
    then
1022 751
       log_fluff "Branch has changed from \"${branch}\" to \"${newbranch}\", need to fetch"
1023
-      echo "upgrade"
752
+      if [ ! -z "${have_upgrade}" ]
753
+      then
754
+         echo "upgrade"
755
+      else
756
+         default_action_for_clone "${scm}" "${stashdir}"
757
+         return
758
+      fi
1024 759
    fi
1025 760
 
761
+   have_checkout="`git_scm_function "${scm}" "checkout"`"
1026 762
    if [ "${tag}" != "${newtag}" ]
1027 763
    then
1028 764
       log_fluff "Tag has changed from \"${tag}\" to \"${newtag}\", need to check-out"
1029
-      echo "checkout"
765
+      if [ ! -z "${have_checkout}" ]
766
+      then
767
+         echo "checkout"
768
+      else
769
+         default_action_for_clone "${scm}" "${stashdir}"
770
+         return
771
+      fi
1030 772
    fi
1031 773
 
774
+   have_set_url="`git_scm_function "${scm}" "set_url"`"
1032 775
    if [ "${url}" != "${newurl}" ]
1033 776
    then
1034 777
       log_fluff "URL has changed from \"${url}\" to \"${newurl}\", need to set remote url and fetch"
1035
-      echo "set-remote"
1036
-      echo "upgrade"
778
+      if [ ! -z "${have_upgrade}" -a ! -z "${have_set_url}" ]
779
+      then
780
+         echo "set-remote"
781
+         echo "upgrade"
782
+      else
783
+         default_action_for_clone "${scm}" "${stashdir}"
784
+         return
785
+      fi
1037 786
    fi
1038 787
 }
1039 788
 
... ...
@@ -1114,12 +863,15 @@ work_clones()
1114 863
    local required_clones="$3"
1115 864
    local autoupdate="$4"
1116 865
 
866
+   [ -z "${clones}" ] && return
867
+
1117 868
    local clone
1118 869
    local name
1119 870
    local url
1120 871
    local branch
1121
-   local scm
1122 872
    local tag
873
+   local scm
874
+   local scmoptions
1123 875
    local stashdir
1124 876
    local dstdir
1125 877
 
... ...
@@ -1187,7 +939,7 @@ work_clones()
1187 939
       if is_minion_bootstrap_project "${name}"
1188 940
       then
1189 941
          log_fluff "\"${name}\" is a minion, ignoring possible changes"
1190
-         clone="`echo "${name};${name};${branch};minion;${tag}" | sed 's/;*$//'`"
942
+         clone="`echo "${name};${name};${branch};${tag};minion" | sed 's/;*$//'`"
1191 943
          remember="YES"
1192 944
       else
1193 945
          actionitems="`required_action_for_clone "${clone}" \
... ...
@@ -1195,8 +947,9 @@ work_clones()
1195 947
                                                  "${name}" \
1196 948
                                                  "${url}" \
1197 949
                                                  "${branch}" \
1198
-                                                 "${scm}" \
1199 950
                                                  "${tag}" \
951
+                                                 "${scm}" \
952
+                                                 "${scmoptions}" \
1200 953
                                                  "${stashdir}"`" || exit 1
1201 954
 
1202 955
          log_debug "${C_INFO}Actions for \"${name}\": ${actionitems:-none}"
... ...
@@ -1215,8 +968,9 @@ work_clones()
1215 968
                                            "${name}" \
1216 969
                                            "${url}" \
1217 970
                                            "${branch}" \
1218
-                                           "${scm}" \
1219 971
                                            "${tag}" \
972
+                                           "${scm}" \
973
+                                           "${scmoptions}" \
1220 974
                                            "${stashdir}"
1221 975
                   then
1222 976
                      fail "Failed to checkout"
... ...
@@ -1228,8 +982,9 @@ work_clones()
1228 982
                                    "${name}" \
1229 983
                                    "${url}" \
1230 984
                                    "${branch}" \
1231
-                                   "${scm}" \
1232 985
                                    "${tag}" \
986
+                                   "${scm}" \
987
+                                   "${scmoptions}" \
1233 988
                                    "${stashdir}"
1234 989
 
1235 990
                   case "$?" in
... ...
@@ -1282,8 +1037,9 @@ work_clones()
1282 1037
                                      "${name}" \
1283 1038
                                      "${url}" \
1284 1039
                                      "${branch}" \
1285
-                                     "${scm}" \
1286 1040
                                      "${tag}" \
1041
+                                     "${scm}" \
1042
+                                     "${scmoptions}" \
1287 1043
                                      "${stashdir}"
1288 1044
                ;;
1289 1045
 
... ...
@@ -1322,7 +1078,7 @@ work_clones()
1322 1078
          fi
1323 1079
 
1324 1080
          # create clone as it is now
1325
-         clone="`echo "${url};${dstdir};${branch};${scm};${tag}" | sed 's/;*$//'`"
1081
+         clone="`echo "${url};${dstdir};${branch};${tag};${scm};${scmoptions}" | sed 's/;*$//'`"
1326 1082
       fi
1327 1083
 
1328 1084
       if [ "${skip}" = "YES" ]
... ...
@@ -1345,7 +1101,7 @@ work_clones()
1345 1101
                                       "${stashdir}" \
1346 1102
                                       "${PARENT_CLONE}"
1347 1103
       else
1348
-         log_debug "ignoring because..."
1104
+         log_debug "Don't need to remember it (should be unchanged)"
1349 1105
       fi
1350 1106
       mark_stash_as_alive "${reposdir}" "${name}"
1351 1107
    done
... ...
@@ -1360,18 +1116,19 @@ fetch_once_embedded_repositories()
1360 1116
 {
1361 1117
    log_entry "fetch_once_embedded_repositories" "$@"
1362 1118
 
1363
-   (
1364
-      STASHES_DEFAULT_DIR=""
1365
-      STASHES_ROOT_DIR=""
1366
-      OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1119
+   local STASHES_DEFAULT_DIR=""
1120
+   local STASHES_ROOT_DIR=""
1121
+   local OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}"
1367 1122
 
1368
-      local clones
1369
-      local required_clones
1123
+   local clones
1124
+   local required_clones
1370 1125
 
1371
-      clones="`read_root_setting "embedded_repositories"`" ;
1372
-      required_clones="`read_root_setting "embedded_required"`" ;
1373
-      work_clones "${EMBEDDED_REPOS_DIR}" "${clones}" "${required_clones}" "NO"
1374
-   ) || exit 1
1126
+   clones="`read_root_setting "embedded_repositories"`" ;
1127
+   required_clones="`read_root_setting "embedded_required"`" ;
1128
+   if ! work_clones "${EMBEDDED_REPOS_DIR}" "${clones}" "${required_clones}" "NO"
1129
+   then
1130
+      exit 1
1131
+   fi
1375 1132
 }
1376 1133
 
1377 1134
 
... ...
@@ -1415,18 +1172,19 @@ fetch_once_minions_embedded_repositories()
1415 1172
 
1416 1173
       reposdir="${REPOS_DIR}/.deep/${minion}.d"
1417 1174
 
1418
-      (
1419
-         STASHES_DEFAULT_DIR=""
1420
-         STASHES_ROOT_DIR=""
1421
-         OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1175
+      local STASHES_DEFAULT_DIR=""
1176
+      local STASHES_ROOT_DIR=""
1177
+      local OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}"
1422 1178
 
1423
-         local clones
1424
-         local required_clones
1179
+      local clones
1180
+      local required_clones
1425 1181
 
1426
-         clones="`read_setting "${autodir}/embedded_repositories"`" ;
1427
-         required_clones="`read_setting "${autodir}/embedded_required"`" ;
1428
-         work_clones "${reposdir}" "${clones}" "${required_clones}" "NO"
1429
-      ) || exit 1
1182
+      clones="`read_setting "${autodir}/embedded_repositories"`"
1183
+      required_clones="`read_setting "${autodir}/embedded_required"`"
1184
+      if ! work_clones "${reposdir}" "${clones}" "${required_clones}" "NO"
1185
+      then
1186
+         exit 1
1187
+      fi
1430 1188
    done
1431 1189
 
1432 1190
    IFS="${DEFAULT_IFS}"
... ...
@@ -1437,13 +1195,14 @@ _fetch_once_deep_embedded_repository()
1437 1195
 {
1438 1196
    log_entry "_fetch_once_minions_embedded_repositories" "$@"
1439 1197
 
1440
-   local reposdir="$1"  # ususally .bootstrap.repos
1441
-   local name="$2"      # name of the clone
1442
-   local url="$3"       # URL of the clone
1443
-   local branch="$4"    # branch of the clone
1444
-   local scm="$5"       # scm to use for this clone
1445
-   local tag="$6"       # tag to checkout of the clone
1446
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
1198
+   local reposdir="$1"     # ususally .bootstrap.repos
1199
+   local name="$2"         # name of the clone
1200
+   local url="$3"          # URL of the clone
1201
+   local branch="$4"       # branch of the clone
1202
+   local tag="$5"          # tag to checkout of the clone
1203
+   local scm="$6"          # scm to use for this clone
1204
+   local scmoptions="$7"   # options to use on scm
1205
+   local stashdir="$8"     # stashdir of this clone (absolute or relative to $PWD)
1447 1206
 
1448 1207
    local autodir
1449 1208
 
... ...
@@ -1456,21 +1215,23 @@ _fetch_once_deep_embedded_repository()
1456 1215
    fi
1457 1216
 
1458 1217
    reposdir="${reposdir}/.deep/${name}.d"
1459
-   (
1460
-      STASHES_DEFAULT_DIR=""
1461
-      STASHES_ROOT_DIR="${stashdir}"  # hackish
1462
-      OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1463
-      PARENT_REPOSITORY_NAME="${name}"
1464
-      PARENT_CLONE="${clone}"
1465 1218
 
1466
-      local clones
1467
-      local required_clones
1219
+   local STASHES_DEFAULT_DIR=""
1220
+   local STASHES_ROOT_DIR="${stashdir}"  # hackish
1221
+   local OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}"
1222
+   local PARENT_REPOSITORY_NAME="${name}"
1223
+   local PARENT_CLONE="${clone}"
1468 1224
 
1469
-      # ugliness
1470
-      clones="`read_setting "${autodir}/embedded_repositories"`" ;
1471
-      required_clones="`read_setting "${autodir}/embedded_required"`" ;
1472
-      work_clones "${reposdir}" "${clones}" "${required_clones}" "NO"
1473
-   ) || exit 1
1225
+   local clones
1226
+   local required_clones
1227
+
1228
+   # ugliness
1229
+   clones="`read_setting "${autodir}/embedded_repositories"`"
1230
+   required_clones="`read_setting "${autodir}/embedded_required"`"
1231
+   if ! work_clones "${reposdir}" "${clones}" "${required_clones}" "NO"
1232
+   then
1233
+      exit 1
1234
+   fi
1474 1235
 }