Browse code

Added mulle-brew command, which is a restricted form of mulle-bootstrap.

Nat! authored on 02-02-2017 21:32:58
Showing 7 changed files
... ...
@@ -168,11 +168,20 @@ then
168 168
 fi
169 169
 
170 170
 
171
-for i in mulle*bootstrap
172
-do
173
-   install -m "${mode}" "${i}" "${bin}/$i" || exit 1
174
-   printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
175
-done
171
+install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-bootstrap" || exit 1
172
+printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap" >&2
173
+
174
+case `uname` in
175
+   MINGW*)
176
+      install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-brew" || exit 1
177
+      printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
178
+   ;;
179
+
180
+   *)
181
+      ln -f "${bin}/mulle-bootstrap" "${bin}/mulle-brew" || exit 1
182
+      printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-brew" >&2
183
+   ;;
184
+esac
176 185
 
177 186
 
178 187
 case `uname` in
... ...
@@ -33,7 +33,6 @@ MULLE_BOOTSTRAP_VERSION_MINOR=0
33 33
 MULLE_BOOTSTRAP_VERSION_PATCH=0
34 34
 
35 35
 MULLE_BOOTSTRAP_VERSION="${MULLE_BOOTSTRAP_VERSION_MAJOR}.${MULLE_BOOTSTRAP_VERSION_MINOR}.${MULLE_BOOTSTRAP_VERSION_PATCH}"
36
-MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap"
37 36
 
38 37
 #
39 38
 # This is the main user interface to mulle-bootstrap
... ...
@@ -46,36 +45,73 @@ trap_fail()
46 45
 }
47 46
 
48 47
 
49
-usage()
48
+bootstrap_technical_option_usage()
50 49
 {
51
-   cat <<EOF
52
-usage: mulle-bootstrap [flags] [command] [options]
53
- Flags:
54
-   -a -y     : default answer to questions (scripts wont be checked)
55
-               -a (clone preferred) -y (local copy/symlink preferred)
56
-   -f        : force operation
57
-   -n        : do nothing creative or destructive
58
-   -v        : -v to be more verbose (-vv or -vvv for more verbosity)
59
-   -DKEY=VAL : define local key/value C style
60
-EOF
61
-
62 50
    if [ ! -z "${VERBOSE}" -o ! -z "${MULLE_BOOTSTRAP_TRACE}" ]
63 51
    then
64 52
       cat <<EOF
65
-   -l        : be more optimistic and faster
66
-   -ig       : ignore .repos/.graveyard
53
+   -t        : enable shell trace
67 54
    -te       : trace execution
68 55
    -tm       : trace merge and dependencies
69 56
    -tss      : also trace scripts
70 57
    -tst      : also trace settings
71 58
    -tsp      : also trace path functionality
72
-   -t        : trace execution
73 59
    -vv       : very verbose
74 60
    -vvv      : extremely vebose
75 61
    -s        : be silent
76
-   -V        : verbose build
77 62
 EOF
78 63
    fi
64
+}
65
+
66
+
67
+mulle_brew_usage()
68
+{
69
+   cat <<EOF
70
+usage: mulle-brew [flags] [command] [options]
71
+ Flags:
72
+   -n        : do nothing creative or destructive
73
+   -v        : -v to be more verbose (-vv or -vvv for more verbosity)
74
+EOF
75
+
76
+   bootstrap_technical_option_usage
77
+
78
+   cat <<EOF
79
+
80
+ Commands:
81
+   install   : fetches brews
82
+   update    : update brew
83
+   upgrade   : upgrade brew fomulae
84
+   init      : initializes a bootstrap project
85
+
86
+ Options are command specific. Use mulle-brew <command> -h for help.
87
+EOF
88
+
89
+   if [ "${UNAME}" = 'darwin' ]
90
+   then
91
+      cat <<EOF
92
+   xcode     : setup xcodeproj settings
93
+EOF
94
+   fi
95
+
96
+   exit 1
97
+}
98
+
99
+
100
+mulle_bootstrap_usage()
101
+{
102
+   cat <<EOF
103
+usage: mulle-bootstrap [flags] [command] [options]
104
+ Flags:
105
+   -a -y     : default answer to questions (scripts wont be checked)
106
+               -a (clone preferred) -y (local copy/symlink preferred)
107
+   -f        : force operation
108
+   -n        : do nothing creative or destructive
109
+   -v        : -v to be more verbose (-vv or -vvv for more verbosity)
110
+   -V        : verbose build
111
+   -DKEY=VAL : define local key/value C style
112
+EOF
113
+
114
+   bootstrap_technical_option_usage
79 115
 
80 116
    cat <<EOF
81 117
 
... ...
@@ -102,8 +138,6 @@ EOF
102 138
 EOF
103 139
    fi
104 140
 
105
-cat <<EOF
106
-EOF
107 141
    exit 1
108 142
 }
109 143
 
... ...
@@ -220,7 +254,7 @@ bootstrap_execute_in_master()
220 254
    [ -d "${master}" ] || fail "master \"${master}\" is gone ($masterpath)"
221 255
 
222 256
    (
223
-      cd "${master}" && mulle-bootstrap "$@"
257
+      cd "${master}" && "${MULLE_BOOTSTRAP_EXECUTABLE}" "$@"
224 258
    ) || fail "master failed"
225 259
 }
226 260
 
... ...
@@ -235,7 +269,7 @@ bootstrap_libexec_path()
235 269
    exedir="`dirname "$1"`"
236 270
    exedirpath="`( cd "${exedir}" ; pwd -P )`" || fail "failed to get pwd"
237 271
    prefix="`dirname "${exedirpath}"`"
238
-   libexecpath="${prefix}/libexec/mulle-bootstrap-3"
272
+   libexecpath="${prefix}/libexec/mulle-bootstrap"
239 273
 
240 274
    if [ ! -x "${libexecpath}/mulle-bootstrap-functions.sh" ]
241 275
    then
... ...
@@ -259,13 +293,9 @@ bootstrap_dump_env()
259 293
 }
260 294
 
261 295
 
262
-bootstrap_main()
296
+bootstrap_init()
263 297
 {
264
-   local command
265 298
    local libexecpath
266
-   local ps4string
267
-
268
-   BOOTSTRAP_DIR=.bootstrap
269 299
 
270 300
    libexecpath="`bootstrap_libexec_path "$0"`"
271 301
    if [ -z "${libexecpath}" ]
... ...
@@ -314,130 +344,249 @@ bootstrap_main()
314 344
    trap trap_fail INT
315 345
 
316 346
    source_environment
317
-   #
318
-   # simple option handling
319
-   #
320
-   while [ $# -ne 0 ]
321
-   do
322
-      case "$1" in
323
-         -a|--prefer-origin)
324
-            MULLE_BOOTSTRAP_ANSWER="NO"
325
-          ;;
347
+}
326 348
 
327
-         -y|--prefer-local)
328
-            MULLE_BOOTSTRAP_ANSWER="YES"
329
-         ;;
330 349
 
331
-         -f|--force-fetch)
332
-            MULLE_BOOTSTRAP_DIRTY_HARRY="NO"
333
-         ;;
350
+bootstrap_setup_trace()
351
+{
352
+   case "${MULLE_BOOTSTRAP_TRACE}" in
353
+      VERBOSE)
354
+         MULLE_BOOTSTRAP_FLUFF="NO"
355
+         MULLE_BOOTSTRAP_VERBOSE="YES"
356
+         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
357
+         then
358
+            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
359
+         fi
360
+      ;;
334 361
 
335
-         -n|--dry-run)
336
-            MULLE_EXECUTOR_DRY_RUN="YES"
337
-         ;;
362
+      FLUFF)
363
+         MULLE_BOOTSTRAP_FLUFF="YES"
364
+         MULLE_BOOTSTRAP_VERBOSE="YES"
365
+         MULLE_EXECUTOR_TRACE="YES"
366
+         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
367
+         then
368
+            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
369
+         fi
370
+      ;;
338 371
 
339
-         -l|--optimistic|--lucky)
340
-            MULLE_BOOTSTRAP_OPTIMISTIC="YES"
341
-         ;;
372
+      TRACE)
373
+         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
374
+         MULLE_EXECUTOR_TRACE="YES"
375
+         MULLE_BOOTSTRAP_FLUFF="YES"
376
+         MULLE_BOOTSTRAP_VERBOSE="YES"
377
+         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
378
+         then
379
+            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
380
+         fi
381
+         bootstrap_dump_env
382
+      ;;
342 383
 
343
-         -ig|--ignore-graveyard)
344
-            MULLE_BOOTSTRAP_IGNORE_GRAVEYARD="YES"
345
-         ;;
384
+      1848)
385
+         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
386
+         MULLE_EXECUTOR_TRACE="NO"
387
+         MULLE_BOOTSTRAP_FLUFF="YES"
388
+         MULLE_BOOTSTRAP_VERBOSE="YES"
389
+         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
390
+         then
391
+            MULLE_BOOTSTRAP_VERBOSE_BUILD="YES"
392
+         fi
346 393
 
347
-         -te|--trace-execution)
348
-            MULLE_EXECUTOR_TRACE="YES"
349
-         ;;
394
+         bootstrap_dump_env
350 395
 
351
-         -tm|--trace-settings-merge)
352
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
353
-            MULLE_BOOTSTRAP_TRACE_MERGE="YES"
354
-         ;;
396
+         if [ -z "${MULLE_BOOTSTRAP_POSTPONE_TRACE}" ]
397
+         then
398
+            log_trace "1848 trace (set -x) started"
399
+            set -x
400
+            PS4="+ ${ps4string} + "
401
+         fi
402
+      ;;
403
+   esac
404
+}
355 405
 
356
-         -tsc|--trace-show-scripts)
357
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
358
-            MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="YES"
359
-         ;;
360 406
 
361
-         -tsr|--trace-show-resolver)
362
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
363
-            MULLE_BOOTSTRAP_RESOLVER_FLIP_X="NO"
364
-         ;;
407
+bootstrap_technical_options()
408
+{
409
+   case "$1" in
410
+      -n|--dry-run)
411
+         MULLE_EXECUTOR_DRY_RUN="YES"
412
+      ;;
365 413
 
366
-         -tss|--trace-show-settings)
367
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
368
-            MULLE_BOOTSTRAP_SETTINGS_FLIP_X="NO"
369
-         ;;
414
+      -te|--trace-execution)
415
+         MULLE_EXECUTOR_TRACE="YES"
416
+      ;;
417
+
418
+      -tm|--trace-settings-merge)
419
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
420
+         MULLE_BOOTSTRAP_TRACE_MERGE="YES"
421
+      ;;
422
+
423
+      -tsc|--trace-show-scripts)
424
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
425
+         MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="YES"
426
+      ;;
427
+
428
+      -tsr|--trace-show-resolver)
429
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
430
+         MULLE_BOOTSTRAP_RESOLVER_FLIP_X="NO"
431
+      ;;
432
+
433
+      -tss|--trace-show-settings)
434
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
435
+         MULLE_BOOTSTRAP_SETTINGS_FLIP_X="NO"
436
+      ;;
437
+
438
+      -tsp|--trace-show-paths)
439
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
440
+         MULLE_BOOTSTRAP_PATHS_FLIP_X="NO"
441
+      ;;
442
+
443
+      -tp|--trace-profile)
444
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
445
+         case "${UNAME}" in
446
+            linux)
447
+               ps4string='$(date "\+ +%s.%N (${BASH_SOURCE[1]##*/}:$LINENO)")'
448
+            ;;
449
+            *)
450
+               ps4string='$(date "\+ +%s (${BASH_SOURCE[1]##*/}:$LINENO)")'
451
+            ;;
452
+         esac
453
+      ;;
454
+
455
+      -tpo|--trace-postponed)
456
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
457
+         MULLE_BOOTSTRAP_POSTPONE_TRACE=YES
458
+      ;;
459
+
460
+      -tfpwd|--trace-full-pwd)
461
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
462
+         ps4string='${BASH_SOURCE[1]##*/}:$LINENO \"\w\"'
463
+      ;;
370 464
 
371
-         -tsp|--trace-show-paths)
372
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
373
-            MULLE_BOOTSTRAP_PATHS_FLIP_X="NO"
465
+
466
+      -tpwd|--trace-pwd)
467
+         [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
468
+         ps4string='${BASH_SOURCE[1]##*/}:$LINENO \".../\W\"'
469
+      ;;
470
+
471
+      -t|--trace)
472
+         MULLE_BOOTSTRAP_TRACE="1848"
473
+         COPYMOVEFLAGS="-v"
474
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
475
+         MULLE_BOOTSTRAP_PATHS_FLIP_X="YES"
476
+         MULLE_BOOTSTRAP_RESOLVER_FLIP_X="YES"
477
+         MULLE_BOOTSTRAP_SETTINGS_FLIP_X="YES"
478
+         MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="NO"
479
+         ps4string='${BASH_SOURCE[1]##*/}:$LINENO'
480
+      ;;
481
+
482
+      -v|--verbose)
483
+         MULLE_BOOTSTRAP_TRACE="VERBOSE"
484
+         COPYMOVEFLAGS="-v"
485
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
486
+      ;;
487
+
488
+      -vv|--very-verbose)
489
+         MULLE_BOOTSTRAP_TRACE="FLUFF"
490
+         COPYMOVEFLAGS="-v"
491
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
492
+      ;;
493
+
494
+      -vvv|--very-verbose-with-settings)
495
+         MULLE_BOOTSTRAP_TRACE="TRACE"
496
+         COPYMOVEFLAGS="-v"
497
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
498
+      ;;
499
+
500
+      -s|--silent)
501
+         MULLE_BOOTSTRAP_TRACE=
502
+         MULLE_BOOTSTRAP_TERSE="YES"
503
+         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
504
+      ;;
505
+
506
+      *)
507
+         return 1
508
+      ;;
509
+   esac
510
+
511
+   return 0
512
+}
513
+
514
+
515
+bootstrap_defer_to_master_if_needed()
516
+{
517
+   local command="$1"
518
+
519
+   #
520
+   # if we have a.bootstrap.local/minion file then
521
+   # some commands can't run, and some commands are re-executed in master
522
+   # and some commands (like fetch and clean) are executed locally AND in the
523
+   # master
524
+   #
525
+   local masterpath
526
+
527
+   masterpath="${BOOTSTRAP_DIR}.local/master"
528
+   if [ -e "${masterpath}" ]
529
+   then
530
+      case "${command}" in
531
+         build)
532
+            log_info "Minion .bootstrap: defer to master for execution"
533
+            exec bootstrap_execute_in_master "${masterpath}" "$@"
374 534
          ;;
375 535
 
376
-         -tp|--trace-profile)
377
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
378
-            case "${UNAME}" in
379
-               linux)
380
-                  ps4string='$(date "\+ +%s.%N (${BASH_SOURCE[1]##*/}:$LINENO)")'
381
-               ;;
382
-               *)
383
-                  ps4string='$(date "\+ +%s (${BASH_SOURCE[1]##*/}:$LINENO)")'
384
-               ;;
385
-            esac
536
+         fetch|install|upgrade|update|clean|dist-clean)
537
+            log_info "Minion .bootstrap: execute partly in master"
538
+            bootstrap_execute_in_master "${masterpath}" "$@"
539
+            EMBEDDED_ONLY=YES
386 540
          ;;
387 541
 
388
-         -tpo|--trace-postponed)
389
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
390
-            MULLE_BOOTSTRAP_POSTPONE_TRACE=YES
542
+         git|setup-xcode|xcode|tag|version)
543
+            log_verbose "Minion .bootstrap: execute locally"
391 544
          ;;
392 545
 
393
-         -tfpwd|--trace-full-pwd)
394
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
395
-            ps4string='${BASH_SOURCE[1]##*/}:$LINENO \"\w\"'
546
+         *)
547
+            fail "This is a minion bootstrap project (${masterpath}), can't continue"
396 548
          ;;
549
+      esac
550
+   fi
551
+}
397 552
 
398 553
 
399
-         -tpwd|--trace-pwd)
400
-            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
401
-            ps4string='${BASH_SOURCE[1]##*/}:$LINENO \".../\W\"'
402
-         ;;
554
+bootstrap_main()
555
+{
556
+   local command
557
+   local ps4string
403 558
 
404
-         -t|--trace)
405
-            MULLE_BOOTSTRAP_TRACE="1848"
406
-            COPYMOVEFLAGS="-v"
407
-            GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
408
-            MULLE_BOOTSTRAP_PATHS_FLIP_X="YES"
409
-            MULLE_BOOTSTRAP_RESOLVER_FLIP_X="YES"
410
-            MULLE_BOOTSTRAP_SETTINGS_FLIP_X="YES"
411
-            MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="NO"
412
-            ps4string='${BASH_SOURCE[1]##*/}:$LINENO'
413
-         ;;
559
+   bootstrap_init
560
+   #
561
+   # simple option handling
562
+   #
563
+   while [ $# -ne 0 ]
564
+   do
565
+      if bootstrap_technical_options "$1"
566
+      then
567
+         shift
568
+         continue
569
+      fi
414 570
 
415
-         -v|--verbose)
416
-            MULLE_BOOTSTRAP_TRACE="VERBOSE"
417
-            COPYMOVEFLAGS="-v"
418
-            GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
419
-         ;;
571
+      case "$1" in
572
+         -a|--prefer-origin)
573
+            MULLE_BOOTSTRAP_ANSWER="NO"
574
+          ;;
420 575
 
421
-         -vv|--very-verbose)
422
-            MULLE_BOOTSTRAP_TRACE="FLUFF"
423
-            COPYMOVEFLAGS="-v"
424
-            GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
576
+         -y|--prefer-local)
577
+            MULLE_BOOTSTRAP_ANSWER="YES"
425 578
          ;;
426 579
 
427
-         -vvv|--very-verbose-with-settings)
428
-            MULLE_BOOTSTRAP_TRACE="TRACE"
429
-            COPYMOVEFLAGS="-v"
430
-            GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
580
+         -f|--force-fetch)
581
+            MULLE_BOOTSTRAP_DIRTY_HARRY="NO"
431 582
          ;;
432 583
 
433
-         -s|--silent)
434
-            MULLE_BOOTSTRAP_TRACE=
435
-            MULLE_BOOTSTRAP_TERSE="YES"
436
-            GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
584
+         -ig|--ignore-graveyard)
585
+            MULLE_BOOTSTRAP_IGNORE_GRAVEYARD="YES"
437 586
          ;;
438 587
 
439 588
          -h|--help)
440
-            usage
589
+            mulle_bootstrap_usage
441 590
          ;;
442 591
 
443 592
          -D*)  # just like C
... ...
@@ -462,58 +611,8 @@ bootstrap_main()
462 611
       shift
463 612
    done
464 613
 
465
-   case "${MULLE_BOOTSTRAP_TRACE}" in
466
-      VERBOSE)
467
-         MULLE_BOOTSTRAP_FLUFF="NO"
468
-         MULLE_BOOTSTRAP_VERBOSE="YES"
469
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
470
-         then
471
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
472
-         fi
473
-      ;;
474
-
475
-      FLUFF)
476
-         MULLE_BOOTSTRAP_FLUFF="YES"
477
-         MULLE_BOOTSTRAP_VERBOSE="YES"
478
-         MULLE_EXECUTOR_TRACE="YES"
479
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
480
-         then
481
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
482
-         fi
483
-      ;;
484
-
485
-      TRACE)
486
-         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
487
-         MULLE_EXECUTOR_TRACE="YES"
488
-         MULLE_BOOTSTRAP_FLUFF="YES"
489
-         MULLE_BOOTSTRAP_VERBOSE="YES"
490
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
491
-         then
492
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
493
-         fi
494
-         bootstrap_dump_env
495
-      ;;
496
-
497
-      1848)
498
-         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
499
-         MULLE_EXECUTOR_TRACE="NO"
500
-         MULLE_BOOTSTRAP_FLUFF="YES"
501
-         MULLE_BOOTSTRAP_VERBOSE="YES"
502
-         if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
503
-         then
504
-            MULLE_BOOTSTRAP_VERBOSE_BUILD="YES"
505
-         fi
506
-
507
-         bootstrap_dump_env
614
+   bootstrap_setup_trace
508 615
 
509
-         if [ -z "${MULLE_BOOTSTRAP_POSTPONE_TRACE}" ]
510
-         then
511
-            log_trace "1848 trace (set -x) started"
512
-            set -x
513
-            PS4="+ ${ps4string} + "
514
-         fi
515
-      ;;
516
-   esac
517 616
 
518 617
    if [ "${MULLE_EXECUTOR_DRY_RUN}" = "YES" ]
519 618
    then
... ...
@@ -544,38 +643,7 @@ bootstrap_main()
544 643
          ;;
545 644
       esac
546 645
    else
547
-      #
548
-      # if we have a.bootstrap.local/minion file then
549
-      # some commands can't run, and some commands are re-executed in master
550
-      # and some commands (like fetch and clean) are executed locally AND in the
551
-      # master
552
-      #
553
-      local masterpath
554
-
555
-      masterpath="${BOOTSTRAP_DIR}.local/master"
556
-      if [ -e "${masterpath}" ]
557
-      then
558
-         case "${command}" in
559
-            build)
560
-               log_info "Minion .bootstrap: defer to master for execution"
561
-               exec bootstrap_execute_in_master "${masterpath}" "$@"
562
-            ;;
563
-
564
-            fetch|install|upgrade|update|clean|dist-clean)
565
-               log_info "Minion .bootstrap: execute partly in master"
566
-               bootstrap_execute_in_master "${masterpath}" "$@"
567
-               EMBEDDED_ONLY=YES
568
-            ;;
569
-
570
-            git|setup-xcode|xcode|tag|version)
571
-               log_verbose "Minion .bootstrap: execute locally"
572
-            ;;
573
-
574
-            *)
575
-               fail "This is a minion bootstrap project (${masterpath}), can't continue"
576
-            ;;
577
-         esac
578
-      fi
646
+      bootstrap_defer_to_master_if_needed "$@"
579 647
 
580 648
       if [ "${MULLE_BOOTSTRAP_DIRTY_HARRY}" != "NO" ]
581 649
       then
... ...
@@ -591,7 +659,7 @@ bootstrap_main()
591 659
       fi
592 660
    fi
593 661
 
594
-   MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap ${command}"
662
+   MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
595 663
 
596 664
    case "${command}" in
597 665
       bootstrap|nomagic)
... ...
@@ -700,7 +768,176 @@ bootstrap_main()
700 768
    esac
701 769
 }
702 770
 
703
-bootstrap_main "$@"
771
+
772
+brew_main()
773
+{
774
+   local command
775
+   local ps4string
776
+
777
+   bootstrap_init
778
+   #
779
+   # simple option handling
780
+   #
781
+   while [ $# -ne 0 ]
782
+   do
783
+      if bootstrap_technical_options "$1"
784
+      then
785
+         shift
786
+         continue
787
+      fi
788
+
789
+      case "$1" in
790
+         -h|--help)
791
+            mulle_brew_usage
792
+         ;;
793
+         -*)
794
+            log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown flag \"$1\""
795
+            usage
796
+         ;;
797
+
798
+         *)
799
+            break
800
+         ;;
801
+      esac
802
+
803
+      shift
804
+   done
805
+
806
+   bootstrap_setup_trace
807
+
808
+   if [ "${MULLE_EXECUTOR_DRY_RUN}" = "YES" ]
809
+   then
810
+      log_trace "Dry run is active."
811
+   fi
812
+
813
+   # source in environment now
814
+
815
+   local_environment_main
816
+
817
+   #
818
+   # some commands only run when we have a .bootstrap folder
819
+   #
820
+   command=${1:-"install"}
821
+   [ $# -eq 0 ] || shift
822
+
823
+   if [ ! -d "${BOOTSTRAP_DIR}" ]
824
+   then
825
+      case "$1" in
826
+         -h|--help)
827
+         ;;
828
+
829
+         *)
830
+            case "${command}" in
831
+            dist|clean|dist-clean|install|upgrade|update|setup-xcode|xcode)
832
+               fail "There is no ${BOOTSTRAP_DIR} folder here, can't continue"
833
+            esac
834
+         ;;
835
+      esac
836
+   else
837
+      bootstrap_defer_to_master_if_needed "$@"
838
+   fi
839
+
840
+   MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
841
+
842
+   case "${command}" in
843
+      build)
844
+         . mulle-bootstrap-build.sh
845
+
846
+         build_main "$@" || exit 1
847
+      ;;
848
+
849
+      clean)
850
+         . mulle-bootstrap-clean.sh
851
+
852
+         clean_main "$@" || exit 1
853
+      ;;
854
+
855
+      config)
856
+         . mulle-bootstrap-settings.sh
857
+
858
+         config_main "$@" || exit 1
859
+      ;;
860
+
861
+      setting)
862
+         . mulle-bootstrap-settings.sh
863
+
864
+         setting_main "$@" || exit 1
865
+      ;;
866
+
867
+      dist)
868
+         . mulle-bootstrap-clean.sh
869
+
870
+         clean_main "dist" || exit 1
871
+      ;;
872
+
873
+      init)
874
+         . mulle-bootstrap-init.sh
875
+
876
+         init_main "$@" || exit 1
877
+      ;;
878
+
879
+      install|fetch)
880
+         . mulle-bootstrap-brew.sh
881
+
882
+         brew_install_main "$@" || exit 1
883
+      ;;
884
+
885
+      library-path)
886
+         echo "$PATH" | tr ':' '\012' | head -1
887
+         return 0
888
+      ;;
889
+
890
+      update)
891
+         . mulle-bootstrap-brew.sh
892
+
893
+         brew_update_main "$@" || exit 1
894
+      ;;
895
+
896
+      upgrade)
897
+         . mulle-bootstrap-brew.sh
898
+
899
+         brew_upgrade_main "$@" || exit 1
900
+      ;;
901
+
902
+      setup-xcode|xcode)
903
+         . mulle-bootstrap-xcode.sh
904
+
905
+         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap xcode"
906
+         xcode_main "$@" || exit 1
907
+      ;;
908
+
909
+      uname)
910
+         echo "${UNAME}"
911
+         exit 0
912
+      ;;
913
+
914
+      version)
915
+         echo "${MULLE_BOOTSTRAP_VERSION}"
916
+         return 0
917
+      ;;
918
+
919
+      *)
920
+         log_error "${MULLE_BOOTSTRAP_FAIL_PREFIX}: Unknown command \"${command}\""
921
+         usage
922
+      ;;
923
+   esac
924
+}
925
+
926
+#
927
+# service both names
928
+#
929
+MULLE_BOOTSTRAP_EXECUTABLE="`basename -- "$0"`"
930
+MULLE_BOOTSTRAP_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE}"
931
+
932
+case "${MULLE_BOOTSTRAP_EXECUTABLE}" in
933
+   "mulle-brew")
934
+      brew_main "$@"
935
+   ;;
936
+
937
+   "mulle-bootstrap")
938
+      bootstrap_main "$@"
939
+   ;;
940
+esac
704 941
 
705 942
 trap - TERM EXIT
706 943
 
... ...
@@ -32,7 +32,7 @@ MULLE_BOOTSTRAP_BREW_SH="included"
32 32
 
33 33
 
34 34
 
35
-brew_usage()
35
+_brew_usage()
36 36
 {
37 37
    cat <<EOF >&2
38 38
 usage:
... ...
@@ -56,9 +56,6 @@ EOF
56 56
 #    directory
57 57
 #
58 58
 
59
-BREW="${ADDICTIONS_DIR}/bin/brew"
60
-
61
-
62 59
 fetch_brew_if_needed()
63 60
 {
64 61
    if [ -x "${BREW}" ]
... ...
@@ -105,11 +102,22 @@ brew_install_brews()
105 102
 
106 103
    log_fluff "Looking for brews"
107 104
 
108
-   brews=`read_root_setting "brews" | sort | sort -u`
105
+   brews="`read_root_setting "brews" | sort | sort -u`"
109 106
    if [ -z "${brews}" ]
110 107
    then
111
-      log_fluff "No brews found"
112
-      return
108
+      brews="`(
109
+         MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=YES
110
+         read_root_setting "brews" | sort | sort -u
111
+         )`"
112
+
113
+      if [ -z "${brews}" ]
114
+      then
115
+         log_fluff "No brews found"
116
+         return
117
+      fi
118
+   else
119
+      log_info "Setting read from .bootstrap.auto folder. \
120
+You might want to use mulle-bootstrap instead of mulle-brew."
113 121
    fi
114 122
 
115 123
    fetch_brew_if_needed
... ...
@@ -170,7 +178,6 @@ brew_install_brews()
170 178
 }
171 179
 
172 180
 
173
-
174 181
 _brew_common_install()
175 182
 {
176 183
    if [ $# -ne 0 ]
... ...
@@ -244,21 +251,15 @@ _brew_common_main()
244 251
       shift
245 252
    done
246 253
 
247
-   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ]           && . mulle-bootstrap-scripts.sh
254
+   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
255
+   [ -z "${ADDICTIONS_DIR}" ] && internal_fail "missing ADDICTIONS_DIR"
256
+
257
+   BREW="${ADDICTIONS_DIR}/bin/brew"
248 258
 
249 259
    #
250 260
    # should we check for '/usr/local/include/<name>' and don't fetch if
251 261
    # present (somewhat dangerous, because we do not check versions)
252 262
    #
253
-
254
-
255
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_brew_done"
256
-
257
-   #
258
-   # Run prepare scripts if present
259
-   #
260
-   create_file_if_missing "${REPOS_DIR}/.bootstrap_brew_started"
261
-
262 263
    case "${COMMAND}" in
263 264
       install)
264 265
          _brew_common_install "$@"
... ...
@@ -271,10 +272,10 @@ _brew_common_main()
271 272
       upgrade)
272 273
          _brew_common_upgrade "$@"
273 274
       ;;
274
-   esac
275 275
 
276
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_brew_started"
277
-   create_file_if_missing "${REPOS_DIR}/.bootstrap_brew_done"
276
+      *)
277
+         internal_fail "Command \"${COMMAND}\" is unknown"
278
+   esac
278 279
 }
279 280
 
280 281
 
... ...
@@ -282,7 +283,7 @@ brew_upgrade_main()
282 283
 {
283 284
    log_fluff "::: brew upgrade begin :::"
284 285
 
285
-   USAGE="brew_usage"
286
+   USAGE="_brew_usage"
286 287
    COMMAND="upgrade"
287 288
    _brew_common_main "$@"
288 289
 
... ...
@@ -294,7 +295,7 @@ brew_update_main()
294 295
 {
295 296
    log_fluff "::: brew update begin :::"
296 297
 
297
-   USAGE="brew_usage"
298
+   USAGE="_brew_usage"
298 299
    COMMAND="update"
299 300
    _brew_common_main "$@"
300 301
 
... ...
@@ -302,19 +303,18 @@ brew_update_main()
302 303
 }
303 304
 
304 305
 
305
-brew_fetch_main()
306
+brew_install_main()
306 307
 {
307
-   log_fluff "::: brew fetch begin :::"
308
+   log_fluff "::: brew install begin :::"
308 309
 
309
-   USAGE="brew_usage"
310
-   COMMAND="fetch"
310
+   USAGE="_brew_usage"
311
+   COMMAND="install"
311 312
    _brew_common_main "$@"
312 313
 
313
-   log_fluff "::: brew fetch end :::"
314
+   log_fluff "::: brew install end :::"
314 315
 }
315 316
 
316 317
 
317
-
318 318
 brew_initialize()
319 319
 {
320 320
    log_fluff ":brew_initialize:"
... ...
@@ -1598,6 +1598,9 @@ _common_main()
1598 1598
       ;;
1599 1599
    esac
1600 1600
 
1601
+   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_done"
1602
+   create_file_if_missing "${REPOS_DIR}/.bootstrap_fetch_started"
1603
+
1601 1604
    if [ "${BREW_PERMISSIONS}" != "none" ]
1602 1605
    then
1603 1606
       [ -z "${MULLE_BOOTSTRAP_BREW_SH}" ] && . mulle-bootstrap-brew.sh
... ...
@@ -1605,9 +1608,6 @@ _common_main()
1605 1608
 
1606 1609
    [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
1607 1610
 
1608
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_done"
1609
-   create_file_if_missing "${REPOS_DIR}/.bootstrap_fetch_started"
1610
-
1611 1611
    case "${COMMAND}" in
1612 1612
       fetch)
1613 1613
          _common_fetch "$@"
... ...
@@ -46,15 +46,65 @@ EOF
46 46
 }
47 47
 
48 48
 
49
+init_add_brews()
50
+{
51
+   redirect_exekutor "${BOOTSTRAP_DIR}/brews" cat <<EOF
52
+#
53
+# Add homebrew packages to this file (https://brew.sh/)
54
+#
55
+# mulle-bootstrap [fetch] will install those into "${ADDICTIONS_DIR}"
56
+#
57
+# e.g.
58
+# byacc
59
+#
60
+EOF
61
+}
62
+
63
+
64
+_init_add_repositories()
65
+{
66
+   redirect_exekutor "${BOOTSTRAP_DIR}/$1" cat <<EOF
67
+#
68
+# Add repository URLs to this file.
69
+#
70
+# mulle-bootstrap [fetch] will download these into your project root
71
+# mulle-bootstrap [build] will NOT build them
72
+#
73
+# Each line consists of four fields, only the URL is necessary.
74
+# Possible URL forms for repositories:
75
+#
76
+# https://www.mulle-kybernetik.com/repositories/MulleScion
77
+# git@github.com:mulle-nat/MulleScion.git
78
+# ../MulleScion
79
+# /Volumes/Source/srcM/MulleScion
80
+#
81
+# With SUBDIR you can place the embedded repository somewhere in your
82
+# project directory structure. By default it will be placed into \"stashes\"
83
+# BRANCH is the specific branch to fetch.
84
+# TAG can be a git branch or a tag to checkout. SCM can be \"git\" or \"svn\".
85
+#
86
+# URL;SUBDIR;TAG;SCM
87
+# ================
88
+# ex. foo.com/bla.git;src/mybla;release;git
89
+# ex. foo.com/bla.svn;;;svn
90
+#
91
+#
92
+EOF
93
+}
94
+
95
+
96
+
49 97
 #
50 98
 # this script creates a .bootstrap folder with some
51 99
 # demo files.
52 100
 #
53 101
 init_main()
54 102
 {
103
+   local mainfile
104
+
55 105
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
56
-   [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
57
-   [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
106
+   [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
107
+   [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ]         && . mulle-bootstrap-functions.sh
58 108
 
59 109
    CREATE_DEFAULT_FILES="`read_config_setting "create_default_files" "YES"`"
60 110
    CREATE_EXAMPLE_FILES="`read_config_setting "create_example_files" "NO"`"
... ...
@@ -98,20 +148,6 @@ init_main()
98 148
       exit 1
99 149
    fi
100 150
 
101
-   project=""
102
-   for i in *.xcodeproj/project.pbxproj
103
-   do
104
-      if [ -f "$i" ]
105
-      then
106
-        if [ "$project" != "" ]
107
-        then
108
-           fail "more than one xcodeproj found, cant' deal with it"
109
-        fi
110
-        project="$i"
111
-      fi
112
-   done
113
-
114
-
115 151
    log_fluff "Create \"${BOOTSTRAP_DIR}\""
116 152
    mkdir_if_missing "${BOOTSTRAP_DIR}"
117 153
 
... ...
@@ -131,131 +167,26 @@ EOF
131 167
 # mod-pbxproj
132 168
 #EOF
133 169
 
134
-      redirect_exekutor "${BOOTSTRAP_DIR}/repositories" cat <<EOF
135
-#
136
-# Add repository URLs to this file.
137
-#
138
-# mulle-bootstrap [fetch] will download these into "${REPOS_DIR}"
139
-# mulle-bootstrap [build] will then build them into "${DEPENDENCIES_DIR}"
140
-#
141
-# Each line consists of four fields, only the URL is necessary.
142
-# Possible URL forms for repositories:
143
-#
144
-# https://www.mulle-kybernetik.com/repositories/MulleScion
145
-# git@github.com:mulle-nat/MulleScion.git
146
-# ../MulleScion
147
-# /Volumes/Source/srcM/MulleScion
148
-#
149
-# The NAME should only be used, if you have an actual name conflict
150
-# in your dependencies. BRANCH can be a git branch. SCM can
151
-# be git or svn. TAG can be specific tag on this branch
152
-#
153
-# URL;NAME;BRANCH;SCM;TAG
154
-# ================
155
-# ex. foo.com/bla.git;bla2;release;git;bla-tag
156
-# ex. foo.com/bla.svn;;;svn;
157
-#
158
-EOF
159
-
160
-      redirect_exekutor "${BOOTSTRAP_DIR}/embedded_repositories" cat <<EOF
161
-#
162
-# Add repository URLs to this file.
163
-#
164
-# mulle-bootstrap [fetch] will download these into your project root
165
-# mulle-bootstrap [build] will NOT build them
166
-#
167
-# Each line consists of four fields, only the URL is necessary.
168
-# Possible URL forms for repositories:
169
-#
170
-# https://www.mulle-kybernetik.com/repositories/MulleScion
171
-# git@github.com:mulle-nat/MulleScion.git
172
-# ../MulleScion
173
-# /Volumes/Source/srcM/MulleScion
174
-#
175
-# With SUBDIR you can place the embedded repository somewhere in your
176
-# project directory structure. TAG can be a git branch or a tag. SCM can
177
-# be git or svn.
178
-#
179
-# URL;SUBDIR;TAG;SCM
180
-# ================
181
-# ex. foo.com/bla.git;src/mybla;release;git
182
-# ex. foo.com/bla.svn;;;svn
183
-#
184
-#
185
-EOF
186
-      redirect_exekutor "${BOOTSTRAP_DIR}/brews" cat <<EOF
187
-#
188
-# Add homebrew packages to this file (https://brew.sh/)
189
-#
190
-# mulle-bootstrap [fetch] will install those into "${ADDICTIONS_DIR}"
191
-#
192
-# e.g.
193
-# zlib
194
-#
195
-EOF
196
-   fi
197
-
198
-   if [ "${CREATE_EXAMPLE_FILES}" = "YES" ]
199
-   then
200
-      log_verbose "Create example repository settings"
201
-
202
-      mkdir_if_missing "${BOOTSTRAP_DIR}/MulleScion.example/bin"
203
-
204
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/Release.map" cat <<EOF
205
-# map configuration Release in project MulleScion to DebugRelease
206
-# leave commented out or delete file for no mapping
207
-# DebugRelease
208
-EOF
209
-
210
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/project" cat <<EOF
211
-# Specify a xcodeproj to compile in project MulleScion instead of the default
212
-# leave commented out or delete file for default project
213
-# mulle-scion
214
-EOF
215
-
216
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/scheme" cat <<EOF
217
-# Specify a scheme to compile in project MulleScion instead of the default
218
-# Might bite itself with TARGET, so only specify one.
219
-# leave commented out or delete file for default scheme
220
-# mulle-scion
221
-EOF
222
-
223
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/target" cat <<EOF
224
-# Specify a target to compile in project MulleScion instead of the default.
225
-# Might bite itself with SCHEME, so only specify one.
226
-# leave commented out or delete file for default scheme
227
-# mulle-scion
228
-EOF
229
-
230
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/bin/post-install.sh" cat <<EOF
231
-# Run some commands after installing project MulleScion
232
-# leave commented out or delete file for no action
233
-# chmod 755 ${BOOTSTRAP_DIR}/MulleScion.example/bin/post-install.sh
234
-# to make it work
235
-# echo "1848"
236
-EOF
237
-#chmod 755 "${BOOTSTRAP_DIR}/MulleScion.example/bin/post-install.sh"
238
-
239
-      redirect_exekutor "${BOOTSTRAP_DIR}/MulleScion.example/bin/post-update.sh" cat <<EOF
240
-# Run some commands after upgrading project MulleScion
241
-# leave commented out or delete file for no action
242
-# chmod 755 ${BOOTSTRAP_DIR}/MulleScion.example/bin/post-update.sh
243
-# to make it work
244
-# echo "1848"
245
-EOF
246
-#chmod 755 "${BOOTSTRAP_DIR}/MulleScion.example/bin/post-upgrade.sh"
170
+      init_add_brews
247 171
 
172
+      if [ "${MULLE_BOOTSTRAP_EXECUTABLE}" = "mulle-bootstrap" ]
173
+      then
174
+         mainfile="repositories"
175
+         init_add_repositories "repositories"
176
+         init_add_repositories "embedded_repositories"
177
+      else
178
+         mainfile="brews"
179
+      fi
248 180
    fi
249 181
 
250 182
    log_verbose "\"${BOOTSTRAP_DIR}\" folder has been set up."
251 183
 
252 184
    local open
253 185
 
254
-   open="`read_config_setting "open_repositories_file" "ASK"`"
255
-
186
+   open="`read_config_setting "open_${mainfile}_file" "ASK"`"
256 187
    if [ "${open}" = "ASK" ]
257 188
    then
258
-      user_say_yes "Edit the ${C_MAGENTA}${C_BOLD}repositories${C_WARNING} file now ?"
189
+      user_say_yes "Edit the ${C_MAGENTA}${C_BOLD}${mainfile}${C_WARNING} file now ?"
259 190
       if [ $? -eq 0 ]
260 191
       then
261 192
           open="YES"
... ...
@@ -267,6 +198,6 @@ EOF
267 198
       local editor
268 199
 
269 200
       editor="`read_config_setting "editor" "${EDITOR:-vi}"`"
270
-      exekutor "${editor}" "${BOOTSTRAP_DIR}/repositories"
201
+      exekutor "${editor}" "${BOOTSTRAP_DIR}/${mainfile}"
271 202
    fi
272 203
 }
... ...
@@ -46,7 +46,7 @@ user_say_yes()
46 46
            "$x" != "" ]
47 47
    do
48 48
       printf "${C_WARNING}%b${C_RESET} (y/${C_GREEN}N${C_RESET}) > " "$*" >&2
49
-      read -x
49
+      read x
50 50
       x=`echo "${x}" | tr 'a-z' 'A-Z'`
51 51
    done
52 52
 
... ...
@@ -389,10 +389,10 @@ source_environment()
389 389
 }
390 390
 
391 391
 
392
-   #
393
-   # read local environment
394
-   # source this file
395
-   #
392
+#
393
+# read local environment
394
+# source this file
395
+#
396 396
 local_environment_initialize()
397 397
 {
398 398
    [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
... ...
@@ -420,12 +420,6 @@ local_environment_initialize()
420 420
            MULLE_BOOTSTRAP_VERBOSE="YES"
421 421
          fi
422 422
 
423
-         # be optimistic because it's too slow on windows
424
-         if [ -z "${MULLE_BOOTSTRAP_OPTIMISTIC}" ]
425
-         then
426
-           MULLE_BOOTSTRAP_OPTIMISTIC="YES"
427
-         fi
428
-
429 423
          PATH_SEPARATOR=';'
430 424
          USR_LOCAL_LIB=~/lib
431 425
          USR_LOCAL_INCLUDE=~/include
... ...
@@ -64,43 +64,28 @@ run_script()
64 64
 }
65 65
 
66 66
 
67
-# run in subshell
68
-run_fake_environment_script()
67
+run_root_settings_script()
69 68
 {
70
-   local scriptname
69
+   local  scriptname
71 70
 
72 71
    scriptname="$1"
73 72
    shift
74 73
 
75
-   local reposdir="$1"  # ususally .bootstrap.repos
76
-   local name="$2"      # name of the clone
77
-   local url="$3"       # URL of the clone
78
-   local branch="$4"    # branch of the clone
79
-   local scm="$5"       # scm to use for this clone
80
-   local tag="$6"       # tag to checkout of the clone
81
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
74
+   [ -z "$scriptname" ] && internal_fail "scriptname is empty"
82 75
 
76
+   local script
83 77
 
84
-   (
85
-      local owd="`pwd -P`";
86
-      cd "${stashdir}" ;
87
-      REPOS_DIR="${owd}/${REPOS_DIR}" \
88
-      CLONESBUILD_SUBDIR="${owd}/${CLONESBUILD_SUBDIR}" \
89
-      DEPENDENCIES_DIR="${owd}/${DEPENDENCIES_DIR}" \
90
-      ADDICTIONS_DIR="${owd}/${ADDICTIONS_DIR}" \
91
-      STASHES_DIR="${owd}/${STASHES_DIR}" \
92
-      run_script "${owd}/${script}" "$@"
93
-   ) || exit 1
78
+   script="`find_root_setting_file "bin/${scriptname}.sh"`"
79
+   if [ ! -z "${script}" ]
80
+   then
81
+      run_script "${script}" "$@"
82
+   fi
94 83
 }
95 84
 
96 85
 
97
-
98 86
 run_build_settings_script()
99 87
 {
100
-   local scriptname
101
-
102
-   scriptname="$1"
103
-   shift
88
+   local scriptname="$1" ; shift
104 89
 
105 90
    local reposdir="$1"  # ususally .bootstrap.repos
106 91
    local name="$2"      # name of the clone
... ...
@@ -123,6 +108,13 @@ run_build_settings_script()
123 108
    script="`find_build_setting_file "${name}" "bin/${scriptname}.sh"`"
124 109
    if [ ! -z "${script}" ]
125 110
    then
111
+      # can happen, if system libs override
112
+      if [ ! -e "${stashdir}" ]
113
+      then
114
+         log_verbose "script \"${scriptname}\" not executed, because ${stashdir} does not exist"
115
+         return 0
116
+      fi
117
+
126 118
       run_script "${script}" "${name}" "${url}" "${stashdir}" "$@" || exit 1
127 119
    fi
128 120
 }
... ...
@@ -145,55 +137,18 @@ fetch__run_script()
145 137
 #
146 138
 fetch__run_root_settings_script()
147 139
 {
148
-   local  scriptname
149
-
150
-   scriptname="$1"
151
-   shift
152
-
153
-   [ -z "$scriptname" ] && internal_fail "scriptname is empty"
154
-
155
-   local script
140
+   build_complete_environment
156 141
 
157
-   script="`find_root_setting_file "bin/${scriptname}.sh"`"
158
-   if [ ! -z "${script}" ]
159
-   then
160
-      fetch__run_script "${script}" "$@"
161
-   fi
142
+   run_root_settings_script "$@"
162 143
 }
163 144
 
164 145
 
165 146
 
166 147
 fetch__run_build_settings_script()
167 148
 {
168
-   local scriptname
169
-
170
-   scriptname="$1"
171
-   shift
172
-
173
-   local reposdir="$1"  # ususally .bootstrap.repos
174
-   local name="$2"      # name of the clone
175
-   local url="$3"       # URL of the clone
176
-   local branch="$4"    # branch of the clone
177
-   local scm="$5"       # scm to use for this clone
178
-   local tag="$6"       # tag to checkout of the clone
179
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
180
-
181
-   [ ! -z "$scriptname" ] || internal_fail "scriptname is empty"
182
-
183
-   local script
184
-
185
-   script="`find_build_setting_file "${name}" "bin/${scriptname}.sh"`"
186
-   if [ ! -z "${script}" ]
187
-   then
188
-      # can happen, if system libs override
189
-      if [ ! -e "${stashdir}" ]
190
-      then
191
-         log_verbose "script \"${scriptname}\" not executed, because ${stashdir} does not exist"
192
-         return 0
193
-      fi
149
+   build_complete_environment
194 150
 
195
-      fetch__run_script "${script}" "$@" || exit 1
196
-   fi
151
+   run_build_settings_script "$@"
197 152
 }
198 153
 
199 154