Browse code

fix more bugs found by shellcheck and tests

Nat! authored on 22-08-2017 22:29:38
Showing 31 changed files
... ...
@@ -1,31 +1,56 @@
1 1
 SCRIPTS=install.sh \
2
-	src/mulle-bootstrap-array.sh \
3
-	src/mulle-bootstrap-auto-update.sh \
4
-	src/mulle-bootstrap-brew.sh \
5
-	src/mulle-bootstrap-build.sh \
6
-	src/mulle-bootstrap-clean.sh \
7
-	src/mulle-bootstrap-common-settings.sh \
8
-	src/mulle-bootstrap-copy.sh \
9
-	src/mulle-bootstrap-dependency-resolve.sh \
10
-	src/mulle-bootstrap-fetch.sh \
11
-	src/mulle-bootstrap-functions.sh \
12
-	src/mulle-bootstrap-gcc.sh \
13
-	src/mulle-bootstrap-init.sh \
14
-	src/mulle-bootstrap-local-environment.sh \
15
-	src/mulle-bootstrap-logging.sh \
16
-	src/mulle-bootstrap-mingw.sh \
17
-	src/mulle-bootstrap-repositories.sh \
18
-	src/mulle-bootstrap-scm.sh \
19
-	src/mulle-bootstrap-scripts.sh \
20
-	src/mulle-bootstrap-settings.sh \
21
-	src/mulle-bootstrap-systeminstall.sh \
22
-	src/mulle-bootstrap-tag.sh \
23
-	src/mulle-bootstrap-warn-scripts.sh \
24
-	src/mulle-bootstrap-xcode.sh \
25
-	src/mulle-bootstrap-zombify.sh
2
+src/mulle-bootstrap-array.sh \
3
+src/mulle-bootstrap-auto-update.sh \
4
+src/mulle-bootstrap-brew.sh \
5
+src/mulle-bootstrap-build.sh \
6
+src/mulle-bootstrap-clean.sh \
7
+src/mulle-bootstrap-command.sh \
8
+src/mulle-bootstrap-common-settings.sh \
9
+src/mulle-bootstrap-copy.sh \
10
+src/mulle-bootstrap-core-options.sh \
11
+src/mulle-bootstrap-defer.sh \
12
+src/mulle-bootstrap-dependency-resolve.sh \
13
+src/mulle-bootstrap-dispense.sh \
14
+src/mulle-bootstrap-fetch.sh \
15
+src/mulle-bootstrap-functions.sh \
16
+src/mulle-bootstrap-gcc.sh \
17
+src/mulle-bootstrap-git.sh \
18
+src/mulle-bootstrap-init.sh \
19
+src/mulle-bootstrap-local-environment.sh \
20
+src/mulle-bootstrap-logging.sh \
21
+src/mulle-bootstrap-mingw.sh \
22
+src/mulle-bootstrap-mv-force.sh \
23
+src/mulle-bootstrap-paths.sh \
24
+src/mulle-bootstrap-project.sh \
25
+src/mulle-bootstrap-repositories.sh \
26
+src/mulle-bootstrap-scm.sh \
27
+src/mulle-bootstrap-scripts.sh \
28
+src/mulle-bootstrap-settings.sh \
29
+src/mulle-bootstrap-show.sh \
30
+src/mulle-bootstrap-snip.sh \
31
+src/mulle-bootstrap-status.sh \
32
+src/mulle-bootstrap-systeminstall.sh \
33
+src/mulle-bootstrap-tag.sh \
34
+src/mulle-bootstrap-warn-scripts.sh \
35
+src/mulle-bootstrap-xcode.sh \
36
+src/mulle-bootstrap-zombify.sh \
37
+src/mulle-bootstrap-build-plugins/autoconf.sh \
38
+src/mulle-bootstrap-build-plugins/cmake.sh \
39
+src/mulle-bootstrap-build-plugins/configure.sh \
40
+src/mulle-bootstrap-build-plugins/script.sh \
41
+src/mulle-bootstrap-build-plugins/xcodebuild.sh \
42
+src/mulle-bootstrap-scm-plugins/git.sh \
43
+src/mulle-bootstrap-scm-plugins/svn.sh \
44
+src/mulle-bootstrap-scm-plugins/symlink.sh \
45
+src/mulle-bootstrap-scm-plugins/tar.sh \
46
+src/mulle-bootstrap-scm-plugins/zip.sh
26 47
 
27 48
 CHECKSTAMPS=$(SCRIPTS:.sh=.chk)
28
-SHELLFLAGS=-x -e SC2164,SC2166,SC2006,SC1091,SC2039,SC2181,SC2059 -s sh
49
+
50
+#
51
+# catch some more glaring problems, the rest is done with sublime
52
+#
53
+SHELLFLAGS=-x -e SC2016,SC2034,SC2086,SC2164,SC2166,SC2006,SC1091,SC2039,SC2181,SC2059,SC2196,SC2197 -s sh
29 54
 
30 55
 .PHONY: all
31 56
 .PHONY: clean
... ...
@@ -45,7 +70,9 @@ install:
45 70
 	@ ./install.sh
46 71
 
47 72
 clean:
48
-	@- rm *.chk
73
+	@- rm src/*.chk
74
+	@- rm src/mulle-bootstrap-build-plugins/*.chk
75
+	@- rm src/mulle-bootstrap-scm-plugins/*.chk
49 76
 
50 77
 shellcheck_check:
51 78
 	which shellcheck || brew install shellcheck
... ...
@@ -625,11 +625,11 @@ bootstrap_main()
625 625
       ;;
626 626
 
627 627
       type)
628
-         if is_minion_bootstrap_project
628
+         if is_minion_bootstrap_project "."
629 629
          then
630 630
             echo "Minion"
631 631
          else
632
-            if is_master_bootstrap_project
632
+            if is_master_bootstrap_project "."
633 633
             then
634 634
                echo "Master"
635 635
             else
... ...
@@ -687,7 +687,7 @@ bootstrap_main()
687 687
 # service both names
688 688
 #
689 689
 MULLE_EXECUTABLE="`basename -- "$0"`"
690
-MULLE_ARGUMENTS="$@"
690
+MULLE_ARGUMENTS="$*"
691 691
 MULLE_EXECUTABLE_ENV_PATH="$PATH"
692 692
 MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_EXECUTABLE}"
693 693
 MULLE_EXECUTABLE_PID="$$"
... ...
@@ -258,12 +258,12 @@ _bootstrap_merge_expanded_settings_in_front()
258 258
    local settings1
259 259
    local settings2
260 260
 
261
-   srcbootstrap="`dirname -- "${1}"`"
261
+   srcbootstrap="`dirname -- "${addition}"`"
262 262
 
263
-   settings1="`read_expanded_setting "$1" "" "${srcbootstrap}"`"
264
-   if [ ! -z "$2" ]
263
+   settings1="`read_expanded_setting "${addition}" "" "${srcbootstrap}"`"
264
+   if [ ! -z "${original}" ]
265 265
    then
266
-      settings2="`read_setting "$2"`"
266
+      settings2="`read_setting "${original}"`"
267 267
    fi
268 268
 
269 269
    _merge_settings_in_front "${settings1}" "${settings2}"
... ...
@@ -381,12 +381,10 @@ _bootstrap_auto_special_copy()
381 381
 
382 382
    dstfilepath="${dst}/${key}"
383 383
 
384
-   (
385
-      STASHES_DEFAULT_DIR=""
386
-      STASHES_ROOT_DIR="${directory}"
387
-      merge_repository_files "${filepath}" "${dstfilepath}" "NO"
384
+   local STASHES_DEFAULT_DIR=""
385
+   local STASHES_ROOT_DIR="${directory}"
388 386
 
389
-   )
387
+   merge_repository_files "${filepath}" "${dstfilepath}" "NO"
390 388
 }
391 389
 
392 390
 
... ...
@@ -631,10 +629,6 @@ tarballs
631 629
 repositories
632 630
 '
633 631
 
634
-   NON_MERGABLE_SETTINGS='embedded_repositories
635
-minions
636
-version
637
-'
638 632
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
639 633
    [ -z "${MULLE_BOOTSTRAP_COPY_SH}" ] && . mulle-bootstrap-copy.sh
640 634
    :
... ...
@@ -49,8 +49,8 @@ EOF
49 49
          cat <<EOF >&2
50 50
    -c         : change @rpath for shared libraries and frameworks
51 51
    -n         : don't change @rpath for shared libraries (if config option is set)
52
-   -f <rpath> : @rpath for Frameworks (default: ${OPTION_RPATH_FRAMEWORKS})
53
-   -l <rpath> : @rpath for shared libraries (default: ${OPTION_RPATH_LIBRARIES})
52
+   -f <rpath> : @rpath for Frameworks (default: ${OPTION_RPATH_FRAMEWORK})
53
+   -l <rpath> : @rpath for shared libraries (default: ${OPTION_RPATH_LIBRARY})
54 54
 EOF
55 55
       ;;
56 56
    esac
... ...
@@ -329,10 +329,14 @@ _brew_install_brews()
329 329
    log_debug "_brew_install_brews" "$@"
330 330
 
331 331
    local brewcmd="$1" ; shift
332
-   local brews="$@"
332
+
333 333
 
334 334
    [ -z "${brewcmd}" ] && internal_fail "empty brewcmd"
335 335
 
336
+   local brews
337
+
338
+   brews="$*"
339
+
336 340
    if [ -z "${brews}" ]
337 341
    then
338 342
       brews="`find_brews`"
... ...
@@ -351,8 +355,6 @@ _brew_install_brews()
351 355
       return
352 356
    fi
353 357
 
354
-   local flag
355
-
356 358
    walk_brews "${brews}" _brew_action "${brewcmd}"
357 359
 }
358 360
 
... ...
@@ -364,9 +366,9 @@ brew_install_brews()
364 366
    unprotect=
365 367
    if [ -d "${ADDICTIONS_DIR}" ]
366 368
    then
367
-      log_fluff "Unprotecting \"${ADDICTIONS_DIR}\" for ${command}."
368 369
       exekutor chmod -R u+w "${ADDICTIONS_DIR}"
369 370
       unprotect="YES"
371
+      log_fluff "Unprotected \"${ADDICTIONS_DIR}\" for brew."
370 372
    fi
371 373
 
372 374
    _brew_install_brews "$@"
... ...
@@ -193,7 +193,7 @@ build_autoconf()
193 193
       fail "Could not run configure for \"${srcdir}"\"
194 194
    fi
195 195
 
196
-   [ -z "${PROJECTFILE}" ] && internal_fail "test_${preference} did not set PROJECTFILE"
196
+   [ -z "${PROJECTFILE}" ] && internal_fail "test_configure did not set PROJECTFILE"
197 197
          #statements
198 198
 
199 199
    log_info "Let ${C_RESET_BOLD}${TOOLNAME}${C_INFO} do a \
... ...
@@ -204,7 +204,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${AUX_INFO} in \"${builddir}\" ..."
204 204
    build_configure "${PROJECTFILE}" "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}"
205 205
    if [ $? -ne 0 ]
206 206
    then
207
-      internal_fail "$build_${preference} should exit on failure and not return"
207
+      internal_fail "build_configure should exit on failure and not return"
208 208
    fi
209 209
 }
210 210
 
... ...
@@ -51,7 +51,7 @@ tools_environment_cmake()
51 51
 
52 52
    local defaultgenerator
53 53
 
54
-   defaultgenerator="`platform_cmake_generator "${defaultmake}"`"
54
+   defaultgenerator="`platform_cmake_generator "${DEFAULTMAKE}"`"
55 55
    CMAKE="`find_cmake "${name}"`"
56 56
    CMAKE_GENERATOR="`read_build_setting "${name}" "cmake_generator" "${defaultgenerator}"`"
57 57
 }
... ...
@@ -130,19 +130,19 @@ build_configure()
130 130
 
131 131
    if [ ! -z "${other_cppflags}" ]
132 132
    then
133
-      env_flags="`concat "${cmake_flags}" "CPPFLAGS='${other_cppflags}'"`"
133
+      env_flags="`concat "${env_flags}" "CPPFLAGS='${other_cppflags}'"`"
134 134
    fi
135 135
    if [ ! -z "${other_cflags}" ]
136 136
    then
137
-      env_flags="`concat "${cmake_flags}" "CFLAGS='${other_cflags}'"`"
137
+      env_flags="`concat "${env_flags}" "CFLAGS='${other_cflags}'"`"
138 138
    fi
139 139
    if [ ! -z "${other_cxxflags}" ]
140 140
    then
141
-      env_flags="`concat "${cmake_flags}" "CXXFLAGS='${other_cxxflags}'"`"
141
+      env_flags="`concat "${env_flags}" "CXXFLAGS='${other_cxxflags}'"`"
142 142
    fi
143 143
    if [ ! -z "${other_ldflags}" ]
144 144
    then
145
-      env_flags="`concat "${cmake_flags}" "LDFLAGS='${other_ldflags}'"`"
145
+      env_flags="`concat "${env_flags}" "LDFLAGS='${other_ldflags}'"`"
146 146
    fi
147 147
 
148 148
    local logfile1
... ...
@@ -84,12 +84,6 @@ build_script()
84 84
          logfile="/dev/null"
85 85
       fi
86 86
 
87
-      log_info "Let ${C_RESET_BOLD}script${C_INFO} do a \
88
-${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
89
-${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
90
-${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
91
-\"${builddir}\" ..."
92
-
93 87
       local oldpath
94 88
       local rval
95 89
 
... ...
@@ -169,13 +169,11 @@ tools_environment_make()
169 169
 
170 170
    tools_environment_common "$@"
171 171
 
172
-   local defaultmake
173
-
174
-   defaultmake="`platform_make "${C_COMPILER}"`"
172
+   DEFAULTMAKE="`platform_make "${C_COMPILER}"`"
175 173
 
176 174
    case "${UNAME}" in
177 175
       mingw)
178
-         MAKE="`find_make "${name}" "${defaultmake}"`"
176
+         MAKE="`find_make "${name}" "${DEFAULTMAKE}"`"
179 177
       ;;
180 178
 
181 179
       darwin)
... ...
@@ -371,9 +369,7 @@ _build_flags()
371 369
 
372 370
    (
373 371
       local nativewd
374
-      local owd
375 372
 
376
-      owd="${PWD}"
377 373
       nativewd="`pwd ${BUILD_PWD_OPTIONS}`"
378 374
 
379 375
       cd "${builddir}"
... ...
@@ -533,7 +529,7 @@ create_mangled_header_path()
533 529
    local headers
534 530
 #   local prefix
535 531
 
536
-   headers="`xcode_get_setting "${key}" $*`"
532
+   headers="`xcode_get_setting "${key}" "$@"`"
537 533
    log_fluff "${key} read as \"${headers}\""
538 534
 
539 535
    case "${headers}" in
... ...
@@ -598,7 +594,6 @@ build_with_configuration_sdk_preferences()
598 594
 
599 595
    enforce_build_sanity "${builddir}"
600 596
 
601
-   local project
602 597
    local rval
603 598
    local WASXCODE
604 599
    local PROJECTFILE
... ...
@@ -613,7 +608,7 @@ build_with_configuration_sdk_preferences()
613 608
       TOOLNAME="${preference}"
614 609
       AUX_INFO=
615 610
 
616
-      test_${preference} "${configuration}" "${srcdir}" "${builddir}" "${name}"
611
+      "test_${preference}" "${configuration}" "${srcdir}" "${builddir}" "${name}"
617 612
       if [ $? -eq 0 ]
618 613
       then
619 614
          [ -z "${PROJECTFILE}" ] && internal_fail "test_${preference} did not set PROJECTFILE"
... ...
@@ -624,10 +619,10 @@ ${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
624 619
 ${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
625 620
 ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${AUX_INFO} in \"${builddir}\" ..."
626 621
 
627
-         build_${preference} "${PROJECTFILE}" "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}"
622
+         "build_${preference}" "${PROJECTFILE}" "${configuration}" "${srcdir}" "${builddir}" "${name}" "${sdk}"
628 623
          if [ $? -ne 0 ]
629 624
          then
630
-            internal_fail "$build_${preference} should exit on failure and not return"
625
+            internal_fail "build_${preference} should exit on failure and not return"
631 626
          fi
632 627
          rval=0
633 628
          break
... ...
@@ -665,7 +660,7 @@ load_build_plugins()
665 660
    do
666 661
       IFS="${DEFAULT_IFS}"
667 662
 
668
-      upcase="`tr '[a-z]' '[A-Z]' <<< "${preference}"`"
663
+      upcase="`tr 'a-z' 'A-Z' <<< "${preference}"`"
669 664
       plugindefine="MULLE_BOOTSTRAP_BUILD_PLUGIN_${upcase}_SH"
670 665
 
671 666
       if [ -z "`eval echo \$\{${plugindefine}\}`" ]
... ...
@@ -767,11 +762,9 @@ autoconf"`"
767 762
    # settings can override the commandline default
768 763
    configurations="`read_build_setting "${name}" "configurations" "${OPTION_CONFIGURATIONS}"`"
769 764
 
770
-   # "export" some globals
771
-   local BUILD_CONFIGURATIONS
765
+   # "export" a globala
772 766
    local BUILD_SDKS
773 767
 
774
-   BUILD_CONFIGURATIONS="${configurations}"
775 768
    BUILD_SDKS="${sdks}"
776 769
 
777 770
    for sdk in ${sdks}
... ...
@@ -410,6 +410,8 @@ _clean_execute()
410 410
 
411 411
 clean_execute()
412 412
 {
413
+   log_entry "clean_execute" "$@"
414
+
413 415
    setup_clean_environment
414 416
 
415 417
    _clean_execute "$@"
... ...
@@ -421,6 +423,8 @@ clean_execute()
421 423
 #
422 424
 clean_minions()
423 425
 {
426
+   log_entry "clean_minions" "$@"
427
+
424 428
    local style="$1"
425 429
    local minions="$2"
426 430
 
... ...
@@ -472,6 +476,41 @@ clean_minions()
472 476
 }
473 477
 
474 478
 
479
+#
480
+# clean embedded repositories out of minion
481
+#
482
+clean_minion_embeds()
483
+{
484
+   log_entry "clean_minion_embeds" "$@"
485
+
486
+   local minions="$1"
487
+
488
+   local directories
489
+
490
+   [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
491
+
492
+   local minion
493
+
494
+   # used by a test...
495
+
496
+   IFS="
497
+"
498
+   for minion in ${minions}
499
+   do
500
+      IFS="${DEFAULT_IFS}"
501
+
502
+      if [ -z "${minion}" ]
503
+      then
504
+         continue
505
+      fi
506
+
507
+      directories="`_all_repository_stashes "${REPOS_DIR}/.deep/${minion}.d"`"
508
+      clean_directories "${directories}"
509
+      clean_directories "${REPOS_DIR}/.deep/${minion}.d"
510
+   done
511
+   IFS="${DEFAULT_IFS}"
512
+}
513
+
475 514
 #
476 515
 # don't rename these settings anymore, the consequences can be catastrophic
477 516
 # for users of previous versions.
... ...
@@ -481,7 +520,9 @@ clean_main()
481 520
 {
482 521
    log_debug "::: clean :::"
483 522
 
484
-   local ROOT_DIR="`pwd -P`"
523
+   local ROOT_DIR
524
+
525
+   ROOT_DIR="`pwd -P`"
485 526
 
486 527
    local OPTION_MINION_NAMES=
487 528
 
... ...
@@ -535,13 +576,17 @@ clean_main()
535 576
       ;;
536 577
 
537 578
       "dist"|"full"|"install"|"output")
538
-         if [ ! -z "${OPTION_MINION_NAME}" ]
579
+         if [ ! -z "${OPTION_MINION_NAMES}" ]
539 580
          then
540 581
             fail "Can not use minion options with \"${style}\""
541 582
          fi
542 583
          clean_execute "${style}"
543 584
       ;;
544 585
 
586
+      "emancipate"|"minion-embeds")
587
+         clean_minion_embeds "${OPTION_MINION_NAMES}"
588
+      ;;
589
+
545 590
       help)
546 591
          clean_usage
547 592
       ;;
... ...
@@ -570,7 +615,9 @@ uninit_main()
570 615
 {
571 616
    log_debug "::: uninit :::"
572 617
 
573
-   local ROOT_DIR="`pwd -P`"
618
+   local ROOT_DIR
619
+
620
+   ROOT_DIR="`pwd -P`"
574 621
 
575 622
    local OPTION_MINION_NAMES=
576 623
 
... ...
@@ -123,13 +123,13 @@ platform_cmake_generator()
123 123
       mingw)
124 124
          case "${make}" in
125 125
             n*|N*)
126
-               defaultgenerator="NMake Makefiles"
126
+               echo "NMake Makefiles"
127 127
             ;;
128 128
             mingw*|MINGW*)
129
-               defaultgenerator="MinGW Makefiles"
129
+               echo "MinGW Makefiles"
130 130
             ;;
131 131
             *)
132
-               defaultgenerator="MSYS Makefiles"
132
+               echo "MSYS Makefiles"
133 133
             ;;
134 134
          esac
135 135
       ;;
... ...
@@ -129,7 +129,9 @@ _copy_files()
129 129
 copy_files_stripping_last_extension()
130 130
 {
131 131
    local ext="$3"
132
-   local lastext="`echo "${ext}" | sed 's/\.[^.]*$//'`"
132
+   local lastext
133
+
134
+   lastext="`echo "${ext}" | sed 's/\.[^.]*$//'`"
133 135
 
134 136
    _copy_files "`tar_remove_extension "${lastext}"`" "$@"
135 137
 }
... ...
@@ -251,7 +251,7 @@ emancipate_main()
251 251
       local name
252 252
 
253 253
       name="`basename -- "${minionpath}"`"
254
-      ( mulle-bootstrap clean --minion "${name}" )
254
+      ( mulle-bootstrap clean -m "${name}" emancipate )
255 255
 
256 256
       log_info "Cleaning master before emancipation"
257 257
       ( mulle-bootstrap clean output )
... ...
@@ -113,7 +113,7 @@ assert_sane_parameters()
113 113
 #
114 114
 check_tars()
115 115
 {
116
-   log_entry "check_tars" "$@"
116
+   log_entry "check_tars"
117 117
 
118 118
    local tarballs
119 119
    local tar
... ...
@@ -183,7 +183,7 @@ can_symlink_it()
183 183
 
184 184
    if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" != "YES" ]
185 185
    then
186
-      log_fluff "Can't symlink it, because it's been forbidden to create symlinks"
186
+      log_fluff "Not allowed to symlink it. (Use --symlinks to allow)"
187 187
       return 1
188 188
    fi
189 189
 
... ...
@@ -286,7 +286,7 @@ do_operation()
286 286
    script="`find_build_setting_file "${name}" "bin/${opname}.sh"`"
287 287
    if [ ! -z "${script}" ]
288 288
    then
289
-      run_script "${script}" "@"
289
+      run_script "${script}" "%@"
290 290
       return $?
291 291
    fi
292 292
 
... ...
@@ -371,27 +371,42 @@ clone_or_symlink()
371 371
       ;;
372 372
    esac
373 373
 
374
-   do_operation "clone" \
375
-                "${reposdir}" \
376
-                "${name}" \
377
-                "${url}" \
378
-                "${branch}" \
379
-                "${tag}" \
380
-                "${scm}" \
381
-                "${scmoptions}" \
382
-                "${stashdir}"
374
+   script="`find_build_setting_file "${name}" "bin/clone.sh"`"
375
+   if [ ! -z "${script}" ]
376
+   then
377
+      run_script "${script}" \
378
+                 "${reposdir}" \
379
+                 "${name}" \
380
+                 "${url}" \
381
+                 "${branch}" \
382
+                 "${tag}" \
383
+                 "${scm}" \
384
+                 "${scmoptions}" \
385
+                 "${stashdir}"
386
+      return $?
387
+   fi
388
+
389
+   scm_operation "clone" \
390
+                 "${reposdir}" \
391
+                 "${name}" \
392
+                 "${url}" \
393
+                 "${branch}" \
394
+                 "${tag}" \
395
+                 "${scm}" \
396
+                 "${scmoptions}" \
397
+                 "${stashdir}"
398
+
383 399
    rval="$?"
384 400
    case $rval in
385 401
       0)
386 402
       ;;
387 403
 
388 404
       111)
389
-         fail "SCM \"${scm}\" is unknown"
405
+         log_fail "SCM \"${scm}\" is unknown"
390 406
       ;;
391 407
 
392 408
       *)
393
-         log_debug "SCM \"${scm}\" clone failed"
394
-         return 1
409
+         return $rval
395 410
       ;;
396 411
    esac
397 412
 
... ...
@@ -559,7 +574,7 @@ _update_operation_walk_deep_embedded_auto_repositories()
559 574
 ##
560 575
 update_repositories()
561 576
 {
562
-   log_entry "update_repositories" "$@"
577
+   log_entry "update_repositories"
563 578
 
564 579
    _update_operation_walk_repositories "update_repository"
565 580
 }
... ...
@@ -567,7 +582,7 @@ update_repositories()
567 582
 
568 583
 update_embedded_repositories()
569 584
 {
570
-   log_entry "update_embedded_repositories" "$@"
585
+   log_entry "update_embedded_repositories"
571 586
 
572 587
    _update_operation_walk_embedded_repositories "update_repository"
573 588
 }
... ...
@@ -575,7 +590,7 @@ update_embedded_repositories()
575 590
 
576 591
 update_deep_embedded_repositories()
577 592
 {
578
-   log_entry "update_deep_embedded_repositories" "$@"
593
+   log_entry "update_deep_embedded_repositories"
579 594
 
580 595
    _update_operation_walk_deep_embedded_auto_repositories "update_repository"
581 596
 }
... ...
@@ -586,7 +601,7 @@ update_deep_embedded_repositories()
586 601
 ##
587 602
 upgrade_repositories()
588 603
 {
589
-   log_entry "upgrade_repositories" "$@"
604
+   log_entry "upgrade_repositories"
590 605
 
591 606
    _update_operation_walk_repositories "upgrade_repository"
592 607
 }
... ...
@@ -594,7 +609,7 @@ upgrade_repositories()
594 609
 
595 610
 upgrade_embedded_repositories()
596 611
 {
597
-   log_entry "upgrade_embedded_repositories" "$@"
612
+   log_entry "upgrade_embedded_repositories"
598 613
 
599 614
    _update_operation_walk_embedded_repositories "upgrade_repository"
600 615
 }
... ...
@@ -602,7 +617,7 @@ upgrade_embedded_repositories()
602 617
 
603 618
 upgrade_deep_embedded_repositories()
604 619
 {
605
-   log_entry "upgrade_deep_embedded_repositories" "$@"
620
+   log_entry "upgrade_deep_embedded_repositories"
606 621
 
607 622
    _update_operation_walk_deep_embedded_auto_repositories "upgrade_repository"
608 623
 }
... ...
@@ -635,12 +650,12 @@ required_action_for_clone()
635 650
    local newclone="$1" ; shift
636 651
 
637 652
    local newreposdir="$1"    # ususally .bootstrap.repos
638
-   local newname="$2"        # name of the clone
653
+#   local newname="$2"        # name of the clone
639 654
    local newurl="$3"         # URL of the clone
640 655
    local newbranch="$4"      # branch of the clone
641 656
    local newtag="$5"         # tag to checkout of the clone
642 657
    local newscm="$6"         # scm to use for this clone
643
-   local newscmoptions="$7"  # scm to use for this clone
658
+#   local newscmoptions="$7"  # scm to use for this clone
644 659
    local newstashdir="$8"    # stashdir of this clone (absolute or relative to $PWD)
645 660
 
646 661
    local clone
... ...
@@ -854,6 +869,14 @@ auto_update_minions()
854 869
 }
855 870
 
856 871
 
872
+is_required_clone()
873
+{
874
+   log_entry "is_required_clone" "$@"
875
+
876
+   echo "${required_clones}" | fgrep -s -q -x "${name}" > /dev/null
877
+}
878
+
879
+
857 880
 work_clones()
858 881
 {
859 882
    log_entry "work_clones" "$@"
... ...
@@ -988,7 +1011,15 @@ work_clones()
988 1011
                                    "${stashdir}"
989 1012
 
990 1013
                   case "$?" in
991
-                     1)
1014
+                     0)
1015
+                     ;;
1016
+
1017
+                     2)
1018
+                        # if we used a symlink, we want to memorize that
1019
+                        scm="symlink"
1020
+                     ;;
1021
+
1022
+                     *)
992 1023
                         #
993 1024
                         # check if clone is an optional install component
994 1025
                         # it is if it doesn't show up in "required"
... ...
@@ -996,23 +1027,19 @@ work_clones()
996 1027
                         # you specify optionals, by specifying the required
997 1028
                         # clones and leaving the optional out
998 1029
                         #
999
-                        if ! echo "${required_clones}" | fgrep -s -q -x "${name}" > /dev/null
1030
+                        if ! is_required_clone "${required_clones}" "${name}"
1000 1031
                         then
1001
-                           log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is missing, but it's not required."
1032
+                           log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is not required."
1002 1033
 
1003 1034
                            merge_line_into_file "${REPOS_DIR}/.missing" "${name}"
1004 1035
                            skip="YES"
1005 1036
                            continue
1006 1037
                         fi
1007 1038
 
1008
-                        log_debug "don't continue, because a required fetch failed"
1039
+                        log_debug "Don't continue, because a required fetch failed"
1009 1040
                         exit 1  # means exit
1010 1041
                      ;;
1011 1042
 
1012
-                     2)
1013
-                        # if we used a symlink, we want to memorize that
1014
-                        scm="symlink"
1015
-                     ;;
1016 1043
                   esac
1017 1044
                ;;
1018 1045
 
... ...
@@ -1114,7 +1141,7 @@ work_clones()
1114 1141
 #
1115 1142
 fetch_once_embedded_repositories()
1116 1143
 {
1117
-   log_entry "fetch_once_embedded_repositories" "$@"
1144
+   log_entry "fetch_once_embedded_repositories"
1118 1145
 
1119 1146
    local STASHES_DEFAULT_DIR=""
1120 1147
    local STASHES_ROOT_DIR=""
... ...
@@ -1137,7 +1164,7 @@ fetch_once_embedded_repositories()
1137 1164
 #
1138 1165
 fetch_once_minions_embedded_repositories()
1139 1166
 {
1140
-   log_entry "fetch_once_minions_embedded_repositories" "$@"
1167
+   log_entry "fetch_once_minions_embedded_repositories"
1141 1168
 
1142 1169
    local minions
1143 1170
 
... ...
@@ -1193,7 +1220,7 @@ fetch_once_minions_embedded_repositories()
1193 1220
 
1194 1221
 _fetch_once_deep_embedded_repository()
1195 1222
 {
1196
-   log_entry "_fetch_once_minions_embedded_repositories" "$@"
1223
+   log_entry "_fetch_once_minions_embedded_repositories"
1197 1224
 
1198 1225
    local reposdir="$1"     # ususally .bootstrap.repos
1199 1226
    local name="$2"         # name of the clone
... ...
@@ -1238,7 +1265,7 @@ _fetch_once_deep_embedded_repository()
1238 1265
 # but not minions
1239 1266
 fetch_once_deep_embedded_repositories()
1240 1267
 {
1241
-   log_entry "fetch_once_deep_embedded_repositories" "$@"
1268
+   log_entry "fetch_once_deep_embedded_repositories"
1242 1269
 
1243 1270
    local permissions
1244 1271
 
... ...
@@ -1251,7 +1278,7 @@ fetch_once_deep_embedded_repositories()
1251 1278
 
1252 1279
 extract_minion_precis()
1253 1280
 {
1254
-   log_entry "extract_minion_precis" "$@"
1281
+   log_entry "extract_minion_precis"
1255 1282
 
1256 1283
    local minions
1257 1284
 
... ...
@@ -1262,7 +1289,7 @@ extract_minion_precis()
1262 1289
 
1263 1290
 fetch_loop_repositories()
1264 1291
 {
1265
-   log_entry "fetch_loop_repositories" "$@"
1292
+   log_entry "fetch_loop_repositories"
1266 1293
 
1267 1294
    local loops
1268 1295
    local before
... ...
@@ -1459,7 +1486,9 @@ _common_main()
1459 1486
    local OVERRIDE_BRANCH
1460 1487
    local DONT_WARN_SCRIPTS="NO"
1461 1488
 
1462
-   local ROOT_DIR="`pwd -P`"
1489
+   local ROOT_DIR
1490
+
1491
+   ROOT_DIR="`pwd -P`"
1463 1492
 
1464 1493
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
1465 1494
    OVERRIDE_BRANCH="`read_config_setting "override_branch"`"
... ...
@@ -1698,7 +1727,7 @@ _common_main()
1698 1727
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_DIR}.auto"
1699 1728
          append_dir_to_gitignore_if_needed "${BOOTSTRAP_DIR}.local"
1700 1729
          append_dir_to_gitignore_if_needed "${DEPENDENCIES_DIR}"
1701
-         if [ "${brew_permissions}" != "none" ]
1730
+         if [ "${BREW_PERMISSIONS}" != "none" ]
1702 1731
          then
1703 1732
             append_dir_to_gitignore_if_needed "${ADDICTIONS_DIR}"
1704 1733
          fi
... ...
@@ -381,7 +381,9 @@ extension_less_basename()
381 381
    echo "${filename%.*}"
382 382
 }
383 383
 
384
-
384
+#
385
+# TODO: who uses this and why ?
386
+#
385 387
 path_concat()
386 388
 {
387 389
    local i
... ...
@@ -410,7 +412,7 @@ path_concat()
410 412
       then
411 413
         s="$i"
412 414
       else
413
-        s="${s}/${i}"
415
+        s="${s}/${sep}${i}"
414 416
       fi
415 417
    done
416 418
 
... ...
@@ -743,7 +745,7 @@ _simplify_components()
743 745
    result= # voodoo linux fix ?
744 746
    IFS="
745 747
 "
746
-   for i in $*
748
+   for i in "$@"
747 749
    do
748 750
       IFS="${DEFAULT_IFS}"
749 751
 
... ...
@@ -965,7 +967,7 @@ assert_sane_path()
965 967
       ;;
966 968
 
967 969
       ""|/*)
968
-         if [ `path_depth "${file}"` -le 2 ]
970
+         if [ "`path_depth "${file}"`" -le 2 ]
969 971
          then
970 972
             log_error "refuse suspicious path \"$1\""
971 973
             exit 1
... ...
@@ -1311,7 +1313,7 @@ create_symlink()
1311 1313
 
1312 1314
    # need to do this otherwise the symlink fails
1313 1315
 
1314
-   srcname="`basename -- ${url}`"
1316
+   srcname="`basename -- "${url}"`"
1315 1317
    directory="`dirname -- "${stashdir}"`"
1316 1318
 
1317 1319
    mkdir_if_missing "${directory}"
... ...
@@ -240,7 +240,7 @@ bootstrap_define_expansion()
240 240
 
241 241
    keyvalue="$1"
242 242
 
243
-   is_bootstrap_project || fail "This is not a ${MULLE_EXECUTABLE} project"
243
+   is_bootstrap_project "." || fail "This is not a ${MULLE_EXECUTABLE} project"
244 244
 
245 245
    if [ -z "${keyvalue}" ]
246 246
    then
... ...
@@ -253,7 +253,7 @@ bootstrap_define_expansion()
253 253
    local key
254 254
    local value
255 255
 
256
-   key="`echo "${keyvalue}" | cut -d= -f1 | tr '[a-z]' '[A-Z]'`"
256
+   key="`echo "${keyvalue}" | cut -d= -f1 | tr 'a-z' 'A-Z'`"
257 257
    if [ -z "${key}" ]
258 258
    then
259 259
       key="${keyvalue}"
... ...
@@ -300,7 +300,7 @@ bootstrap_should_defer_to_master()
300 300
    # master
301 301
    #
302 302
 
303
-   if ! is_minion_bootstrap_project
303
+   if ! is_minion_bootstrap_project "."
304 304
    then
305 305
       return 1
306 306
    fi
... ...
@@ -397,7 +397,7 @@ user_say_yes()
397 397
       esac
398 398
 
399 399
       printf "${C_WARNING}%b${C_RESET} (y/${C_GREEN}N${C_RESET}) > " "$*" >&2
400
-      read x
400
+      read -r x
401 401
 
402 402
       if [ -z "${x}" ]
403 403
       then
... ...
@@ -629,7 +629,7 @@ fetch_needed()
629 629
 
630 630
    IFS="
631 631
 "
632
-   for stashdir in `all_repository_stashes ${REPOS_DIR}`
632
+   for stashdir in `all_repository_stashes "${REPOS_DIR}"`
633 633
    do
634 634
       IFS="${DEFAULT_IFS}"
635 635
 
... ...
@@ -773,7 +773,7 @@ _expanded_variables()
773 773
          local url
774 774
 
775 775
          remote="`sed 's/GIT_REMOTE_\(.*\)/\1/' <<< "${key}"`"
776
-         remote="`tr '[A-Z]' '[a-z]' <<< "${remote}"`"
776
+         remote="`tr 'A-Z' 'a-z' <<< "${remote}"`"
777 777
          url="`_git_get_url "${ROOT_DIR}" "${remote}"`"
778 778
          value="`dirname "${url}"`"
779 779
       ;;
... ...
@@ -852,7 +852,7 @@ expanded_variables()
852 852
 
853 853
 is_bootstrap_project()
854 854
 {
855
-   local  masterpath="${1:-.}"
855
+   local masterpath="${1:-.}"
856 856
 
857 857
    [ -d "${masterpath}/${BOOTSTRAP_DIR}" -o -d "${masterpath}/${BOOTSTRAP_DIR}.local" ]
858 858
 }
... ...
@@ -860,7 +860,7 @@ is_bootstrap_project()
860 860
 
861 861
 is_master_bootstrap_project()
862 862
 {
863
-   local  masterpath="${1:-.}"
863
+   local masterpath="${1:-.}"
864 864
 
865 865
    [ -f "${masterpath}/${BOOTSTRAP_DIR}.local/is_master" ]
866 866
 }
... ...
@@ -868,7 +868,7 @@ is_master_bootstrap_project()
868 868
 
869 869
 is_minion_bootstrap_project()
870 870
 {
871
-   local  minionpath="${1:-.}"
871
+   local minionpath="${1:-.}"
872 872
 
873 873
    [ -f "${minionpath}/${BOOTSTRAP_DIR}.local/is_minion" ]
874 874
 }
... ...
@@ -876,7 +876,7 @@ is_minion_bootstrap_project()
876 876
 
877 877
 assert_sane_master_bootstrap_project()
878 878
 {
879
-   local  masterpath="$1"
879
+   local masterpath="$1"
880 880
 
881 881
    if [ -d "${masterpath}/${BOOTSTRAP_DIR}" ]
882 882
    then
... ...
@@ -86,7 +86,7 @@ __collect_libraries()
86 86
 
87 87
    for i in "$1/"*
88 88
    do
89
-      name="`basename "$i"`"
89
+      name="`basename -- "$i"`"
90 90
       case "${name}" in
91 91
          lib*.a|lib*.lib)
92 92
             echo "${name}" | sed 's/\.[^.]*$//' | sed 's/^lib//'
... ...
@@ -103,7 +103,7 @@ __collect_frameworks()
103 103
 
104 104
    for i in "$1/"*
105 105
    do
106
-      name="`basename "$i"`"
106
+      name="`basename -- "$i"`"
107 107
       case "${name}" in
108 108
          *.framework)
109 109
             basename "${name}" | sed 's/\.[^.]*$//'
... ...
@@ -143,13 +143,13 @@ _collect_frameworks()
143 143
 
144 144
 collect_libraries()
145 145
 {
146
-   _collect_libraries "$@" | sort | sort -u
146
+   _collect_libraries | sort | sort -u
147 147
 }
148 148
 
149 149
 
150 150
 collect_frameworks()
151 151
 {
152
-   _collect_frameworks "$@" | sort | sort -u
152
+   _collect_frameworks | sort | sort -u
153 153
 }
154 154
 
155 155
 
... ...
@@ -191,6 +191,7 @@ _flags_binpath_value()
191 191
 {
192 192
    local pathline
193 193
    local line
194
+
194 195
    pathline="`_flags_emit_path_value "${DEPENDENCIES_DIR}/bin"`"
195 196
    line="`_flags_emit_path_value "${ADDICTIONS_DIR}/bin"`"
196 197
 
... ...
@@ -421,7 +422,6 @@ _flags_do_path()
421 422
 
422 423
    local values
423 424
    local line
424
-   local tmppath
425 425
 
426 426
    if [ "${OPTION_INHERIT}" = "YES" ]
427 427
    then
... ...
@@ -822,8 +822,6 @@ paths_main()
822 822
    subdir="`_dependencies_subdir`"
823 823
    DEPENDENCIES_DIR="${DEPENDENCIES_DIR}${subdir}"
824 824
 
825
-   local memo
826
-
827 825
    # hacque
828 826
    PATH_SEPARATOR="${OPTION_PATH_SEPARATOR}"
829 827
 
... ...
@@ -843,7 +841,7 @@ paths_main()
843 841
          ;;
844 842
 
845 843
          "cflags"|"cppflags"|"ldflags"|"binpath"|"frameworkpath"|"headerpath"|"librarypath")
846
-            values="`_flags_${type}_value`"
844
+            values="`"_flags_${type}_value"`"
847 845
             result="`add_line "${result}" "${values}"`"
848 846
          ;;
849 847
 
... ...
@@ -964,7 +964,6 @@ read_repository_file()
964 964
 
965 965
    local srcbootstrap
966 966
    local clones
967
-   local empty_expansion_is_error
968 967
 
969 968
    srcbootstrap="`dirname -- "${srcfile}"`"
970 969
 
... ...
@@ -1205,7 +1204,6 @@ unique_repository_contents()
1205 1204
 #
1206 1205
 sort_repository_file()
1207 1206
 {
1208
-   local stop
1209 1207
    local match
1210 1208
 
1211 1209
    [ -z "${MULLE_BOOTSTRAP_DEPENDENCY_RESOLVE_SH}" ] && . mulle-bootstrap-dependency-resolve.sh
... ...
@@ -187,9 +187,17 @@ _git_clone()
187 187
       log_info "Cloning ${C_MAGENTA}${C_BOLD}${url}${C_INFO} into \"${stashdir}\" ..."
188 188
    fi
189 189
 
190
+   #
190 191
    # "remote urls" go through caches
192
+   # local urls get checked ahead for better error messages
193
+   #
191 194
    case "${url}" in
192
-      file:*|/*|~*|.*)
195
+      file:*)
196
+         if ! git_is_repository "${url}"
197
+         then
198
+            log_error "\"${url}\" is not a git repository ($PWD)"
199
+            return 1
200
+         fi
193 201
       ;;
194 202
 
195 203
       *:*)
... ...
@@ -198,6 +206,14 @@ _git_clone()
198 206
             url="`_git_get_mirror_url "${url}"`" || return 1
199 207
          fi
200 208
       ;;
209
+
210
+      *)
211
+         if ! git_is_repository "${url}"
212
+         then
213
+            log_error "\"${url}\" is not a git repository ($PWD)"
214
+            return 1
215
+         fi
216
+      ;;
201 217
    esac
202 218
 
203 219
 #
... ...
@@ -126,12 +126,12 @@ svn_status_project()
126 126
 
127 127
    local options
128 128
 
129
-   options="$@"
129
+   options="`get_scmoption "${scmoptions}" "status"`"
130 130
 
131 131
    [ ! -z "${stashdir}" ] || internal_fail "stashdir is empty"
132 132
 
133 133
    (
134 134
       exekutor cd "${stashdir}" ;
135
-      exekutor svn status ${options} ${scmoptions} ${SVNOPTIONS}  >&2
135
+      exekutor svn status ${options} ${scmoptions} "$@" ${SVNOPTIONS}  >&2
136 136
    ) || fail "svn update of \"${stashdir}\" failed"
137 137
 }
... ...
@@ -170,13 +170,15 @@ _tar_download()
170 170
       # we are in a tmp dir
171 171
       cachable_path=""
172 172
 
173
-      if ! _archive_test "${filename}" || \
173
+      if ! _archive_test "${cached_archive}" || \
174 174
          ! validate_download "${cached_archive}" "${scmoptions}"
175 175
       then
176 176
          remove_file_if_present "${cached_archive}"
177 177
          cached_archive=""
178
+      else
179
+         exekutor ln -s "${cached_archive}" "${download}" || fail "failed to symlink \"${cached_archive}\""
180
+         return
178 181
       fi
179
-      exekutor ln -s "${cached_archive}" "${download}" || fail "failed to symlink \"${cached_archive}\""
180 182
    fi
181 183
 
182 184
    local options
... ...
@@ -367,7 +367,6 @@ validate_shasum256()
367 367
       ;;
368 368
    esac
369 369
 
370
-   log_fluff "Validating ${C_MAGENTA}${C_BOLD}${filename}${C_INFO} ..."
371 370
 
372 371
    local checksum
373 372
 
... ...
@@ -377,6 +376,7 @@ validate_shasum256()
377 376
       log_error "${filename} sha256 is ${checksum}, not ${expected} as expected"
378 377
       return 1
379 378
    fi
379
+   log_fluff "shasum256 did validate \"${filename}\""
380 380
 }
381 381
 
382 382
 
... ...
@@ -526,9 +526,8 @@ scm_operation()
526 526
 
527 527
 load_scm_plugins()
528 528
 {
529
-   log_entry "load_scm_plugins" "$@"
529
+   log_entry "load_scm_plugins"
530 530
 
531
-   local preference="$1"
532 531
    local upcase
533 532
    local plugindefine
534 533
    local pluginpath
... ...
@@ -543,7 +542,22 @@ load_scm_plugins()
543 542
       IFS="${DEFAULT_IFS}"
544 543
 
545 544
       name="`basename -- "${pluginpath}" .sh`"
546
-      upcase="`tr '[a-z]' '[A-Z]' <<< "${name}"`"
545
+
546
+      # don't load xcodebuild on non macos platforms
547
+      case "${UNAME}" in
548
+         darwin)
549
+         ;;
550
+
551
+         *)
552
+            case "${name}" in
553
+               xcodebuild)
554
+                  continue
555
+               ;;
556
+            esac
557
+         ;;
558
+      esac
559
+
560
+      upcase="`tr 'a-z' 'A-Z' <<< "${name}"`"
547 561
       plugindefine="MULLE_BOOTSTRAP_SCM_PLUGIN_${upcase}_SH"
548 562
 
549 563
       if [ -z "`eval echo \$\{${plugindefine}\}`" ]
... ...
@@ -552,7 +566,7 @@ load_scm_plugins()
552 566
 
553 567
          if [ "`type -t "${name}_clone_project"`" != "function" ]
554 568
          then
555
-            fail "SCM plugin \"${pluginpath}\" has no \"test_${preference}\" function"
569
+            fail "SCM plugin \"${pluginpath}\" has no \"${name}_clone_project\" function"
556 570
          fi
557 571
 
558 572
          log_fluff "SCM plugin \"${name}\" loaded"
... ...
@@ -304,7 +304,7 @@ _read_setting()
304 304
          [ "${key}" != "repositories" -a \
305 305
            "${key}" != "repositories.tmp" -a \
306 306
            "${key}" != "build_order" -a \
307
-           "${key}" != "versions" -a \
307
+           "${key}" != "version" -a \
308 308
            "${key}" != "embedded_repositories" -a \
309 309
            "${key}" != "MULLE_REPOSITORIES" -a \
310 310
            "${key}" != "MULLE_NAT_REPOSITORIES" \
... ...
@@ -431,7 +431,7 @@ list_environment_settings()
431 431
    local envkey
432 432
    local value
433 433
 
434
-   env | while read line
434
+   env | while read -r line
435 435
    do
436 436
       key="`echo "${line}" | \
437 437
             sed -n 's/^MULLE_BOOTSTRAP_\([^=]*\)=.*/\1/p' | \
... ...
@@ -778,7 +778,7 @@ read_expanded_setting()
778 778
 
779 779
    IFS="
780 780
 "
781
-   echo "${value}" | while read line
781
+   echo "${value}" | while read -r line
782 782
    do
783 783
       IFS="${DEFAULT_IFS}"
784 784
 
... ...
@@ -1534,34 +1534,34 @@ _generic_main()
1534 1534
    then
1535 1535
       fail "You can't set overrides and root at the same time"
1536 1536
    fi
1537
-   if [ "${OPTION_OVERRIDES}" = "YES" -a ! -z "${repositories}" ]
1537
+   if [ "${OPTION_OVERRIDES}" = "YES" -a ! -z "${repository}" ]
1538 1538
    then
1539 1539
       fail "You can't set overrides and repository at the same time"
1540 1540
    fi
1541
-   if [ "${OPTION_ROOT}" = "YES" -a ! -z "${repositories}" ]
1541
+   if [ "${OPTION_ROOT}" = "YES" -a ! -z "${repository}" ]
1542 1542
    then
1543 1543
       fail "You can't set root and repository at the same time"
1544 1544
    fi
1545 1545
 
1546 1546
    case "${command}" in
1547 1547
       delete)
1548
-         _${type}_delete "${key}" "${repository}"
1548
+         "_${type}_delete" "${key}" "${repository}"
1549 1549
       ;;
1550 1550
 
1551 1551
       list)
1552
-         _${type}_list "${repository}"
1552
+         "_${type}_list" "${repository}"
1553 1553
       ;;
1554 1554
 
1555 1555
       read)
1556
-         _${type}_read "${key}" "${repository}"
1556
+         "_${type}_read" "${key}" "${repository}"
1557 1557
       ;;
1558 1558
 
1559 1559
       write)
1560 1560
          if [ "${OPTION_APPEND}" = "YES" ]
1561 1561
          then
1562
-            _${type}_append "${key}" "${value}" "${repository}"
1562
+            "_${type}_append" "${key}" "${value}" "${repository}"
1563 1563
          else
1564
-            _${type}_write "${key}" "${value}" "${repository}"
1564
+            "_${type}_write" "${key}" "${value}" "${repository}"
1565 1565
          fi
1566 1566
       ;;
1567 1567
    esac
... ...
@@ -428,7 +428,9 @@ _show_main()
428 428
 
429 429
    log_debug ":show_main:"
430 430
 
431
-   local ROOT_DIR="`pwd -P`"
431
+   local ROOT_DIR
432
+
433
+   ROOT_DIR="`pwd -P`"
432 434
 
433 435
    local SHOW_SCM="NO"
434 436
    local SHOW_URL="NO"
... ...
@@ -216,7 +216,7 @@ merge_framework_configurations()
216 216
       if [ ! -z "${suffix}" ]
217 217
       then
218 218
          dstexe="${dstdir}/${name}${suffix}"
219
-         exekutor cp ${COPYMOVEFLAGS} "${srcexe}" "${dstexe}" >&2
219
+         exekutor cp ${COPYMOVEFLAGS} "${srcexe}" "${dstexe}" >&2
220 220
          exekutor chmod 755 "${dstexe}"  >&2
221 221
       fi
222 222
    done
... ...
@@ -127,30 +127,32 @@ map_configuration()
127 127
 "
128 128
    for i in ${configurations}
129 129
    do
130
-      if [ "$i" = "$xcode_configuration" ]
130
+      if [ "$i" = "${xcode_configuration}" ]
131 131
       then
132 132
          mapped="${xcode_configuration}"
133 133
       fi
134 134
    done
135
-   IFS="${DEFAULT_IFS}"
136 135
 
137
-   if [ "$mapped" = "" ]
136
+   if [ -z "$mapped" ]
138 137
    then
139
-   case i in
140
-      *ebug*)
141
-         mapped="Debug"
138
+      case "${xcode_configuration}" in
139
+         *ebug*)
140
+            mapped="Debug"
142 141
          ;;
143
-      *rofile*)
144
-         mapped="Release"
142
+         *rofile*)
143
+            mapped="Release"
145 144
          ;;
146
-      *eleas*)
147
-         mapped="Release"
145
+         *eleas*)
146
+            mapped="Release"
148 147
          ;;
149
-      *)
150
-         mapped="${default}"
148
+         *)
149
+            mapped="${default}"
151 150
          ;;
152
-   esac
151
+      esac
153 152
    fi
153
+
154
+   IFS="${DEFAULT_IFS}"
155
+
154 156
    echo "${mapped}"
155 157
 }
156 158
 
... ...
@@ -90,24 +90,24 @@ setup_test_case()
90 90
    mkdir -p Boobie
91 91
 
92 92
    (
93
-      cd Master/Minion/.bootstrap && 
93
+      cd Master/Minion/.bootstrap &&
94 94
       echo "Boobie" > embedded_repositories &&
95 95
       echo "Foobie" > repositories
96 96
    ) || exit 1
97 97
 
98 98
    (
99
-      cd Foobie && 
100
-      git init && 
101
-      echo "Foobie" > i_am_foobie.txt && 
102
-      git add i_am_foobie.txt && 
99
+      cd Foobie &&
100
+      git init &&
101
+      echo "Foobie" > i_am_foobie.txt &&
102
+      git add i_am_foobie.txt &&
103 103
       git commit -m "bla bla"
104 104
    ) || exit 1
105 105
 
106 106
    (
107
-      cd Boobie && 
108
-      git init && 
109
-      echo "Boobie" > i_am_boobie.txt && 
110
-      git add i_am_boobie.txt && 
107
+      cd Boobie &&
108
+      git init &&
109
+      echo "Boobie" > i_am_boobie.txt &&
110
+      git add i_am_boobie.txt &&
111 111
       git commit -m "bla bla"
112 112
    ) || exit 1
113 113
 }
... ...
@@ -129,7 +129,7 @@ test_defer()
129 129
    (
130 130
       cd Master/Minion
131 131
 
132
-      run_mulle_bootstrap "$@" emancipate 
132
+      run_mulle_bootstrap "$@" emancipate
133 133
    ) || exit 1
134 134
 
135 135
    expect_missing_file "Master/.bootstrap.local/is_master"
... ...
@@ -173,7 +173,7 @@ test_fetch()
173 173
 
174 174
    (
175 175
       cd Master
176
-      run_mulle_bootstrap clean --minion Minion
176
+      run_mulle_bootstrap clean -m Minion minion-embeds
177 177
    ) || exit 1
178 178
 
179 179
    expect_missing_file "Master/Minion/Boobie/i_am_boobie.txt"
... ...
@@ -85,8 +85,8 @@ setup_test_case()
85 85
 {
86 86
    clear_test_dirs Master Boobie Foobie
87 87
 
88
-   mkdir -p Master/Minion1/.bootstrap
89
-   mkdir -p Master/Minion2/.bootstrap
88
+   mkdir -p Master/Minion1/ && ( cd Master/Minion1; mulle-bootstrap -s init -n)
89
+   mkdir -p Master/Minion2/ && ( cd Master/Minion2; mulle-bootstrap -s init -n)
90 90
    mkdir -p Foobie
91 91
    mkdir -p Boobie
92 92
 
... ...
@@ -166,13 +166,13 @@ test_fetch()
166 166
 Minion2"
167 167
    expect_contents "Master/.bootstrap.auto/minions" "Minion1
168 168
 Minion2"
169
-   expect_contents "Master/.bootstrap.auto/repositories" "Foobie;stashes/Foobie;master;git
170
-Minion2;Minion2;master;git"
169
+   expect_contents "Master/.bootstrap.auto/repositories" "Foobie;stashes/Foobie;master;;git
170
+Minion2;Minion2;master;;git"
171 171
 
172 172
    # abuse space cutting feature of bash here
173
-   expect_contents "Master/.bootstrap.repos/.deep/Minion1.d/Boobie" "Boobie;Minion1/Boobie;master;git"
174
-   expect_contents "Master/.bootstrap.repos/.deep/Minion2.d/Boobie" "Boobie;Minion2/Boobie;master;git"
175
-   expect_contents "Master/.bootstrap.repos/Foobie" "Foobie;stashes/Foobie;master;symlink"
173
+   expect_contents "Master/.bootstrap.repos/.deep/Minion1.d/Boobie" "Boobie;Minion1/Boobie;master;;git"
174
+   expect_contents "Master/.bootstrap.repos/.deep/Minion2.d/Boobie" "Boobie;Minion2/Boobie;master;;git"
175
+   expect_contents "Master/.bootstrap.repos/Foobie" "Foobie;stashes/Foobie;master;;symlink"
176 176
 
177 177
    expect_contents "Master/stashes/Foobie/i_am_foobie.txt" "Foobie"
178 178
    expect_contents "Master/Minion1/Boobie/i_am_boobie.txt" "Boobie"
... ...
@@ -196,13 +196,13 @@ test_move()
196 196
 Minion2"
197 197
    expect_contents "Master/.bootstrap.auto/minions" "Minion2
198 198
 Minion"
199
-   expect_contents "Master/.bootstrap.auto/repositories" "Foobie;stashes/Foobie;master;git
200
-Minion2;Minion2;master;git"
199
+   expect_contents "Master/.bootstrap.auto/repositories" "Foobie;stashes/Foobie;master;;git
200
+Minion2;Minion2;master;;git"
201 201
 
202 202
    # abuse space cutting feature of bash here
203
-   expect_contents "Master/.bootstrap.repos/.deep/Minion.d/Boobie"  "Boobie;Minion/Boobie;master;git"
204
-   expect_contents "Master/.bootstrap.repos/.deep/Minion2.d/Boobie" "Boobie;Minion2/Boobie;master;git"
205
-   expect_contents "Master/.bootstrap.repos/Foobie" "Foobie;stashes/Foobie;master;symlink"
203
+   expect_contents "Master/.bootstrap.repos/.deep/Minion.d/Boobie"  "Boobie;Minion/Boobie;master;;git"
204
+   expect_contents "Master/.bootstrap.repos/.deep/Minion2.d/Boobie" "Boobie;Minion2/Boobie;master;;git"
205
+   expect_contents "Master/.bootstrap.repos/Foobie" "Foobie;stashes/Foobie;master;;symlink"
206 206
 
207 207
    expect_contents "Master/stashes/Foobie/i_am_foobie.txt" "Foobie"
208 208
    expect_contents "Master/Minion/Boobie/i_am_boobie.txt" "Boobie"
... ...
@@ -217,26 +217,26 @@ Minion2;Minion2;master;git"
217 217
 #
218 218
 echo "mulle-bootstrap: `mulle-bootstrap version`(`mulle-bootstrap library-path`)" >&2
219 219
 
220
-setup_test_case
220
+setup_test_case || exit 1
221 221
 
222 222
 echo "-----------------------------------" >&2
223 223
 echo test_defer  >&2
224 224
 echo "-----------------------------------" >&2
225 225
 
226
-test_defer "$@"
226
+test_defer "$@" || exit 1
227 227
 
228 228
 echo "-----------------------------------" >&2
229 229
 echo test_fetch  >&2
230 230
 echo "-----------------------------------" >&2
231 231
 
232 232
 
233
-test_fetch "$@"
233
+test_fetch "$@" || exit 1
234 234
 
235 235
 echo "-----------------------------------" >&2
236 236
 echo test_move  >&2
237 237
 echo "-----------------------------------" >&2
238 238
 
239
-test_move "$@"
239
+test_move "$@" || exit 1
240 240
 
241 241
 echo "succeeded" >&2
242 242
 
... ...
@@ -44,10 +44,10 @@ setup_test_case()
44 44
    mkdir -p b
45 45
 
46 46
    (
47
-      cd b ;
48
-      git init ;
49
-      echo "VfL Bochum 1848" > README.md ;
50
-      git add README.md ;
47
+      cd b &&
48
+      git init &&
49
+      echo "VfL Bochum 1848" > README.md &&
50
+      git add README.md &&
51 51
       git commit -m "bla bla"
52 52
    ) || exit 1
53 53
 
... ...
@@ -62,19 +62,23 @@ test_a()
62 62
       cd a ;
63 63
       if run_mulle_bootstrap "$@" fetch
64 64
       then
65
-         fail "mulle-bootstrap did not fail, though c is required"
65
+         fail "mulle-bootstrap wrongly did not fail, though c is required"
66 66
       fi
67 67
    ) || exit 1
68
+   echo "TEST PASSED" >&2
68 69
 
69 70
    echo "b" > a/.bootstrap/required
71
+   touch a/.bootstrap
70 72
 
71 73
    (
72 74
       cd a ;
73 75