Browse code

Start to unify semi-global OPTION and global FLAG variables. Improve inheritance of deferred repostories. Make some trace flags, log flags which is more comprehensible.

Nat! authored on 09-02-2017 18:57:13
Showing 28 changed files
... ...
@@ -47,17 +47,13 @@ trap_fail()
47 47
 
48 48
 bootstrap_technical_option_usage()
49 49
 {
50
-   if [ "${VERBOSE}" = "YES" -o "${MULLE_BOOTSTRAP_TRACE}" = "YES" ]
50
+   if [ "${VERBOSE}" = "YES" -o "${MULLE_TRACE}" = "YES" ]
51 51
    then
52 52
       cat <<EOF
53
+   -le       : external command execution log output
54
+   -lm       : extended dependency analysis output
55
+   -ls       : extended settings log output
53 56
    -t        : enable shell trace
54
-   -tb       : also trace scripts
55
-   -te       : trace execution
56
-   -tf       : also trace filepath functionality
57
-   -tm       : trace merge and dependencies
58
-   -ts       : also trace settings
59
-   -vv       : very verbose
60
-   -vvv      : extremely vebose
61 57
    -s        : be silent
62 58
 EOF
63 59
    fi
... ...
@@ -212,7 +208,7 @@ _bootstrap_main()
212 208
 
213 209
    if fetch_needed
214 210
    then
215
-      MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap fetch"
211
+      MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap fetch"
216 212
       fetch_main "$@" || exit 1
217 213
       # used for option handling only
218 214
       MULLE_BOOTSTRAP_DID_FETCH="YES"
... ...
@@ -220,7 +216,7 @@ _bootstrap_main()
220 216
 
221 217
    if build_needed
222 218
    then
223
-      MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap build"
219
+      MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap build"
224 220
       build_main "$@" || exit 1
225 221
    fi
226 222
 
... ...
@@ -312,53 +308,56 @@ bootstrap_init()
312 308
 }
313 309
 
314 310
 
311
+#
312
+# variables called flag. because they are indirectly set by flags
313
+#
315 314
 bootstrap_setup_trace()
316 315
 {
317 316
    case "${1}" in
318 317
       VERBOSE)
319
-         MULLE_BOOTSTRAP_FLUFF="NO"
320
-         MULLE_BOOTSTRAP_VERBOSE="YES"
321
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
318
+         MULLE_FLAG_LOG_FLUFF="NO"
319
+         MULLE_FLAG_LOG_VERBOSE="YES"
320
+         if [ -z "${MULLE_FLAG_VERBOSE_BUILD}" ]
322 321
          then
323
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
322
+            MULLE_FLAG_VERBOSE_BUILD="NO"
324 323
          fi
325 324
       ;;
326 325
 
327 326
       FLUFF)
328
-         MULLE_BOOTSTRAP_FLUFF="YES"
329
-         MULLE_BOOTSTRAP_VERBOSE="YES"
330
-         MULLE_EXECUTOR_TRACE="YES"
331
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
327
+         MULLE_FLAG_LOG_FLUFF="YES"
328
+         MULLE_FLAG_LOG_VERBOSE="YES"
329
+         MULLE_FLAG_LOG_EXECUTOR="YES"
330
+         if [ -z "${MULLE_FLAG_VERBOSE_BUILD}" ]
332 331
          then
333
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
332
+            MULLE_FLAG_VERBOSE_BUILD="NO"
334 333
          fi
335 334
       ;;
336 335
 
337 336
       TRACE)
338
-         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
339
-         MULLE_EXECUTOR_TRACE="YES"
340
-         MULLE_BOOTSTRAP_FLUFF="YES"
341
-         MULLE_BOOTSTRAP_VERBOSE="YES"
342
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
337
+         MULLE_FLAG_LOG_SETTINGS="YES"
338
+         MULLE_FLAG_LOG_EXECUTOR="YES"
339
+         MULLE_FLAG_LOG_FLUFF="YES"
340
+         MULLE_FLAG_LOG_VERBOSE="YES"
341
+         if [ -z "${MULLE_FLAG_VERBOSE_BUILD}" ]
343 342
          then
344
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
343
+            MULLE_FLAG_VERBOSE_BUILD="NO"
345 344
          fi
346 345
          bootstrap_dump_env
347 346
       ;;
348 347
 
349 348
       1848)
350
-         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
351
-         MULLE_EXECUTOR_TRACE="NO"
352
-         MULLE_BOOTSTRAP_FLUFF="YES"
353
-         MULLE_BOOTSTRAP_VERBOSE="YES"
354
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
349
+         MULLE_FLAG_LOG_SETTINGS="YES"
350
+         MULLE_FLAG_LOG_EXECUTOR="NO"
351
+         MULLE_FLAG_LOG_FLUFF="YES"
352
+         MULLE_FLAG_LOG_VERBOSE="YES"
353
+         if [ -z "${MULLE_FLAG_VERBOSE_BUILD}" ]
355 354
          then
356
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="YES"
355
+            MULLE_FLAG_VERBOSE_BUILD="YES"
357 356
          fi
358 357
 
359 358
          bootstrap_dump_env
360 359
 
361
-         if [ -z "${MULLE_BOOTSTRAP_POSTPONE_TRACE}" ]
360
+         if [ -z "${MULLE_TRACE_POSTPONE}" ]
362 361
          then
363 362
             log_trace "1848 trace (set -x) started"
364 363
             set -x
... ...
@@ -369,55 +368,51 @@ bootstrap_setup_trace()
369 368
 }
370 369
 
371 370
 
372
-bootstrap_technical_options()
371
+bootstrap_technical_flags()
373 372
 {
374 373
    case "$1" in
375 374
       -n|--dry-run)
376
-         MULLE_EXECUTOR_DRY_RUN="YES"
375
+         MULLE_FLAG_EXECUTOR_DRY_RUN="YES"
377 376
       ;;
378 377
 
379
-      -t|--trace)
380
-         MULLE_BOOTSTRAP_TRACE="1848"
381
-         COPYMOVEFLAGS="-v"
382
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
383
-         MULLE_BOOTSTRAP_PATHS_FLIP_X="YES"
384
-         MULLE_BOOTSTRAP_RESOLVER_FLIP_X="YES"
385
-         MULLE_BOOTSTRAP_SETTINGS_FLIP_X="YES"
386
-         MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="NO"
387
-         ps4string='${BASH_SOURCE[1]##*/}:${LINENO}'
378
+      -le|--log-execution)
379
+         MULLE_FLAG_LOG_EXECUTOR="YES"
388 380
       ;;
389 381
 
390
-      -tb|--trace-scripts)
391
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
392
-         MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="YES"
382
+      -lm|--log-merge)
383
+         MULLE_FLAG_MERGE_LOG="YES"
393 384
       ;;
394 385
 
395
-      -te|--trace-execution)
396
-         MULLE_EXECUTOR_TRACE="YES"
386
+      -ls|--log-settings)
387
+         MULLE_FLAG_LOG_SETTINGS="YES"
397 388
       ;;
398 389
 
399
-      -tf|--trace-filepaths)
400
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
401
-         MULLE_BOOTSTRAP_PATHS_FLIP_X="NO"
390
+      -lsc|--log-script-calls)
391
+         MULLE_FLAG_LOG_SCRIPTS="YES"
402 392
       ;;
403 393
 
404
-      -tm|--trace-merge)
405
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
406
-         MULLE_BOOTSTRAP_TRACE_MERGE="YES"
394
+      -t|--trace)
395
+         MULLE_TRACE="1848"
396
+         COPYMOVEFLAGS="-v"
397
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
398
+         MULLE_TRACE_PATHS_FLIP_X="YES"
399
+         MULLE_TRACE_RESOLVER_FLIP_X="YES"
400
+         MULLE_TRACE_SETTINGS_FLIP_X="YES"
401
+         ps4string='${BASH_SOURCE[1]##*/}:${LINENO}'
407 402
       ;;
408 403
 
409
-      -tr|--trace-resolver)
410
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
411
-         MULLE_BOOTSTRAP_RESOLVER_FLIP_X="NO"
404
+      -tf|--trace-filepaths)
405
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
406
+         MULLE_TRACE_PATHS_FLIP_X="NO"
412 407
       ;;
413 408
 
414
-      -ts|--trace-settings)
415
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
416
-         MULLE_BOOTSTRAP_SETTINGS_FLIP_X="NO"
409
+      -tfpwd|--trace-full-pwd)
410
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
411
+         ps4string='${BASH_SOURCE[1]##*/}:${LINENO} \"\w\"'
417 412
       ;;
418 413
 
419 414
       -tp|--trace-profile)
420
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
415
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
421 416
          case "${UNAME}" in
422 417
             linux)
423 418
                ps4string='$(date "\+ +%s.%N (${BASH_SOURCE[1]##*/}:${LINENO})")'
... ...
@@ -429,46 +424,51 @@ bootstrap_technical_options()
429 424
       ;;
430 425
 
431 426
       -tpo|--trace-postpone)
432
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
433
-         MULLE_BOOTSTRAP_POSTPONE_TRACE=YES
434
-      ;;
435
-
436
-      -tfpwd|--trace-full-pwd)
437
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
438
-         ps4string='${BASH_SOURCE[1]##*/}:${LINENO} \"\w\"'
427
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
428
+         MULLE_TRACE_POSTPONE=YES
439 429
       ;;
440 430
 
441 431
       -tpwd|--trace-pwd)
442
-         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
432
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
443 433
          ps4string='${BASH_SOURCE[1]##*/}:${LINENO} \".../\W\"'
444 434
       ;;
445 435
 
436
+      -tr|--trace-resolver)
437
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
438
+         MULLE_TRACE_RESOLVER_FLIP_X="NO"
439
+      ;;
440
+
441
+      -ts|--trace-settings)
442
+         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
443
+         MULLE_TRACE_SETTINGS_FLIP_X="NO"
444
+      ;;
445
+
446 446
       -v|--verbose)
447
-        [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] && log_warning "${MULLE_BOOTSTRAP_FAIL_PREFIX}: -v after -t invalidates -t"
447
+        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -v after -t invalidates -t"
448 448
 
449
-         MULLE_BOOTSTRAP_TRACE="VERBOSE"
449
+         MULLE_TRACE="VERBOSE"
450 450
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
451 451
       ;;
452 452
 
453
-      -vv|--very-verbose)v
454
-        [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] && log_warning "${MULLE_BOOTSTRAP_FAIL_PREFIX}: -vv after -t invalidates -t"
453
+      -vv|--very-verbose)
454
+        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vv after -t invalidates -t"
455 455
 
456
-         MULLE_BOOTSTRAP_TRACE="FLUFF"
456
+         MULLE_TRACE="FLUFF"
457 457
          COPYMOVEFLAGS="-v"
458 458
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
459 459
       ;;
460 460
 
461 461
       -vvv|--very-verbose-with-settings)
462
-        [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] && log_warning "${MULLE_BOOTSTRAP_FAIL_PREFIX}: -vvv after -t invalidates -t"
462
+        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vvv after -t invalidates -t"
463 463
 
464
-         MULLE_BOOTSTRAP_TRACE="TRACE"
464
+         MULLE_TRACE="TRACE"
465 465
          COPYMOVEFLAGS="-v"
466 466
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
467 467
       ;;
468 468
 
469 469
       -s|--silent)
470
-         MULLE_BOOTSTRAP_TRACE=
471
-         MULLE_BOOTSTRAP_TERSE="YES"
470
+         MULLE_TRACE=
471
+         MULLE_FLAG_LOG_TERSE="YES"
472 472
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
473 473
       ;;
474 474
 
... ...
@@ -534,7 +534,7 @@ bootstrap_main()
534 534
    #
535 535
    while [ $# -ne 0 ]
536 536
    do
537
-      if bootstrap_technical_options "$1"
537
+      if bootstrap_technical_flags "$1"
538 538
       then
539 539
          shift
540 540
          continue
... ...
@@ -542,19 +542,19 @@ bootstrap_main()
542 542
 
543 543
       case "$1" in
544 544
          -a|--prefer-origin)
545
-            MULLE_BOOTSTRAP_ANSWER="NO"
545
+            MULLE_FLAG_ANSWER="NO"
546 546
           ;;
547 547
 
548 548
          -y|--prefer-local)
549
-            MULLE_BOOTSTRAP_ANSWER="YES"
549
+            MULLE_FLAG_ANSWER="YES"
550 550
          ;;
551 551
 
552 552
          -f|--force-fetch)
553
-            MULLE_BOOTSTRAP_DIRTY_HARRY="NO"
553
+            MULLE_FLAG_DIRTY_HARRY="NO"
554 554
          ;;
555 555
 
556 556
          -ig|--ignore-graveyard)
557
-            MULLE_BOOTSTRAP_IGNORE_GRAVEYARD="YES"
557
+            MULLE_FLAG_IGNORE_GRAVEYARD="YES"
558 558
          ;;
559 559
 
560 560
          -h|--help)
... ...
@@ -567,11 +567,11 @@ bootstrap_main()
567 567
          ;;
568 568
 
569 569
          -V|--verbose-build)
570
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="YES"
570
+            MULLE_FLAG_VERBOSE_BUILD="YES"
571 571
          ;;
572 572
 
573 573
          -*)
574
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown option \"$1\""
574
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option \"$1\""
575 575
             mulle_bootstrap_usage
576 576
          ;;
577 577
 
... ...
@@ -583,12 +583,7 @@ bootstrap_main()
583 583
       shift
584 584
    done
585 585
 
586
-   bootstrap_setup_trace "${MULLE_BOOTSTRAP_TRACE}"
587
-
588
-   if [ "${MULLE_EXECUTOR_DRY_RUN}" = "YES" ]
589
-   then
590
-      log_trace "Dry run is active."
591
-   fi
586
+   bootstrap_setup_trace "${MULLE_TRACE}"
592 587
 
593 588
    # source in environment now
594 589
 
... ...
@@ -618,7 +613,7 @@ bootstrap_main()
618 613
          return 1
619 614
       fi
620 615
 
621
-      if [ "${MULLE_BOOTSTRAP_DIRTY_HARRY}" = "YES" ]
616
+      if [ "${MULLE_FLAG_DIRTY_HARRY}" = "YES" ]
622 617
       then
623 618
          case "${command}" in
624 619
             clean|dist-clean|init|status)
... ...
@@ -631,7 +626,7 @@ bootstrap_main()
631 626
       fi
632 627
    fi
633 628
 
634
-   MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
629
+   MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
635 630
    [ $# -eq 0 ] || shift
636 631
 
637 632
    case "${command}" in
... ...
@@ -753,12 +748,12 @@ bootstrap_main()
753 748
       xcode|setup-xcode)
754 749
          . mulle-bootstrap-xcode.sh
755 750
 
756
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap xcode"
751
+         MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap xcode"
757 752
          xcode_main "$@" || exit 1
758 753
       ;;
759 754
 
760 755
       *)
761
-         log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown command \"${command}\""
756
+         log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown command \"${command}\""
762 757
          mulle_bootstrap_usage
763 758
       ;;
764 759
    esac
... ...
@@ -775,7 +770,7 @@ brew_main()
775 770
    #
776 771
    while [ $# -ne 0 ]
777 772
    do
778
-      if bootstrap_technical_options "$1"
773
+      if bootstrap_technical_flags "$1"
779 774
       then
780 775
          shift
781 776
          continue
... ...
@@ -787,7 +782,7 @@ brew_main()
787 782
          ;;
788 783
 
789 784
          -*)
790
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown option \"$1\""
785
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option \"$1\""
791 786
             mulle_brew_usage
792 787
          ;;
793 788
 
... ...
@@ -799,9 +794,9 @@ brew_main()
799 794
       shift
800 795
    done
801 796
 
802
-   bootstrap_setup_trace "${MULLE_BOOTSTRAP_TRACE}"
797
+   bootstrap_setup_trace "${MULLE_TRACE}"
803 798
 
804
-   if [ "${MULLE_EXECUTOR_DRY_RUN}" = "YES" ]
799
+   if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" ]
805 800
    then
806 801
       log_trace "Dry run is active."
807 802
    fi
... ...
@@ -836,7 +831,7 @@ brew_main()
836 831
       fi
837 832
    fi
838 833
 
839
-   MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
834
+   MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
840 835
 
841 836
    case "${command}" in
842 837
       build)
... ...
@@ -929,12 +924,12 @@ brew_main()
929 924
       xcode|setup-xcode)
930 925
          . mulle-bootstrap-xcode.sh
931 926
 
932
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap xcode"
927
+         MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap xcode"
933 928
          xcode_main "$@" || exit 1
934 929
       ;;
935 930
 
936 931
       *)
937
-         log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown command \"${command}\""
932
+         log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown command \"${command}\""
938 933
          mulle_bootstrap_usage
939 934
       ;;
940 935
    esac
... ...
@@ -945,9 +940,9 @@ brew_main()
945 940
 #
946 941
 MULLE_BOOTSTRAP_EXECUTABLE="`basename -- "$0"`"
947 942
 MULLE_BOOTSTRAP_ARGUMENTS="$@"
948
-MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE}"
949
-MULLE_BOOTSTRAP_PID="$$"
950
-export MULLE_BOOTSTRAP_PID
943
+MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE}"
944
+MULLE_EXECUTABLE_PID="$$"
945
+export MULLE_EXECUTABLE_PID
951 946
 
952 947
 
953 948
 bootstrap_init
... ...
@@ -269,14 +269,12 @@ ${line}"
269 269
 
270 270
 _assoc_array_remove()
271 271
 {
272
-   local array
273
-   local key
274
-
275
-   array="$1"
272
+   local array="$1"
273
+   local key="$2"
276 274
 
277 275
    if [ ! -z "${array}" ]
278 276
    then
279
-       key="`_assoc_array_key_check "$2"`"
277
+       key="`_assoc_array_key_check "${key}"`"
280 278
        echo "${array}" | grep -v "^${key}="
281 279
    fi
282 280
 }
... ...
@@ -284,11 +282,10 @@ _assoc_array_remove()
284 282
 
285 283
 assoc_array_get()
286 284
 {
287
-   local array
288
-   local key
285
+   local array="$1"
286
+   local key="$2"
289 287
 
290
-   array="$1"
291
-   key="`_assoc_array_key_check "$2"`"
288
+   key="`_assoc_array_key_check "${key}"`"
292 289
 
293 290
    echo "${array}" | grep "^${key}=" | sed -n 's/^[^=]*=\(.*\)$/\1/p'
294 291
 }
... ...
@@ -296,9 +293,7 @@ assoc_array_get()
296 293
 
297 294
 assoc_array_get_last()
298 295
 {
299
-   local array
300
-
301
-   array="$1"
296
+   local array="$1"
302 297
 
303 298
    echo "${array}" | tail -1 | sed -n 's/^[^=]*=\(.*\)$/\1/p'
304 299
 }
... ...
@@ -306,14 +301,20 @@ assoc_array_get_last()
306 301
 
307 302
 assoc_array_all_keys()
308 303
 {
309
-   local array
310
-
311
-   array="$1"
304
+   local array="$1"
312 305
 
313 306
    echo "${array}" | sed -n 's/^\([^=]*\)=.*$/\1/p'
314 307
 }
315 308
 
316 309
 
310
+assoc_array_all_values()
311
+{
312
+   local array="$1"
313
+
314
+   echo "${array}" | sed -n 's/^[^=]*=\(.*\)$/\1/p'
315
+}
316
+
317
+
317 318
 assoc_array_set()
318 319
 {
319 320
    local array
... ...
@@ -32,184 +32,144 @@ MULLE_BOOTSTRAP_AUTO_UPDATE_SH="included"
32 32
 
33 33
 
34 34
 #
35
-# This function is called initially to setup .bootstrap.auto before
36
-# doing anything else. It is clear that .bootstrap.auto does not exist
37
-#
38
-# copy contents of .bootstrap.local to .bootstrap.auto
39
-# them add contents of .bootstrap to .bootstrap.auto, if not present
35
+# only to be used in bootstrap_auto_create
40 36
 #
41
-bootstrap_auto_create()
37
+_bootstrap_auto_copy()
42 38
 {
43
-   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "empty bootstrap"
44
-
45
-   log_fluff "Creating ${BOOTSTRAP_DIR}.auto from ${BOOTSTRAP_DIR}"
46
-
47
-   assert_mulle_bootstrap_version
48
-
49
-   rmdir_safer "${BOOTSTRAP_DIR}.auto"
50
-   mkdir_if_missing "${BOOTSTRAP_DIR}.auto"
51
-
52
-   #
53
-   # Copy over .local verbatim
54
-   #
55
-   if dir_has_files "${BOOTSTRAP_DIR}.local"
56
-   then
57
-      exekutor cp -Ra ${COPYMOVEFLAGS} "${BOOTSTRAP_DIR}.local/"* "${BOOTSTRAP_DIR}.auto" >&2
58
-   fi
59
-
60
-   if ! dir_has_files "${BOOTSTRAP_DIR}"
61
-   then
62
-      return
63
-   fi
39
+   local dst="$1"
40
+   local src="$2"
41
+   local is_local="$3"
64 42
 
65 43
    #
66 44
    # add stuff from bootstrap folder
67 45
    # don't copy config if exists (it could be malicious)
68 46
    #
69
-   local path
47
+   local filepath
48
+   local dstfilepath
70 49
    local name
50
+   local value
51
+   local match
52
+   local tmpdir
53
+
54
+   #
55
+   # this first stage folds platform specific files
56
+   #
57
+   tmpdir="`mktemp -d /tmp/mulle-bootstrap.XXXXXXXX`"
58
+   inherit_files "${tmpdir}" "${src}"
71 59
 
72 60
    [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
73 61
    IFS="
74 62
 "
75
-   for path in `ls -1 "${BOOTSTRAP_DIR}"`
63
+   for name in `ls -1 "${tmpdir}"` # uppercase first is important!
76 64
    do
77 65
       IFS="${DEFAULT_IFS}"
78
-      name="`basename -- "${path}"`"
66
+
67
+      filepath="${tmpdir}/${name}"
68
+      dstfilepath="${dst}/${name}"
79 69
 
80 70
       case "${name}" in
81 71
          config)
82
-            continue
72
+            if [ "${is_local}" = "YES" ]
73
+            then
74
+               exekutor cp -Ran ${COPYMOVEFLAGS} "${dstfilepath}" "${filepath}"
75
+            fi
83 76
          ;;
84 77
 
85 78
          *.build|settings|overrides)
86
-            if [ -d "${BOOTSTRAP_DIR}/${name}" ]
79
+            if [ -d "${filepath}" ]
87 80
             then
88
-               inherit_files "${BOOTSTRAP_DIR}.auto/${name}" "${BOOTSTRAP_DIR}/${name}"
81
+               exekutor cp -Ran ${COPYMOVEFLAGS} "${dstfilepath}" "${filepath}"
89 82
             fi
90 83
          ;;
91 84
 
92 85
          *)
93
-            exekutor cp -Ran ${COPYMOVEFLAGS}  "${BOOTSTRAP_DIR}/${name}" "${BOOTSTRAP_DIR}.auto/" >&2
86
+            # only inherit, don't override
87
+            if [ -e "${dstfilepath}" ]
88
+            then
89
+               continue
90
+            fi
91
+
92
+            #
93
+            # root settings get the benefit of expansion
94
+            #
95
+            if [ -d "${filepath}" ]
96
+            then
97
+               continue
98
+            fi
99
+
100
+            match="`echo "${filepath}" | sed '/[a-z]/d'`"
101
+            if [ -z "${match}" ] ## has lowercase (not environment)
102
+            then
103
+               # log_fluff "****" "${filepath}" "${src}" "${name}" "${tmpdir}" "****"
104
+               value="`_read_expanded_setting "${filepath}" "${name}" "" "${tmpdir}"`"
105
+               redirect_exekutor "${dstfilepath}" echo "${value}"
106
+            else
107
+               exekutor cp -a ${COPYMOVEFLAGS} "${filepath}" "${dstfilepath}"
108
+            fi
94 109
          ;;
95 110
       esac
96 111
    done
97 112
 
98
-   IFS="${DEFAULT_IFS}"
113
+   # rmdir_safer "${tmpdir}"
99 114
 }
100 115
 
101 116
 
102
-
103
-_bootstrap_auto_refresh_repository_file()
117
+#
118
+# This function is called initially to setup .bootstrap.auto before
119
+# doing anything else. It is clear that .bootstrap.auto does not exist
120
+#
121
+# copy contents of .bootstrap.local to .bootstrap.auto
122
+# them add contents of .bootstrap to .bootstrap.auto, if not present
123
+#
124
+bootstrap_auto_create()
104 125
 {
105
-   local clones
106
-   local stop
107
-   local refreshed
108
-   local match
109
-   local dependency_map
110
-   local unexpanded
126
+   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "empty bootstrap"
111 127
 
112
-   [ -z "${MULLE_BOOTSTRAP_DEPENDENY_RESOLVE_SH}" ] && . mulle-bootstrap-dependency-resolve.sh
128
+   log_fluff "Creating clean \"${BOOTSTRAP_DIR}.auto\" from \"${BOOTSTRAP_DIR}\""
113 129
 
114
-   refreshed=""
115
-   dependency_map=""
130
+   assert_mulle_bootstrap_version
116 131
 
117
-   clones="`read_root_setting "repositories"`"
118
-   if [ -z "${clones}" ]
132
+   rmdir_safer "${BOOTSTRAP_DIR}.auto"
133
+   mkdir_if_missing "${BOOTSTRAP_DIR}.auto"
134
+
135
+   #
136
+   # Copy over .local with config
137
+   #
138
+   if dir_has_files "${BOOTSTRAP_DIR}.local"
119 139
    then
120
-      return
140
+      _bootstrap_auto_copy "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}.local" "YES"
121 141
    fi
122 142
 
123
-   IFS="
124
-"
125
-   for unexpanded in ${clones}
126
-   do
127
-      IFS="${DEFAULT_IFS}"
128
-
129
-      # cat for -e
130
-      match="`echo "${refreshed}" | fgrep -s -x "${unexpanded}"`"
131
-      if [ ! -z "${match}" ]
132
-      then
133
-         continue
134
-      fi
135
-
136
-      refreshed="${refreshed}
137
-${unexpanded}"
138
-
139
-      if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
140
-      then
141
-         log_trace2 "Dealing with ${unexpanded}"
142
-      fi
143
-
144
-      # avoid superflous updates
145
-
146
-      local branch
147
-      local stashdir
148
-      local name
149
-      local scm
150
-      local tag
151
-      local url
152
-      local clone
153
-      local dstdir
154
-
155
-      clone="`expanded_variables "${unexpanded}"`"
156
-      parse_clone "${clone}"
157
-
158
-      dependency_map="`dependency_add "${dependency_map}" "__ROOT__" "${unexpanded}"`"
159
-
160
-      #
161
-      # dependency management, it could be nicer, but isn't.
162
-      # Currently matches only URLs
163
-      #
164
-
165
-      if [ ! -d "${stashdir}" ]
166
-      then
167
-         if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
168
-         then
169
-            log_trace2 "${stashdir} not fetched yet"
170
-         fi
171
-         continue
172
-      fi
143
+   #
144
+   # add stuff from bootstrap folder
145
+   # don't copy config if exists (it could be malicious)
146
+   #
147
+   if dir_has_files "${BOOTSTRAP_DIR}"
148
+   then
149
+      _bootstrap_auto_copy "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}" "NO"
150
+   fi
151
+}
173 152
 
174
-      local sub_repos
175
-      local filename
176 153
 
177
-      filename="${stashdir}/.bootstrap/repositories"
178
-      sub_repos="`read_setting "${filename}" "repositories"`"
179
-      if [ ! -z "${sub_repos}" ]
180
-      then
181
-#                  unexpanded_url="`url_from_clone "${unexpanded}"`"
182
-         dependency_map="`dependency_add_array "${dependency_map}" "${unexpanded}" "${sub_repos}"`"
183
-         if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
184
-         then
185
-            log_trace2 "add \"${unexpanded}\" to __ROOT__ as dependencies"
186
-            log_trace2 "add [ ${sub_repos} ] to ${unexpanded} as dependencies"
187
-         fi
188
-      else
189
-         log_fluff "${name} has no repositories"
190
-      fi
191
-   done
154
+_bootstrap_merge_expanded_settings_in_front()
155
+{
156
+   local addition="$1"
157
+   local original="$2"
192 158
 
193
-   IFS="${DEFAULT_IFS}"
159
+   local settings1
160
+   local settings2
161
+   local name
194 162
 
195
-   #
196
-   # output true repository dependencies
197
-   #
198
-   local repositories
163
+   name="`basename -- "$1"`"
164
+   srcbootstrap="`dirname -- "${1}"`"
199 165
 
200
-   repositories="`dependency_resolve "${dependency_map}" "__ROOT__" | fgrep -v -x "__ROOT__"`"
201
-   if [ ! -z "${repositories}" ]
166
+   settings1="`_read_expanded_setting "$1" "${name}" "" "${srcbootstrap}"`"
167
+   if [ ! -z "$2" ]
202 168
    then
203
-      if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
204
-      then
205
-         log_trace2 "----------------------"
206
-         log_trace2 "resolved dependencies:"
207
-         log_trace2 "----------------------"
208
-         log_trace2 "${repositories}"
209
-         log_trace2 "----------------------"
210
-      fi
211
-      echo "${repositories}" > "${BOOTSTRAP_DIR}.auto/repositories"
169
+      settings2="`_read_setting "$2" "${name}"`"
212 170
    fi
171
+
172
+   _merge_settings_in_front "${settings1}" "${settings2}"
213 173
 }
214 174
 
215 175
 #
... ...
@@ -241,7 +201,6 @@ _bootstrap_auto_merge_root_settings()
241 201
 
242 202
       settingname="`basename -- "${i}"`"
243 203
       srcfile="${directory}/.bootstrap/${settingname}"
244
-
245 204
       if [ -d "${srcfile}" ]
246 205
       then
247 206
          log_fluff "Directory \"${srcfile}\" not copied"
... ...
@@ -250,28 +209,51 @@ _bootstrap_auto_merge_root_settings()
250 209
 
251 210
       dstfile="${BOOTSTRAP_DIR}.auto/${settingname}"
252 211
 
253
-      # cat is for -e
254
-      match="`echo "${NON_MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
255
-      if [ ! -z "${match}" ]
212
+      #
213
+      # "repositories" file gets special treatment
214
+      #
215
+      if [ "${settingname}" = "repositories" ]
256 216
       then
257
-         log_fluff "Setting \"${settingname}\" is not mergable, so ignored"
258
-         continue
259
-      fi
217
+         local newcontents
260 218
 
261
-      # environment is copied over, but crashes if the contents differ
219
+         newcontents="`_bootstrap_merge_expanded_settings_in_front "${srcfile}" ""`"
220
+         if [ -f "${dstfile}" ]
221
+         then
222
+            local contents2
262 223
 
263
-      match="`egrep -s -x "^[A-Z_]+$" <<< "${settingname}"`"
264
-      if [ ! -z "${match}" ]
265
-      then
266
-         _copy_no_clobber_setting_file "${dstfile}" "${srcfile}"
224
+            contents="`cat "${dstfile}"`"
225
+            newcontents="`merge_repository_contents "${contents}" "${newcontents}"`"
226
+         fi
227
+         log_fluff "Copying expanded \"repositories\" from \"${srcfile}\""
228
+
229
+         redirect_exekutor "${dstfile}" echo "${newcontents}"
267 230
          continue
268 231
       fi
269 232
 
270
-      # cat is for -e
233
+      # #
234
+      # # non mergable settings are not merged
235
+      # #
236
+      # match="`echo "${NON_MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
237
+      # if [ ! -z "${match}" ]
238
+      # then
239
+      #    log_fluff "Setting \"${settingname}\" is not mergable, so ignored"
240
+      #    continue
241
+      # fi
242
+
243
+      # #
244
+      # # environment is not copied over
245
+      # #
246
+      # match="`egrep -s -x "^[A-Z_]+$" <<< "${settingname}"`"
247
+      # if [ ! -z "${match}" ]
248
+      # then
249
+      #    log_fluff "Setting \"${settingname}\" is environment, so ignored"
250
+      #    continue
251
+      # fi
252
+
271 253
       match="`echo "${MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
272 254
       if [ -z "${match}" ]
273 255
       then
274
-         log_fluff "Setting \"${settingname}\" is unknown."
256
+         log_fluff "Setting \"${settingname}\" is not mergable, so ignored"
275 257
          continue
276 258
       fi
277 259
 
... ...
@@ -279,15 +261,15 @@ _bootstrap_auto_merge_root_settings()
279 261
       then
280 262
          tmpfile="${BOOTSTRAP_DIR}.auto/${settingname}.tmp"
281 263
 
282
-         log_fluff "Merging \"${settingname}\" from \"${srcfile}\""
264
+         log_fluff "Merging expanded \"${settingname}\" from \"${srcfile}\""
283 265
 
284 266
          exekutor mv ${COPYMOVEFLAGS}  "${dstfile}" "${tmpfile}" >&2 || exit 1
285
-         redirect_exekutor "${dstfile}" exekutor merge_settings_in_front "${srcfile}" "${tmpfile}"  || exit 1
267
+         redirect_exekutor "${dstfile}" _bootstrap_merge_expanded_settings_in_front "${srcfile}" "${tmpfile}"  || exit 1
286 268
          exekutor rm ${COPYMOVEFLAGS}  "${tmpfile}" >&2 || exit 1
287 269
       else
288
-         log_fluff "Copying \"${settingname}\" from \"${srcfile}\""
270
+         log_fluff "Copying expanded \"${settingname}\" from \"${srcfile}\""
289 271
 
290
-         exekutor cp ${COPYMOVEFLAGS}  "${srcfile}" "${dstfile}" >&2 || exit 1
272
+         redirect_exekutor "${dstfile}" _bootstrap_merge_expanded_settings_in_front "${srcfile}" ""
291 273
       fi
292 274
    done
293 275
 
... ...
@@ -305,8 +287,15 @@ bootstrap_auto_update()
305 287
    if [ -d "${directory}/${BOOTSTRAP_DIR}" ]
306 288
    then
307 289
       _bootstrap_auto_merge_root_settings "${directory}"
308
-      _bootstrap_auto_refresh_repository_file "${directory}"
290
+      sort_repository_file "${directory}"
291
+   else
292
+      # could be helpful to user
293
+      if [ -d "${directory}/${BOOTSTRAP_DIR}.local" ]
294
+      then
295
+         log_fluff "Inferior \"${directory}/${BOOTSTRAP_DIR}.local\" ignored"
296
+      fi
309 297
    fi
298
+
310 299
    log_fluff ":bootstrap_auto_update: end"
311 300
 }
312 301
 
... ...
@@ -140,7 +140,7 @@ _brew_install_brews()
140 140
    do
141 141
       IFS="${DEFAULT_IFS}"
142 142
 
143
-      if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${formula}"
143
+      if [ "${OPTION_CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${formula}"
144 144
       then
145 145
          log_info "${C_MAGENTA}${C_BOLD}${formula}${C_INFO} is a system library, so not installing it"
146 146
          continue
... ...
@@ -239,7 +239,9 @@ _brew_common_main()
239 239
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
240 240
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
241 241
 
242
-   CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
242
+   local  OPTION_CHECK_USR_LOCAL_INCLUDE
243
+
244
+   OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
243 245
 
244 246
    while [ $# -ne 0 ]
245 247
    do
... ...
@@ -249,11 +251,11 @@ _brew_common_main()
249 251
          ;;
250 252
 
251 253
          -cs|--check-usr-local-include)
252
-            CHECK_USR_LOCAL_INCLUDE="YES"
254
+            OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
253 255
             ;;
254 256
 
255 257
          -*)
256
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown ${COMMAND} option $1"
258
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown ${COMMAND} option $1"
257 259
             ${USAGE}
258 260
          ;;
259 261
 
... ...
@@ -36,8 +36,8 @@ build_usage()
36 36
    local defc
37 37
    local defkk
38 38
 
39
-   defc="`printf "$CONFIGURATIONS" | tr '\012' ','`"
40
-   if [ "${CLEAN_BEFORE_BUILD}" = "YES" ]
39
+   defc="`printf "$OPTION_CONFIGURATIONS" | tr '\012' ','`"
40
+   if [ "${OPTION_CLEAN_BEFORE_BUILD}" = "YES" ]
41 41
    then
42 42
       defk=""
43 43
       defkk="(default)"
... ...
@@ -289,7 +289,7 @@ collect_and_dispense_product()
289 289
          [ $? -eq 0 ]  || fail "moving files from ${src} to ${dst} failed"
290 290
       fi
291 291
 
292
-      if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
292
+      if [ "$MULLE_FLAG_LOG_VERBOSE" = "YES"  ]
293 293
       then
294 294
          if dir_has_files "${BUILD_DEPENDENCIES_DIR}"
295 295
          then
... ...
@@ -426,7 +426,7 @@ build_fail()
426 426
       printf "${C_RESET}"
427 427
    fi
428 428
 
429
-   if [ "$MULLE_BOOTSTRAP_TRACE" != "1848" ]
429
+   if [ "$MULLE_TRACE" != "1848" ]
430 430
    then
431 431
       log_info "Check the build log: ${C_RESET_BOLD}$1${C_INFO}"
432 432
    fi
... ...
@@ -707,7 +707,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
707 707
    local fallback
708 708
    local localcmakeflags
709 709
 
710
-   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
710
+   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
711 711
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
712 712
    mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
713 713
    localcmakeflags="`read_build_setting "${name}" "cmakeflags"`"
... ...
@@ -783,12 +783,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
783 783
       logfile1="${owd}/${logfile1}"
784 784
       logfile2="${owd}/${logfile2}"
785 785
 
786
-      if [ "$MULLE_BOOTSTRAP_VERBOSE_BUILD" = "YES" ]
786
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
787 787
       then
788 788
          logfile1="`tty`"
789 789
          logfile2="$logfile1"
790 790
       fi
791
-      if [ "$MULLE_EXECUTOR_DRY_RUN" = "YES" ]
791
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
792 792
       then
793 793
          logfile1="/dev/null"
794 794
          logfile2="/dev/null"
... ...
@@ -829,7 +829,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
829 829
       frameworklines="`add_cmake_path "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
830 830
       frameworklines="`add_cmake_path "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
831 831
 
832
-      if [ "${ADD_USR_LOCAL}" = "YES" ]
832
+      if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
833 833
       then
834 834
          includelines="`add_cmake_path "${includelines}" "${USR_LOCAL_INCLUDE}"`"
835 835
          librarylines="`add_cmake_path "${librarylines}" "${USR_LOCAL_LIB}"`"
... ...
@@ -920,7 +920,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
920 920
       done
921 921
 
922 922
       IFS=";"
923
-      if [ "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" = "YES" ]
923
+      if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
924 924
       then
925 925
          IFS="${DEFAULT_IFS}"
926 926
          local_make_flags="${local_make_flags} VERBOSE=1"
... ...
@@ -1020,7 +1020,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1020 1020
    local fallback
1021 1021
    local configureflags
1022 1022
 
1023
-   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
1023
+   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
1024 1024
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
1025 1025
 
1026 1026
    configureflags="`read_build_setting "${name}" "configure_flags"`"
... ...
@@ -1073,12 +1073,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1073 1073
       logfile1="${owd}/${logfile1}"
1074 1074
       logfile2="${owd}/${logfile2}"
1075 1075
 
1076
-      if [ "$MULLE_BOOTSTRAP_VERBOSE_BUILD" = "YES" ]
1076
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1077 1077
       then
1078 1078
          logfile1="`tty`"
1079 1079
          logfile2="$logfile1"
1080 1080
       fi
1081
-      if [ "$MULLE_EXECUTOR_DRY_RUN" = "YES" ]
1081
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
1082 1082
       then
1083 1083
          logfile1="/dev/null"
1084 1084
          logfile2="/dev/null"
... ...
@@ -1119,7 +1119,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1119 1119
       frameworklines="`add_path "${frameworklines}" "${nativewd}/${REFERENCE_DEPENDENCIES_DIR}/${FRAMEWORK_DIR_NAME}"`"
1120 1120
       frameworklines="`add_path "${frameworklines}" "${nativewd}/${REFERENCE_ADDICTIONS_DIR}/${FRAMEWORK_DIR_NAME}"`"
1121 1121
 
1122
-      if [ "${ADD_USR_LOCAL}" = "YES" ]
1122
+      if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
1123 1123
       then
1124 1124
          includelines="`add_path "${includelines}" "${USR_LOCAL_INCLUDE}"`"
1125 1125
          librarylines="`add_path "${librarylines}" "${USR_LOCAL_LIB}"`"
... ...
@@ -1381,7 +1381,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1381 1381
    local mapped
1382 1382
    local fallback
1383 1383
 
1384
-   fallback="`echo "${CONFIGURATIONS}" | tail -1`"
1384
+   fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
1385 1385
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
1386 1386
 
1387 1387
    mapped=`read_build_setting "${name}" "${configuration}.map" "${configuration}"`
... ...
@@ -1458,7 +1458,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1458 1458
    local owd
1459 1459
    local command
1460 1460
 
1461
-   if [ "$MULLE_EXECUTOR_DRY_RUN" != "" ]
1461
+   if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" != "" ]
1462 1462
    then
1463 1463
       command=-showBuildSettings
1464 1464
    else
... ...
@@ -1547,11 +1547,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1547 1547
       # DONT READ CONFIG SETTING IN THIS INDENT
1548 1548
       logfile="${owd}/${logfile}"
1549 1549
 
1550
-      if [ "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" = "YES" ]
1550
+      if [ "${MULLE_FLAG_VERBOSE_BUILD}" = "YES" ]
1551 1551
       then
1552 1552
          logfile="`tty`"
1553 1553
       fi
1554
-      if [ "$MULLE_EXECUTOR_DRY_RUN" = "YES" ]
1554
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
1555 1555
       then
1556 1556
          logfile="/dev/null"
1557 1557
       fi
... ...
@@ -1597,7 +1597,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1597 1597
          dependencies_lib_search_path="${path} ${inherited}"
1598 1598
       fi
1599 1599
 
1600
-      if [ "${ADD_USR_LOCAL}" = "YES" ]
1600
+      if [ "${OPTION_ADD_USR_LOCAL}" = "YES" ]
1601 1601
       then
1602 1602
          dependencies_header_search_path="${path} ${USR_LOCAL_INCLUDE}"
1603 1603
          dependencies_lib_search_path="${path} ${USR_LOCAL_LIB}"
... ...
@@ -1763,11 +1763,11 @@ build_script()
1763 1763
 
1764 1764
       logfile="${owd}/${logfile}"
1765 1765
 
1766
-      if [ "$MULLE_BOOTSTRAP_VERBOSE_BUILD" = "YES" ]
1766
+      if [ "$MULLE_FLAG_VERBOSE_BUILD" = "YES" ]
1767 1767
       then
1768 1768
          logfile="`tty`"
1769 1769
       fi
1770
-      if [ "$MULLE_EXECUTOR_DRY_RUN" = "YES" ]
1770
+      if [ "$MULLE_FLAG_EXECUTOR_DRY_RUN" = "YES" ]
1771 1771
       then
1772 1772
          logfile="/dev/null"
1773 1773
       fi
... ...
@@ -1839,7 +1839,7 @@ build_with_configuration_sdk_preferences()
1839 1839
 
1840 1840
    builddir="${CLONESBUILD_SUBDIR}/${configuration}/${name}"
1841 1841
 
1842
-   if [ -d "${builddir}" -a "${CLEAN_BEFORE_BUILD}" = "YES" ]
1842
+   if [ -d "${builddir}" -a "${OPTION_CLEAN_BEFORE_BUILD}" = "YES" ]
1843 1843
    then
1844 1844
       log_fluff "Cleaning build directory \"${builddir}\""
1845 1845
       rmdir_safer "${builddir}"
... ...
@@ -1978,7 +1978,7 @@ configure"`"
1978 1978
    [ ! -z "${sdks}" ] || fail "setting \"sdks\" must at least contain \"Default\" to build anything"
1979 1979
 
1980 1980
    # settings can override the commandline default
1981
-   configurations="`read_build_setting "${name}" "configurations" "${CONFIGURATIONS}"`"
1981
+   configurations="`read_build_setting "${name}" "configurations" "${OPTION_CONFIGURATIONS}"`"
1982 1982
 
1983 1983
    for sdk in ${sdks}
1984 1984
    do
... ...
@@ -2136,7 +2136,7 @@ build_stashes()
2136 2136
             then
2137 2137
                build_if_alive "${name}" "${stashdir}" || exit  1
2138 2138
             else
2139
-               if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2139
+               if [ "${OPTION_CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2140 2140
                then
2141 2141
                   log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2142 2142
                   :
... ...
@@ -2155,7 +2155,7 @@ build_stashes()
2155 2155
          then
2156 2156
             build_if_alive "${name}" "${stashdir}"|| exit 1
2157 2157
          else
2158
-            if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2158
+            if [ "${OPTION_CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
2159 2159
             then
2160 2160
                log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2161 2161
                :
... ...
@@ -2219,7 +2219,12 @@ build_main()
2219 2219
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]        && . mulle-bootstrap-settings.sh
2220 2220
    [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
2221 2221
 
2222
-   CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
2222
+   local OPTION_CLEAN_BEFORE_BUILD
2223
+   local OPTION_CHECK_USR_LOCAL_INCLUDE
2224
+   local OPTION_CONFIGURATIONS
2225
+   local OPTION_ADD_USR_LOCAL
2226
+
2227
+   OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
2223 2228
 
2224 2229
    #
2225 2230
    # it is useful, that fetch understands build options and
... ...
@@ -2228,22 +2233,21 @@ build_main()
2228 2233
    while [ $# -ne 0 ]
2229 2234
    do
2230 2235
       case "$1" in
2231
-         -K|--clean)
2232
-            CLEAN_BEFORE_BUILD="YES"
2233
-         ;;
2234
-
2235
-         -k|--no-clean)
2236
-            CLEAN_BEFORE_BUILD=
2237
-         ;;
2238
-
2239
-         --prefix)
2236
+         -c|--configuration)
2240 2237
             shift
2241
-            [ $# -ne 0 ] || fail "prefix missing"
2238
+            [ $# -ne 0 ] || fail "configuration names missing"
2242 2239
 
2243
-            USR_LOCAL_INCLUDE="$1/include"
2244
-            USR_LOCAL_LIB="$1/lib"
2240
+            OPTION_CONFIGURATIONS="`printf "%s" "$1" | tr ',' '\012'`"
2241
+            ;;
2242
+
2243
+         -cs|--check-usr-local-include)
2244
+            # set environment to be picked up by config
2245
+            OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
2245 2246
          ;;
2246 2247
 
2248
+         --debug)
2249
+            OPTION_CONFIGURATIONS="Debug"
2250
+         ;;
2247 2251
 
2248 2252
          -j|--cores)
2249 2253
             case "${UNAME}" in
... ...
@@ -2258,28 +2262,29 @@ build_main()
2258 2262
             CORES="$1"
2259 2263
          ;;
2260 2264
 
2261
-         --debug)
2262
-            CONFIGURATIONS="Debug"
2265
+         -k|--no-clean)
2266
+            OPTION_CLEAN_BEFORE_BUILD=
2263 2267
          ;;
2264 2268
 
2265
-         --release)
2266
-            CONFIGURATIONS="Release"
2269
+         -K|--clean)
2270
+            OPTION_CLEAN_BEFORE_BUILD="YES"
2267 2271
          ;;
2268 2272
 
2269
-         -c|--configuration)
2273
+         --prefix)
2270 2274
             shift
2271
-            [ $# -ne 0 ] || fail "configuration names missing"
2275
+            [ $# -ne 0 ] || fail "prefix missing"
2272 2276
 
2273
-            CONFIGURATIONS="`printf "%s" "$1" | tr ',' '\012'`"
2274
-            ;;
2277
+            USR_LOCAL_INCLUDE="$1/include"
2278
+            USR_LOCAL_LIB="$1/lib"
2279
+         ;;
2275 2280
 
2276
-         -cs|--check-usr-local-include)
2277
-            # set environment to be picked up by config
2278
-            CHECK_USR_LOCAL_INCLUDE="YES"
2281
+
2282
+         --release)
2283
+            OPTION_CONFIGURATIONS="Release"
2279 2284
          ;;
2280 2285
 
2281 2286
          --use-prefix-libraries)
2282
-            ADD_USR_LOCAL=YES
2287
+            OPTION_ADD_USR_LOCAL=YES
2283 2288
          ;;
2284 2289
 
2285 2290
          # fetch options, are just ignored
... ...
@@ -2288,7 +2293,7 @@ build_main()
2288 2293
          ;;
2289 2294
 
2290 2295
          -*)
2291
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown build option $1"
2296
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown build option $1"
2292 2297
             build_usage
2293 2298
          ;;
2294 2299
 
... ...
@@ -2323,7 +2328,6 @@ build_main()
2323 2328
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
2324 2329
    [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
2325 2330
 
2326
-
2327 2331
    remove_file_if_present "${REPOS_DIR}/.bootstrap_build_done"
2328 2332
    create_file_if_missing "${REPOS_DIR}/.bootstrap_build_started"
2329 2333
 
... ...
@@ -349,7 +349,7 @@ clean_main()
349 349
          ;;
350 350
 
351 351
          -*)
352
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown clean option $1"
352
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown clean option $1"
353 353
             COMMAND=help
354 354
          ;;
355 355
 
... ...
@@ -42,13 +42,13 @@ build_complete_environment()
42 42
    LIBRARY_DIR_NAME="`read_config_setting "library_dir_name" "lib"`"
43 43
    FRAMEWORK_DIR_NAME="`read_config_setting "framework_dir_name" "Frameworks"`"
44 44
 
45
-   CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
46
-   if [ -z "${CONFIGURATIONS}" ]
45
+   OPTION_CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
46
+   if [ -z "${OPTION_CONFIGURATIONS}" ]
47 47
    then
48
-      CONFIGURATIONS="`read_config_setting "configurations" "Release"`"
49
-      CONFIGURATIONS="`read_root_setting "configurations" "${CONFIGURATIONS}"`"
48
+      OPTION_CONFIGURATIONS="`read_config_setting "configurations" "Release"`"
49
+      OPTION_CONFIGURATIONS="`read_root_setting "configurations" "${OPTION_CONFIGURATIONS}"`"
50 50
    fi
51
-   N_CONFIGURATIONS="`echo "${CONFIGURATIONS}" | wc -l | awk '{ print $1 }'`"
51
+   N_CONFIGURATIONS="`echo "${OPTION_CONFIGURATIONS}" | wc -l | awk '{ print $1 }'`"
52 52
 
53 53
    #
54 54
    # expand PATH for build, but it's kinda slow
... ...
@@ -70,7 +70,7 @@ defer_main()
70 70
          ;;
71 71
 
72 72
          -*)
73
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown option $1"
73
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option $1"
74 74
             defer_usage
75 75
          ;;
76 76
 
... ...
@@ -120,9 +120,8 @@ defer_main()
120 120
 
121 121
    make_master_bootstrap_project "${masterpath}"
122 122
    make_minion_bootstrap_project "${minionpath}" "${masterpath}"
123
-   log_verbose "Adding project as minion to \"${masterpath}\""
123
+   log_info "Deferring to \"${masterpath}\""
124 124
    master_add_minion_bootstrap_project "${masterpath}" "${minionpath}"
125
-   log_info "Project defers to \"${masterpath}\""
126 125
 }
127 126
 
128 127
 
... ...
@@ -138,7 +137,7 @@ emancipate_main()
138 137
          ;;
139 138
 
140 139
          -*)
141
-            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown option $1"
140
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option $1"
142 141
             defer_usage
143 142
          ;;
144 143
 
... ...
@@ -183,10 +182,8 @@ emancipate_main()
183 182
       fail "\"${masterpath}\" is not a master project"
184 183
    fi
185 184
 
186
-   log_verbose "Removing minion from \"${masterpath}\""
185
+   log_info "Emancipating from \"${masterpath}\""
187 186
    master_remove_minion_bootstrap_project "${masterpath}" "${minionpath}"
188 187
    emancipate_minion_bootstrap_project "${minionpath}"
189
-
190
-   log_info "Project is standalone again"
191 188
 }
192 189
 
... ...
@@ -67,7 +67,7 @@ _dependency_add()
67 67
 
68 68
 dependency_add()
69 69
 {
70
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
70
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
71 71
    then
72 72
    #     set +x
73 73
    :
... ...
@@ -75,7 +75,7 @@ dependency_add()
75 75
 
76 76
    _dependency_add "$@"
77 77
 
78
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
78
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
79 79
    then
80 80
    #   set -x
81 81
    :
... ...
@@ -112,14 +112,14 @@ _dependency_add_array()
112 112
 
113 113
 dependency_add_array()
114 114
 {
115
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
115
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
116 116
    then
117 117
       set +x
118 118
    fi
119 119
 
120 120
    _dependency_add_array "$@"
121 121
 
122
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
122
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
123 123
    then
124 124
       set -x
125 125
    fi
... ...
@@ -134,7 +134,7 @@ _dependency_resolve()
134 134
    map="$1"
135 135
    name="$2"
136 136
 
137
-   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
137
+   if [ "$MULLE_FLAG_LOG_SETTINGS" = "YES" -o "$MULLE_FLAG_MERGE_LOG" = "YES"  ]
138 138
    then
139 139
       log_trace2 "resolve ${name}"
140 140
    fi
... ...
@@ -191,7 +191,7 @@ dependency_resolve()
191 191
    RESOLVED_DEPENDENCIES=
192 192
    UNRESOLVED_DEPENDENCIES=
193 193
 
194
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
194
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
195 195
    then
196 196
       set +x
197 197
    fi
... ...
@@ -201,7 +201,7 @@ dependency_resolve()
201 201
    #
202 202
    _dependency_resolve "${map}" "${name}"
203 203
 
204
-   if [ "${MULLE_BOOTSTRAP_RESOLVER_FLIP_X}" = "YES" ]
204
+   if [ "${MULLE_TRACE_RESOLVER_FLIP_X}" = "YES" ]
205 205
    then
206 206
       set -x
207 207
    fi
... ...
@@ -210,7 +210,7 @@ link_command()
210 210
    linkname="`basename -- ${stashdir}`"
211 211
    directory="`dirname -- "${stashdir}"`"
212 212
 
213
-   if [ "${MULLE_EXECUTOR_DRY_RUN}" != "YES" ]
213
+   if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
214 214
    then
215 215
       (
216 216
          cd "${directory}" ;
... ...
@@ -273,7 +273,7 @@ ask_symlink_it()
273 273
       fi
274 274
 
275 275
       flag=1  # means clone it
276
-      if [ "${ALLOW_CREATING_SYMLINKS}" = "YES" ]
276
+      if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" = "YES" ]
277 277
       then
278 278
          local prompt
279 279
 
... ...
@@ -296,7 +296,7 @@ NO is safe, but you often say YES here."
296 296
    fi
297 297
 
298 298
    # can only symlink because not a .git repo yet
299
-   if [ "${ALLOW_CREATING_SYMLINKS}" = "YES" ]
299
+   if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" = "YES" ]
300 300
    then
301 301
       log_info "${clone} is not a git repository (yet ?)"
302 302
       log_info "So symlinking is the only way to go."
... ...
@@ -473,7 +473,7 @@ clone_or_symlink()
473 473
       ;;
474 474
 
475 475
       *)
476
-         if [ "${ALLOW_SEARCH_PARENT}" = "YES" ]
476
+         if [ "${OPTION_ALLOW_SEARCH_PARENT}" = "YES" ]
477 477
          then
478 478
             found="`search_git_repo_in_parent_of_root "${name}" "${branch}"`"
479 479
             if [ -z "${found}" ]
... ...
@@ -483,7 +483,7 @@ clone_or_symlink()
483 483
 
484 484
             if [ ! -z "${found}" ]
485 485
             then
486
-               [ "${ALLOW_AUTOCLONE_PARENT}" = "YES" ] || user_say_yes "There is a \"${found}\" folder in the parent directory of this project.
486
+               [ "${OPTION_ALLOW_AUTOCLONE_PARENT}" = "YES" ] || user_say_yes "There is a \"${found}\" folder in the parent directory of this project.
487 487
 (\"${PWD}\"). Use it ?"
488 488
                if [ $? -eq 0 ]
489 489
                then
... ...
@@ -536,22 +536,28 @@ _clone()
536 536
 
537 537
    assert_sane_parameters "empty is ok"
538 538
 
539
-   if [ "${CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
539
+   if [ "${OPTION_CHECK_USR_LOCAL_INCLUDE}" = "YES" ] && has_usr_local_include "${name}"
540 540
    then
541 541
       log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not fetching it"
542 542
       return 1
543 543
    fi
544 544
 
545
-   if [ "${url}" = "${stashdir}" ]
546
-   then
547
-      is_minion_bootstrap_project "${stashdir}" || fail "\"${stashdir}\" should be a minion but isnt't"
548
-      log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a minion, so skipped"
549
-      return 1
550
-   fi
551
-
552
-
553 545
    if [ -e "${stashdir}" ]
554 546
    then