Browse code

Unified some MULLE_BOOTSTRAP_ flags. Split mulle-brew off mulle-bootstrap properly, moved lots of code to a common local environment. Fixed tests. Added two tests.

Nat! authored on 15-03-2017 17:12:22
Showing 40 changed files
... ...
@@ -41,7 +41,7 @@ patch anymore. It's also convenient for the test scripts
41 41
 
42 42
 ## 2.6.0
43 43
 
44
-* mulle-bootstrap announces itself to cmake with -DMULLE_BOOTSTRAP_VERSION
44
+* mulle-bootstrap announces itself to cmake with -DMULLE_EXECUTABLE_VERSION
45 45
 
46 46
 ### 2.5.2
47 47
 
... ...
@@ -25,7 +25,7 @@ fi
25 25
 
26 26
 fail()
27 27
 {
28
-   printf "${C_BR_RED}$*${C_RESET}\n" >&2
28
+   printf "${C_BR_RED}Error: $*${C_RESET}\n" >&2
29 29
    exit 1
30 30
 }
31 31
 
... ...
@@ -28,11 +28,11 @@
28 28
 #   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31
-MULLE_BOOTSTRAP_VERSION_MAJOR=3
32
-MULLE_BOOTSTRAP_VERSION_MINOR=0
33
-MULLE_BOOTSTRAP_VERSION_PATCH=0
31
+MULLE_EXECUTABLE_VERSION_MAJOR=3
32
+MULLE_EXECUTABLE_VERSION_MINOR=0
33
+MULLE_EXECUTABLE_VERSION_PATCH=0
34 34
 
35
-MULLE_BOOTSTRAP_VERSION="${MULLE_BOOTSTRAP_VERSION_MAJOR}.${MULLE_BOOTSTRAP_VERSION_MINOR}.${MULLE_BOOTSTRAP_VERSION_PATCH}"
35
+MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
36 36
 
37 37
 #
38 38
 # This is the main user interface to mulle-bootstrap
... ...
@@ -45,59 +45,6 @@ trap_fail()
45 45
 }
46 46
 
47 47
 
48
-bootstrap_technical_option_usage()
49
-{
50
-   if [ ! -z "${MULLE_TRACE}" ]
51
-   then
52
-      cat <<EOF
53
-   -ld       : additional debug output
54
-   -le       : external command execution log output
55
-   -lm       : extended dependency analysis output
56
-   -ls       : extended settings log output
57
-   -t        : enable shell trace
58
-   -tpwd     : emit shortened PWD during trace
59
-   -tr       : also trace resolver
60
-   -ts       : also trace settings
61
-   -s        : be silent
62
-
63
-   [Check source for more options]
64
-EOF
65
-   fi
66
-}
67
-
68
-
69
-mulle_brew_usage()
70
-{
71
-   cat <<EOF
72
-usage: mulle-brew [flags] [command] [options]
73
- Flags:
74
-   -n        : do nothing creative or destructive
75
-   -v        : -v to be more verbose (-vv or -vvv for more verbosity)
76
-EOF
77
-
78
-   bootstrap_technical_option_usage
79
-
80
-   cat <<EOF
81
-
82
- Commands:
83
-   install   : fetches brews
84
-   update    : update brew
85
-   upgrade   : upgrade brew fomulae
86
-   init      : initializes a bootstrap project
87
-
88
- Options are command specific. Use mulle-brew <command> -h for help.
89
-EOF
90
-
91
-   if [ "${UNAME}" = 'darwin' ]
92
-   then
93
-      cat <<EOF
94
-   xcode     : setup xcodeproj settings
95
-EOF
96
-   fi
97
-
98
-   exit 1
99
-}
100
-
101 48
 
102 49
 mulle_bootstrap_usage()
103 50
 {
... ...
@@ -155,61 +102,6 @@ EOF
155 102
 }
156 103
 
157 104
 
158
-ensure_consistency()
159
-{
160
-   if dirty_harry
161
-   then
162
-      log_error "A previous fetch or update was incomplete.
163
-Suggested resolution (in $PWD):
164
-    ${C_RESET_BOLD}mulle-bootstrap clean dist${C_ERROR}
165
-    ${C_RESET_BOLD}mulle-bootstrap${C_ERROR}
166
-
167
-Or do you feel lucky ? Then try again with
168
-   ${C_RESET_BOLD}mulle-bootstrap -f ${MULLE_BOOTSTRAP_ARGUMENTS}${C_ERROR}
169
-But you've gotta ask yourself one question: Do I feel lucky ?
170
-Well, do ya, punk?"
171
-      exit 1
172
-   fi
173
-}
174
-
175
-
176
-define_expansion()
177
-{
178
-   local keyvalue
179
-
180
-   keyvalue="$1"
181
-
182
-   is_bootstrap_project || fail "This is not a mulle-bootstrap project"
183
-
184
-   if [ -z "${keyvalue}" ]
185
-   then
186
-      fail "Missing key, directly after -D"
187
-      mulle_bootstrap_usage
188
-   fi
189
-
190
-   [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
191
-
192
-   local key
193
-   local value
194
-
195
-   key="`echo "${keyvalue}" | cut -d= -f1 | tr '[a-z]' '[A-Z]'`"
196
-   if [ -z "${key}" ]
197
-   then
198
-      key="${keyvalue}"
199
-      value="YES"
200
-   else
201
-      value="`echo "${keyvalue}" | cut -d= -f2-`"
202
-   fi
203
-
204
-   local path
205
-
206
-   path="${BOOTSTRAP_DIR}.local/${key}"
207
-   mkdir_if_missing "`dirname -- "${path}"`"
208
-   redirect_exekutor "${path}" echo "# commandline argument -D${keyvalue}
209
-${value}"
210
-}
211
-
212
-
213 105
 _bootstrap_main()
214 106
 {
215 107
    local command
... ...
@@ -271,16 +163,6 @@ bootstrap_libexec_path()
271 163
 }
272 164
 
273 165
 
274
-bootstrap_dump_env()
275
-{
276
-   log_trace "FULL trace started"
277
-   log_trace "ARGS:${C_TRACE2} ${MULLE_BOOTSTRAP_ARGUMENTS}"
278
-   log_trace "PWD :${C_TRACE2} `pwd -P`"
279
-   log_trace "ENV :${C_TRACE2} `env | sort`"
280
-   log_trace "LS  :${C_TRACE2} `ls -a1F`"
281
-}
282
-
283
-
284 166
 bootstrap_init()
285 167
 {
286 168
    local libexecpath
... ...
@@ -311,7 +193,7 @@ bootstrap_init()
311 193
       ;;
312 194
 
313 195
       version)
314
-         echo "${MULLE_BOOTSTRAP_VERSION}"
196
+         echo "${MULLE_EXECUTABLE_VERSION}"
315 197
          exit 0
316 198
       ;;
317 199
    esac
... ...
@@ -331,239 +213,6 @@ bootstrap_init()
331 213
 }
332 214
 
333 215
 
334
-#
335
-# variables called flag. because they are indirectly set by flags
336
-#
337
-bootstrap_setup_trace()
338
-{
339
-   case "${1}" in
340
-      VERBOSE)
341
-         MULLE_FLAG_LOG_VERBOSE="YES"
342
-      ;;
343
-
344
-      FLUFF)
345
-         MULLE_FLAG_LOG_FLUFF="YES"
346
-         MULLE_FLAG_LOG_VERBOSE="YES"
347
-         MULLE_FLAG_LOG_EXECUTOR="YES"
348
-      ;;
349
-
350
-      TRACE)
351
-         MULLE_FLAG_LOG_SETTINGS="YES"
352
-         MULLE_FLAG_LOG_EXECUTOR="YES"
353
-         MULLE_FLAG_LOG_FLUFF="YES"
354
-         MULLE_FLAG_LOG_VERBOSE="YES"
355
-         bootstrap_dump_env
356
-      ;;
357
-
358
-      1848)
359
-         MULLE_FLAG_LOG_SETTINGS="YES"
360
-         MULLE_FLAG_LOG_FLUFF="YES"
361
-         MULLE_FLAG_LOG_VERBOSE="YES"
362
-         MULLE_FLAG_VERBOSE_BUILD="YES"
363
-
364
-         bootstrap_dump_env
365
-
366
-         if [ "${MULLE_TRACE_POSTPONE}" = "NO" ]
367
-         then
368
-            log_trace "1848 trace (set -x) started"
369
-            set -x
370
-            PS4="+ ${ps4string} + "
371
-         fi
372
-      ;;
373
-   esac
374
-}
375
-
376
-
377
-bootstrap_technical_flags()
378
-{
379
-   case "$1" in
380
-      -n|--dry-run)
381
-         MULLE_FLAG_EXECUTOR_DRY_RUN="YES"
382
-      ;;
383
-
384
-      -ld|--log-debug)
385
-         MULLE_FLAG_LOG_DEBUG="YES"
386
-      ;;
387
-
388
-      -le|--log-execution)
389
-         MULLE_FLAG_LOG_EXECUTOR="YES"
390
-      ;;
391
-
392
-      -lm|--log-merge)
393
-         MULLE_FLAG_MERGE_LOG="YES"
394
-      ;;
395
-
396
-      -ls|--log-settings)
397
-         MULLE_FLAG_LOG_SETTINGS="YES"
398
-      ;;
399
-
400
-      -lsc|--log-script-calls)
401
-         MULLE_FLAG_LOG_SCRIPTS="YES"
402
-      ;;
403
-
404
-      -t|--trace)
405
-         MULLE_TRACE="1848"
406
-         COPYMOVEFLAGS="-v"
407
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
408
-         MULLE_TRACE_PATHS_FLIP_X="YES"
409
-         MULLE_TRACE_RESOLVER_FLIP_X="YES"
410
-         MULLE_TRACE_SETTINGS_FLIP_X="YES"
411
-         ps4string='${BASH_SOURCE[1]##*/}:${LINENO}'
412
-      ;;
413
-
414
-      -tf|--trace-filepaths)
415
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
416
-         MULLE_TRACE_PATHS_FLIP_X="NO"
417
-      ;;
418
-
419
-      -tfpwd|--trace-full-pwd)
420
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
421
-         ps4string='${BASH_SOURCE[1]##*/}:${LINENO} \"\w\"'
422
-      ;;
423
-
424
-      -tp|--trace-profile)
425
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
426
-         case "${UNAME}" in
427
-            linux)
428
-               ps4string='$(date "+%s.%N (${BASH_SOURCE[1]##*/}:${LINENO})")'
429
-            ;;
430
-            *)
431
-               ps4string='$(date "+%s (${BASH_SOURCE[1]##*/}:${LINENO})")'
432
-            ;;
433
-         esac
434
-      ;;
435
-
436
-      -tpo|--trace-postpone)
437
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
438
-         MULLE_TRACE_POSTPONE="YES"
439
-      ;;
440
-
441
-      -tpwd|--trace-pwd)
442
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
443
-         ps4string='${BASH_SOURCE[1]##*/}:${LINENO} \".../\W\"'
444
-      ;;
445
-
446
-      -tr|--trace-resolver)
447
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
448
-         MULLE_TRACE_RESOLVER_FLIP_X="NO"
449
-      ;;
450
-
451
-      -ts|--trace-settings)
452
-         [ "${MULLE_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
453
-         MULLE_TRACE_SETTINGS_FLIP_X="NO"
454
-      ;;
455
-
456
-      -v|--verbose)
457
-        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -v after -t invalidates -t"
458
-
459
-         MULLE_TRACE="VERBOSE"
460
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
461
-      ;;
462
-
463
-      -vv|--very-verbose)
464
-        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vv after -t invalidates -t"
465
-
466
-         MULLE_TRACE="FLUFF"
467
-         COPYMOVEFLAGS="-v"
468
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
469
-      ;;
470
-
471
-      -vvv|--very-verbose-with-settings)
472
-        [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vvv after -t invalidates -t"
473
-
474
-         MULLE_TRACE="TRACE"
475
-         COPYMOVEFLAGS="-v"
476
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
477
-      ;;
478
-
479
-      -s|--silent)
480
-         MULLE_TRACE=
481
-         MULLE_FLAG_LOG_TERSE="YES"
482
-         GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
483
-      ;;
484
-
485
-      *)
486
-         return 1
487
-      ;;
488
-   esac
489
-
490
-   return 0
491
-}
492
-
493
-
494
-bootstrap_should_defer_to_master()
495
-{
496
-   local command="$1"
497
-
498
-   #
499
-   # if we have a.bootstrap.local/is_minion file then
500
-   # some commands can't run, and some commands are re-executed in master
501
-   # and some commands (like fetch and clean) are executed locally AND in the
502
-   # master
503
-   #
504
-
505
-   if ! is_minion_bootstrap_project
506
-   then
507
-      return 1
508
-   fi
509
-
510
-   if [ "${MULLE_FLAG_DONT_DEFER}" = "YES" ]
511
-   then
512
-      log_verbose "Minion executes locally by request"
513
-      return 1
514
-   fi
515
-
516
-   if [ "${MULLE_BOOTSTRAP_DONT_DEFER}" = "YES" ]
517
-   then
518
-      log_fluff "Minion executes locally by environment"
519
-      return 1
520
-   fi
521
-
522
-   local masterpath
523
-
524
-   . mulle-bootstrap-project.sh
525
-
526
-   masterpath="`get_master_of_minion_bootstrap_project`"
527
-
528
-   case "${command}" in
529
-      git|setup-xcode|xcode|tag|version|defer|emancipate|uname|library-path)
530
-         log_verbose "Minion executes locally"
531
-      ;;
532
-
533
-      show)
534
-         log_verbose "Minion executes partially locally"
535
-
536
-         [ -z "${MULLE_BOOTSTRAP_SHOW_SH}" ] && . mulle-bootstrap-show.sh
537
-
538
-         (
539
-            [ $# -eq 0 ] || shift
540
-            show_main_header_only "$@"
541
-         ) || exit 1
542
-
543
-         log_info "Minion defers to master \"$masterpath\""
544
-         log_info ""
545
-
546
-         cd "${masterpath}" || fail "master is missing"
547
-         return 0  # this leads to  main deferring later on (but cd is set!)
548
-      ;;
549
-
550
-      refer|dist-clean)
551
-         fail "This is a minion bootstrap project.\n \
552
-${MULLE_BOOTSTRAP_EXECUTABLE} ${command}t is not possible."
553
-      ;;
554
-
555
-      *)
556
-         log_verbose "Minion defers to master \"$masterpath\" for execution"
557
-
558
-         cd "${masterpath}" || fail "master is missing"
559
-         return 0  # this leads to  main deferring later on (but cd is set!)
560
-      ;;
561
-   esac
562
-
563
-   return 1
564
-}
565
-
566
-
567 216
 bootstrap_main()
568 217
 {
569 218
    local command
... ...
@@ -577,6 +226,7 @@ bootstrap_main()
577 226
    # technical flags
578 227
    local MULLE_FLAG_EXECUTOR_DRY_RUN="NO"
579 228
    local MULLE_FLAG_FOLLOW_SYMLINKS="YES"
229
+   local MULLE_FLAG_LOG_CACHE="NO"
580 230
    local MULLE_FLAG_LOG_DEBUG="NO"
581 231
    local MULLE_FLAG_LOG_EXECUTOR="NO"
582 232
    local MULLE_FLAG_LOG_EXECUTOR="NO"
... ...
@@ -634,7 +284,7 @@ bootstrap_main()
634 284
 
635 285
          -D*)  # just like C
636 286
             # define key values (by putting them into .bootstrap.local)
637
-            define_expansion "`echo "$1" | sed s'/^-D[ ]*//'`"
287
+            bootstrap_define_expansion "`echo "$1" | sed s'/^-D[ ]*//'`"
638 288
          ;;
639 289
 
640 290
          -V|--verbose-build)
... ...
@@ -679,8 +329,8 @@ bootstrap_main()
679 329
 
680 330
          *)
681 331
             case "${command}" in
682
-               bootstrap|nomagic|build|dist|clean|dist-clean|fetch|install|syteminstall|upgrade|update|setup-xcode|show|status|xcode|tag)
683
-                  fail "There is no ${BOOTSTRAP_DIR} or ${BOOTSTRAP_DIR}.local folder here ($PWD), can't continue"
332
+               bootstrap|build|clean|defer|dist|dist-clean|emancipate|fetch|install|syteminstall|upgrade|update|setup-xcode|show|status|tag|xcode)
333
+                  fail "There is no ${BOOTSTRAP_DIR} or ${BOOTSTRAP_DIR}.local folder here (${C_RESET_BOLD}$PWD${C_ERROR})"
684 334
                ;;
685 335
             esac
686 336
          ;;
... ...
@@ -698,13 +348,13 @@ bootstrap_main()
698 348
             ;;
699 349
 
700 350
             *)
701
-               ensure_consistency
351
+               bootstrap_ensure_consistency
702 352
             ;;
703 353
          esac
704 354
       fi
705 355
    fi
706 356
 
707
-   MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
357
+   MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_EXECUTABLE} ${command}"
708 358
    [ $# -eq 0 ] || shift
709 359
 
710 360
    MULLE_EXECUTABLE_OPTIONS="$@"
... ...
@@ -810,7 +460,12 @@ bootstrap_main()
810 460
       status)
811 461
          . mulle-bootstrap-status.sh
812 462
 
813
-         status_main "$@" || exit 1
463
+         local rval
464
+
465
+         status_main "$@"
466
+         rval="$?"
467
+
468
+         [ "$rval" -eq 0 ] || exit $rval
814 469
       ;;
815 470
 
816 471
       tag)
... ...
@@ -837,7 +492,7 @@ bootstrap_main()
837 492
       ;;
838 493
 
839 494
       version)
840
-         echo "${MULLE_BOOTSTRAP_VERSION}"
495
+         echo "${MULLE_EXECUTABLE_VERSION}"
841 496
          return 0
842 497
       ;;
843 498
 
... ...
@@ -856,241 +511,28 @@ bootstrap_main()
856 511
 }
857 512
 
858 513
 
859
-brew_main()
860
-{
861
-   local command
862
-   local ps4string
863
-
864
-   # technical flags
865
-   local MULLE_FLAG_EXECUTOR_DRY_RUN="NO"
866
-   local MULLE_FLAG_LOG_DEBUG="NO"
867
-   local MULLE_FLAG_LOG_EXECUTOR="NO"
868
-   local MULLE_FLAG_LOG_EXECUTOR="NO"
869
-   local MULLE_FLAG_LOG_FLUFF="NO"
870
-   local MULLE_FLAG_LOG_SCRIPTS="NO"
871
-   local MULLE_FLAG_LOG_SETTINGS="NO"
872
-   local MULLE_FLAG_LOG_VERBOSE="NO"
873
-   local MULLE_FLAG_MERGE_LOG="NO"
874
-   local MULLE_TRACE_PATHS_FLIP_X="NO"
875
-   local MULLE_TRACE_POSTPONE="NO"
876
-   local MULLE_TRACE_RESOLVER_FLIP_X="NO"
877
-   local MULLE_TRACE_SETTINGS_FLIP_X="NO"
878
-
879
-   #
880
-   # simple option handling
881
-   #
882
-   while [ $# -ne 0 ]
883
-   do
884
-      if bootstrap_technical_flags "$1"
885
-      then
886
-         shift
887
-         continue
888
-      fi
889
-
890
-      case "$1" in
891
-         -h|--help)
892
-            mulle_brew_usage
893
-         ;;
894
-
895
-         -*)
896
-            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option \"$1\""
897
-            mulle_brew_usage
898
-         ;;
899
-
900
-         *)
901
-            break
902
-         ;;
903
-      esac
904
-
905
-      shift
906
-   done
907
-
908
-   bootstrap_setup_trace "${MULLE_TRACE}"
909
-
910
-   if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" = "YES" ]
911
-   then
912
-      log_trace "Dry run is active."
913
-   fi
914
-
915
-   # source in environment now
916
-
917
-   local_environment_main
918
-
919
-   #
920
-   # some commands only run when we have a .bootstrap folder
921
-   #
922
-   command="${1:-install}"
923
-   [ $# -eq 0 ] || shift
924
-
925
-   if [ ! -d "${BOOTSTRAP_DIR}" -a ! -d "${BOOTSTRAP_DIR}.local" ]
926
-   then
927
-      case "$1" in
928
-         -h|--help)
929
-         ;;
930
-
931
-         *)
932
-            case "${command}" in
933
-               dist|clean|dist-clean|install|upgrade|update|setup-xcode|xcode)
934
-                  fail "There is no ${BOOTSTRAP_DIR} or ${BOOTSTRAP_DIR}.local folder here ($PWD), can't continue"
935
-               ;;
936
-            esac
937
-         ;;
938
-      esac
939
-   else
940
-      if bootstrap_should_defer_to_master "$@"
941
-      then
942
-         return 1
943
-      fi
944
-   fi
945
-
946
-   MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE} ${command}"
947
-   MULLE_EXECUTABLE_OPTIONS="$@"
948
-
949
-   case "${command}" in
950
-      build)
951
-         . mulle-bootstrap-build.sh
952
-
953
-         build_main "$@" || exit 1
954
-      ;;
955
-
956
-      clean)
957
-         . mulle-bootstrap-clean.sh
958
-
959
-         clean_main "$@" || exit 1
960
-      ;;
961
-
962
-      config)
963
-         . mulle-bootstrap-settings.sh
964
-
965
-         config_main "$@" || exit 1
966
-      ;;
967
-
968
-      dist)
969
-         . mulle-bootstrap-clean.sh
970
-
971
-         clean_main "dist" || exit 1
972
-      ;;
973
-
974
-      defer)
975
-         . mulle-bootstrap-defer.sh
976
-
977
-         defer_main "$@" || exit 1
978
-      ;;
979
-
980
-      emancipate)
981
-         . mulle-bootstrap-defer.sh
982
-
983
-         emancipate_main "$@" || exit 1
984
-      ;;
985
-
986
-      flags)
987
-         . mulle-bootstrap-flags.sh
988
-
989
-         flags_main "$@" || exit 1
990
-      ;;
991
-
992
-      help)
993
-         mulle_brew_usage "$@" || exit 1
994
-      ;;
995
-
996
-      init)
997
-         . mulle-bootstrap-init.sh
998
-
999
-         init_main "$@" || exit 1
1000
-      ;;
1001
-
1002
-      install|fetch)
1003
-         . mulle-bootstrap-brew.sh
1004
-
1005
-         brew_install_main "$@" || exit 1
1006
-      ;;
1007
-
1008
-      library-path)
1009
-         echo "$PATH" | tr ':' '\012' | head -1
1010
-         return 0
1011
-      ;;
1012
-
1013
-      setting)
1014
-         . mulle-bootstrap-settings.sh
1015
-
1016
-         setting_main "$@" || exit 1
1017
-      ;;
1018
-
1019
-      show)
1020
-         . mulle-bootstrap-show.sh
1021
-
1022
-         show_main "$@" || exit 1
1023
-      ;;
1024
-
1025
-      uname)
1026
-         echo "${UNAME}"
1027
-         exit 0
1028
-      ;;
1029
-
1030
-      update)
1031
-         . mulle-bootstrap-brew.sh
1032
-
1033
-         brew_update_main "$@" || exit 1
1034
-      ;;
1035
-
1036
-      upgrade)
1037
-         . mulle-bootstrap-brew.sh
1038
-
1039
-         brew_upgrade_main "$@" || exit 1
1040
-      ;;
1041
-
1042
-      version)
1043
-         echo "${MULLE_BOOTSTRAP_VERSION}"
1044
-         return 0
1045
-      ;;
1046
-
1047
-      xcode|setup-xcode)
1048
-         . mulle-bootstrap-xcode.sh
1049
-
1050
-         MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap xcode"
1051
-         xcode_main "$@" || exit 1
1052
-      ;;
1053
-
1054
-      *)
1055
-         log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown command \"${command}\""
1056
-         mulle_bootstrap_usage
1057
-      ;;
1058
-   esac
1059
-}
1060 514
 
1061 515
 #
1062 516
 # service both names
1063 517
 #
1064
-MULLE_BOOTSTRAP_EXECUTABLE="`basename -- "$0"`"
1065
-MULLE_BOOTSTRAP_ARGUMENTS="$@"
1066
-MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_BOOTSTRAP_EXECUTABLE}"
518
+MULLE_EXECUTABLE="`basename -- "$0"`"
519
+MULLE_ARGUMENTS="$@"
520
+MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_EXECUTABLE}"
1067 521
 MULLE_EXECUTABLE_PID="$$"
1068 522
 export MULLE_EXECUTABLE_PID
1069 523
 
1070 524
 
1071 525
 bootstrap_init "$@" # needs params
1072 526
 
527
+
1073 528
 main()
1074 529
 {
1075
-   case "${MULLE_BOOTSTRAP_EXECUTABLE}" in
1076
-      "mulle-brew")
1077
-         if ! brew_main "$@"
1078
-         then
1079
-            # just do it again, but cd has been set differently
1080
-            main "$@" # is array
1081
-            exit $?
1082
-         fi
1083
-      ;;
1084
-
1085
-      "mulle-bootstrap")
1086
-         if ! bootstrap_main "$@"
1087
-         then
1088
-            # just do it again, but cd has been set differently
1089
-            main "$@"
1090
-            exit $?
1091
-         fi
1092
-      ;;
1093
-   esac
530
+   if ! bootstrap_main "$@"
531
+   then
532
+      # just do it again, but cd has been set differently
533
+      main "$@"
534
+      exit $?
535
+   fi
1094 536
 }
1095 537
 
1096 538
 main "$@"
... ...
@@ -161,7 +161,7 @@ find_brews()
161 161
    brews="`read_root_setting "brews" | sort | sort -u`"
162 162
    if [ ! -z "${brews}" ]
163 163
    then
164
-      if [ "${MULLE_BOOTSTRAP_EXECUTABLE}" != "mulle-bootstrap" ]
164
+      if [ "${MULLE_EXECUTABLE}" != "mulle-bootstrap" ]
165 165
       then
166 166
          log_info "Setting read from .bootstrap.auto folder. \
167 167
 You might want to use mulle-bootstrap instead of mulle-brew."
... ...
@@ -115,7 +115,7 @@ dispense_headers()
115 115
 
116 116
          # this fails with more nested header set ups, need to fix!
117 117
 
118
-         log_fluff "Copying \"${src}\" to \"${dst}\""
118
+         log_fluff "Copying headers from \"${src}\" to \"${dst}\""
119 119
          exekutor cp -Ra ${COPYMOVEFLAGS} "${src}"/* "${dst}" >&2 || exit 1
120 120
 
121 121
          rmdir_safer "${src}"
... ...
@@ -160,7 +160,7 @@ dispense_binaries()
160 160
       then
161 161
          dst="${REFERENCE_DEPENDENCIES_DIR}${depend_subdir}${subpath}"
162 162
 
163
-         log_fluff "Copying \"${src}\" to \"${dst}\""
163
+         log_fluff "Copying binaries from \"${src}\" to \"${dst}\""
164 164
          mkdir_if_missing "${dst}"
165 165
          exekutor find "${src}" -xdev -mindepth 1 -maxdepth 1 \( -type "${findtype}" -o -type "${findtype2}" \) -print0 | \
166 166
             exekutor xargs -0 -I % mv ${COPYMOVEFLAGS} "${copyflag}" % "${dst}" >&2
... ...
@@ -641,14 +641,13 @@ _build_flags()
641 641
    local builddir="$3"
642 642
    local name="$4"
643 643
    local sdk="$5"
644
+   local mapped="$6"
644 645
 
645
-   local mapped
646 646
    local fallback
647 647
    local suffix
648 648
 
649 649
    fallback="`echo "${OPTION_CONFIGURATIONS}" | tail -1`"
650 650
    fallback="`read_build_setting "${name}" "fallback-configuration" "${fallback}"`"
651
-   mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
652 651
    suffix="`determine_suffix "${configuration}" "${sdk}"`"
653 652
 
654 653
    local mappedsubdir
... ...
@@ -659,16 +658,6 @@ _build_flags()
659 658
    suffixsubdir="`determine_dependencies_subdir "${suffix}"`"
660 659
    fallbacksubdir="`determine_dependencies_subdir "${fallback}"`"
661 660
 
662
-   local other_cppflags
663
-   local other_cflags
664
-   local other_cxxflags
665
-   local other_ldflags
666
-
667
-   other_cppflags="`gcc_cppflags_value "${name}"`"
668
-   other_cflags="`gcc_cflags_value "${name}"`"
669
-   other_cxxflags="`gcc_cxxflags_value "${name}"`"
670
-   other_ldflags="`gcc_ldflags_value "${name}"`"
671
-
672 661
    (
673 662
       local nativewd
674 663
       local owd
... ...
@@ -762,6 +751,10 @@ _build_flags()
762 751
          ;;
763 752
       esac
764 753
 
754
+      local cppflags
755
+      local ldflags
756
+      local path
757
+
765 758
       # cmake separator
766 759
       [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
767 760
       IFS="${PATH_SEPARATOR}"
... ...
@@ -769,7 +762,7 @@ _build_flags()
769 762
       do
770 763
          IFS="${DEFAULT_IFS}"
771 764
          path="$(sed 's/ /\\ /g' <<< "${path}")"
772
-         other_cppflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
765
+         cppflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
773 766
       done
774 767
 
775 768
       IFS="${PATH_SEPARATOR}"
... ...
@@ -777,7 +770,7 @@ _build_flags()
777 770
       do
778 771
          IFS="${DEFAULT_IFS}"
779 772
          path="$(sed 's/ /\\ /g' <<< "${path}")"
780
-         other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
773
+         ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
781 774
       done
782 775
 
783 776
       IFS="${PATH_SEPARATOR}"
... ...
@@ -786,17 +779,21 @@ _build_flags()
786 779
          IFS="${DEFAULT_IFS}"
787 780
          path="$(sed 's/ /\\ /g' <<< "${path}")"
788 781
          other_cppflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
789
-         other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
782
+         ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
790 783
       done
791 784
       IFS="${DEFAULT_IFS}"
792 785
 
793 786
       #
794 787
       # the output one line each
795 788
       #
796
-      echo "${other_cppflags}"
797
-      echo "${other_cflags}"
798
-      echo "${other_cxxflags}"
799
-      echo "${other_ldflags}"
789
+      echo "${cppflags}"
790
+      echo "${ldflags}"
791
+      echo "${native_includelines}"
792
+      echo "${native_librarylines}"
793
+      echo "${native_frameworklines}"
794
+      echo "${includelines}"
795
+      echo "${librarylines}"
796
+      echo "${frameworklines}"
800 797
    )
801 798
 }
802 799
 
... ...
@@ -874,24 +871,68 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
874 871
    # need this now
875 872
    mkdir_if_missing "${builddir}"
876 873
 
877
-   local flaglines
878
-
879
-   flaglines="`build_cmake_flags "$@"`"
880
-
881
-   local other_cppflags
882 874
    local other_cflags
883 875
    local other_cxxflags
876
+   local other_cppflags
884 877
    local other_ldflags
885 878
 
886
-   other_cppflags="`echo "${flaglines}" | sed -n '1p'`"
887
-   other_cflags="`echo "${flaglines}"   | sed -n '2p'`"
888
-   other_cxxflags="`echo "${flaglines}" | sed -n '3p'`"
889
-   other_ldflags="`echo "${flaglines}"  | sed -n '4p'`"
879
+   other_cflags="`gcc_cflags_value "${name}"`"
880
+   other_cxxflags="`gcc_cxxflags_value "${name}"`"
881
+   other_cppflags="`gcc_cppflags_value "${name}"`"
882
+   other_ldflags="`gcc_ldflags_value "${name}"`"
883
+
884
+   local flaglines
885
+   local mapped
886
+
887
+   mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
888
+   flaglines="`build_cmake_flags "$@" "${mapped}"`"
889
+
890
+   local cppflags
891
+   local ldflags
892
+   local includelines
893
+   local librarylines
894
+   local frameworklines
895
+
896
+   cppflags="`echo "${flaglines}"   | sed -n '1p'`"
897
+   ldflags="`echo "${flaglines}"    | sed -n '2p'`"
898
+   includelines="`echo "${flags}"   | sed -n '6p'`"
899
+   librarylines="`echo "${flags}"   | sed -n '7p'`"
900
+   frameworklines="`echo "${flags}" | sed -n '8p'`"
890 901
 
891 902
    # CMAKE_CPP_FLAGS does not exist in cmake
903
+   # so merge into CFLAGS and CXXFLAGS
892 904
 
893
-   other_cflags="`concat "${other_cppflags}" "${other_cflags}"`"
894
-   other_cxxflags="`concat "${other_cppflags}" "${other_cxxflags}"`"
905
+   if [ -z "${cppflags}" ]
906
+   then
907
+      other_cppflags="`concat "${other_cppflags}" "${cppflags}"`"
908
+   fi
909
+
910
+   if [ -z "${other_cppflags}" ]
911
+   then
912
+      other_cflags="`concat "${other_cflags}" "${other_cppflags}"`"
913
+      other_cxxflags="`concat "${other_cxxflags}" "${other_cppflags}"`"
914
+   fi
915
+
916
+   if [ -z "${ldflags}" ]
917
+   then
918
+      other_ldflags="`concat "${other_ldflags}" "${ldflags}"`"
919
+   fi
920
+
921
+   local cmake_flags
922
+
923
+   if [ ! -z "${other_cflags}" ]
924
+   then
925
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_C_FLAGS='${other_cflags}'"`"
926
+   fi
927
+   if [ ! -z "${other_cxxflags}" ]
928
+   then
929
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_CXX_FLAGS='${other_cxxflags}'"`"
930
+   fi
931
+   if [ ! -z "${other_ldflags}" ]
932
+   then
933
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_SHARED_LINKER_FLAGS='${other_ldflags}'"`"
934
+      cmake_flags="`concat "${cmake_flags}" "-DCMAKE_EXE_LINKER_FLAGS='${other_ldflags}'"`"
935
+   fi
895 936
 
896 937
    local logfile1
897 938
    local logfile2
... ...
@@ -948,13 +989,6 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
948 989
 
949 990
       prefixbuild="`add_cmake_path "${prefixbuild}" "${nativewd}/${BUILD_DEPENDENCIES_DIR}"`"
950 991
 
951
-      local cmake_flags
952
-
953
-      cmake_flags="-DCMAKE_C_FLAGS='${other_cflags}' \
954
--DCMAKE_CXX_FLAGS='${other_cxxflags}' \
955
--DCMAKE_EXE_LINKER_FLAGS='${other_ldflags}' \
956
--DCMAKE_SHARED_LINKER_FLAGS='${other_ldflags}'"
957
-
958 992
       local cmake_dirs
959 993
 
960 994
       local dependenciesdir
... ...
@@ -998,12 +1032,12 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
998 1032
 
999 1033
       logging_redirect_eval_exekutor "${logfile1}" "'${CMAKE}'" \
1000 1034
 -G "'${CMAKE_GENERATOR}'" \
1001
-"-DMULLE_BOOTSTRAP_VERSION=${MULLE_BOOTSTRAP_VERSION}" \
1035
+"-DMULLE_EXECUTABLE_VERSION=${MULLE_EXECUTABLE_VERSION}" \
1002 1036
 "-DCMAKE_BUILD_TYPE='${mapped}'" \
1003 1037
 "-DCMAKE_INSTALL_PREFIX:PATH='${prefixbuild}'"  \
1038
+"${sdkparameter}" \
1004 1039
 "${cmake_dirs}" \
1005 1040
 "${cmake_flags}" \
1006
-"${sdkparameter}" \
1007 1041
 "${c_compiler_line}" \
1008 1042
 "${cxx_compiler_line}" \
1009 1043
 "${local_cmake_flags}" \
... ...
@@ -1066,9 +1100,9 @@ ${C_MAGENTA}${C_BOLD}${configuration}${C_INFO} build of \
1066 1100
 ${C_MAGENTA}${C_BOLD}${name}${C_INFO} for SDK \
1067 1101
 ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1068 1102
 
1069
-   local configureflags
1103
+   local configure_flags
1070 1104
 
1071
-   configureflags="`read_build_setting "${name}" "configure_flags"`"
1105
+   configure_flags="`read_build_setting "${name}" "configure_flags"`"
1072 1106
 
1073 1107
 #   create_dummy_dirs_against_warnings "${mapped}" "${suffix}"
1074 1108
 
... ...
@@ -1086,19 +1120,40 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1086 1120
 
1087 1121
    mkdir_if_missing "${builddir}"
1088 1122
 
1089
-   local flags
1090
-
1091
-   flags="`build_unix_flags "$@"`"
1092
-
1093
-   local other_cppflags
1094 1123
    local other_cflags
1095 1124
    local other_cxxflags
1125
+   local other_cppflags
1096 1126
    local other_ldflags
1097 1127
 
1098
-   other_cppflags="`echo "${flags}" | sed -n '1p'`"
1099
-   other_cflags="`echo "${flags}"   | sed -n '2p'`"
1100
-   other_cxxflags="`echo "${flags}" | sed -n '3p'`"
1101
-   other_ldflags="`echo "${flags}"  | sed -n '4p'`"
1128
+   other_cflags="`gcc_cflags_value "${name}"`"
1129
+   other_cxxflags="`gcc_cxxflags_value "${name}"`"
1130
+   other_cppflags="`gcc_cppflags_value "${name}"`"
1131
+   other_ldflags="`gcc_ldflags_value "${name}"`"
1132
+
1133
+   local flags
1134
+   local mapped
1135
+
1136
+   mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
1137
+   flags="`build_unix_flags "$@" "${mapped}"`"
1138
+
1139
+   local cppflags
1140
+   local ldflags
1141
+
1142
+   cppflags="`echo "${flags}" | sed -n '1p'`"
1143
+   ldflags="`echo "${flags}"  | sed -n '2p'`"
1144
+
1145
+   # CMAKE_CPP_FLAGS does not exist in cmake
1146
+   # so merge into CFLAGS and CXXFLAGS
1147
+
1148
+   if [ -z "${cppflags}" ]
1149
+   then
1150
+      other_cppflags="`concat "${other_cppflags}" "${cppflags}"`"
1151
+   fi
1152
+
1153
+   if [ -z "${ldflags}" ]
1154
+   then
1155
+      other_ldflags="`concat "${other_ldflags}" "${ldflags}"`"
1156
+   fi
1102 1157
 
1103 1158
    local sdkpath
1104 1159
 
... ...
@@ -1111,6 +1166,25 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1111 1166
       other_ldflags="`concat "-isysroot ${sdkpath}" "${other_ldflags}"`"
1112 1167
    fi
1113 1168
 
1169
+   local env_flags
1170
+
1171
+   if [ ! -z "${other_cppflags}" ]
1172
+   then
1173
+      env_flags="`concat "${cmake_flags}" "CPPFLAGS='${other_cppflags}'"`"
1174
+   fi
1175
+   if [ ! -z "${other_cflags}" ]
1176
+   then
1177
+      env_flags="`concat "${cmake_flags}" "CFLAGS='${other_cflags}'"`"
1178
+   fi
1179
+   if [ ! -z "${other_cxxflags}" ]
1180
+   then
1181
+      env_flags="`concat "${cmake_flags}" "CXXFLAGS='${other_cxxflags}'"`"
1182
+   fi
1183
+   if [ ! -z "${other_ldflags}" ]
1184
+   then
1185
+      env_flags="`concat "${cmake_flags}" "LDFLAGS='${other_ldflags}'"`"
1186
+   fi
1187
+
1114 1188
    local logfile1
1115 1189
    local logfile2
1116 1190
 
... ...
@@ -1160,34 +1234,15 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1160 1234
       oldpath="$PATH"
1161 1235
       PATH="${BUILDPATH}"
1162 1236
 
1163
-      local tool_flags
1164
-
1165
-      if [ ! -z "${other_cppflags}" ]
1166
-      then
1167
-         tool_flags="`concat "${tool_flags}" "CPPFLAGS='${other_cppflags}'"`"
1168
-      fi
1169
-      if [ ! -z "${other_cflags}" ]
1170
-      then
1171
-         tool_flags="`concat "${tool_flags}" "CFLAGS='${other_cflags}'"`"
1172
-      fi
1173
-      if [ ! -z "${other_cxxflags}" ]
1174
-      then
1175
-         tool_flags="`concat "${tool_flags}" "CXXFLAGS='${other_cxxflags}'"`"
1176
-      fi
1177
-      if [ ! -z "${other_ldflags}" ]
1178
-      then
1179
-         tool_flags="`concat "${tool_flags}" "LDFLAGS='${other_ldflags}'"`"
1180
-      fi
1181
-
1182
-      # use absolute paths for configure, safer (and easier to read IMO)
1237
+       # use absolute paths for configure, safer (and easier to read IMO)
1183 1238
       logging_redirect_eval_exekutor "${logfile1}" \
1184 1239
          DEPENDENCIES_DIR="'${dependenciesdir}'" \
1185 1240
          ADDICTIONS_DIR="'${addictionsdir}'" \
1186 1241
          "${c_compiler_line}" \
1187 1242
          "${cxx_compiler_line}" \
1188
-         "${tool_flags}" \
1243
+         "${env_flags}" \
1189 1244
          "'${owd}/${srcdir}/configure'" \
1190
-         "${configureflags}" \
1245
+         "${configure_flags}" \
1191 1246
          --prefix "'${prefixbuild}'"
1192 1247
       rval=$?
1193 1248
 
... ...
@@ -112,16 +112,16 @@ _collect_embedded_stashdir()
112 112
 print_stashdir_embedded_repositories()
113 113
 {
114 114
    walk_auto_repositories "embedded_repositories" \
115
-                     "_collect_embedded_stashdir" \
116
-                     "" \
117
-                     "${EMBEDDED_REPOS_DIR}"
115
+                          "_collect_embedded_stashdir" \
116
+                          "" \
117
+                          "${EMBEDDED_REPOS_DIR}"
118 118
 }
119 119
 
120 120
 
121 121
 setup_clean_environment()
122 122
 {
123 123
    [ -z "${DEPENDENCIES_DIR}"  ]   && internal_fail "DEPENDENCIES_DIR is empty"
124
-   [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "CLONESBUILD_DIR is empty"
124
+   [ -z "${CLONESBUILD_DIR}" ]     && internal_fail "CLONESBUILD_DIR is empty"
125 125
    [ -z "${ADDICTIONS_DIR}" ]      && internal_fail "ADDICTIONS_DIR is empty"
126 126
    [ -z "${STASHES_DEFAULT_DIR}" ] && internal_fail "STASHES_DEFAULT_DIR is empty"
127 127
 
... ...
@@ -274,7 +274,6 @@ clean_files()
274 274
 }
275 275
 
276 276
 
277
-
278 277
 clean_directories()
279 278
 {
280 279
    local directories="$1"
... ...
@@ -368,6 +367,23 @@ ${DEPENDENCIES_DIR}/tmp"`"
368 367
 }
369 368
 
370 369
 
370
+#
371
+# clean embedded repositories out of minion
372
+#
373
+clean_minion()
374
+{
375
+   local minion="$1"
376
+
377
+   local directories
378
+
379
+   [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
380
+
381
+   directories="`_all_repository_stashes "${REPOS_DIR}/.deep/${minion}.d"`"
382
+   clean_directories "${directories}"
383
+   clean_directories "${REPOS_DIR}/.deep/${minion}.d"
384
+}
385
+
386
+
371 387
 #
372 388
 # don't rename these settings anymore, the consequences can be catastrophic
373 389
 # for users of previous versions.
... ...
@@ -377,6 +393,8 @@ clean_main()
377 393
 {
378 394
    log_debug "::: clean :::"
379 395
 
396
+   local MINION_NAME
397
+
380 398
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]        && . mulle-bootstrap-settings.sh
381 399
    [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
382 400
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ]    && . mulle-bootstrap-repositories.sh
... ...
@@ -390,6 +408,14 @@ clean_main()
390 408
             clean_usage
391 409
          ;;
392 410
 
411
+
412
+         -m|--minion)
413
+            shift
414
+            [ $# -ne 0 ] || clean_usage
415
+
416
+            MINION_NAME="${1}"
417
+         ;;
418
+
393 419
          -*)
394 420
             log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown clean option $1"
395 421
             clean_usage
... ...
@@ -409,7 +435,13 @@ clean_main()
409 435
 
410 436
    case "${style}" in
411 437
       "output"|"dist"|"build"|"install")
412
-         clean_execute "${style}"
438
+
439
+         if [ -z "${MINION_NAME}" ]
440
+         then
441
+            clean_execute "${style}"
442
+         else
443
+            clean_minion "${MINION_NAME}"
444
+         fi
413 445
       ;;
414 446
 
415 447
       help)
... ...
@@ -48,7 +48,7 @@ defer_usage()
48 48
 {
49 49
     cat <<EOF >&2
50 50
 usage:
51
-   mulle-bootstrap defer <master>
51
+   mulle-bootstrap defer
52 52
 
53 53
    Share and defer builds to master. The master will be used
54 54
    to fetch dependencies and build them. Use mulle-bootstrap flags
... ...
@@ -82,7 +82,9 @@ defer_main()
82 82
       shift
83 83
    done
84 84
 
85
-   [ -z "${MULLE_BOOTSTRAP_PROJECT_SH}" ] && . mulle-bootstrap-project.sh
85
+   [ $# -eq 0 ] || defer_usage
86
+
87
+   [ -z "${MULLE_BOOTSTRAP_PROJECT_SH}" ]         && . mulle-bootstrap-project.sh
86 88
    [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
87 89
    [ -z "${MULLE_BOOTSTRAP_CLEAN_SH}" ]           && . mulle-bootstrap-clean.sh
88 90
 
... ...
@@ -106,7 +108,7 @@ defer_main()
106 108
       fi
107 109
    fi
108 110
 
109
-   masterpath="${1:-..}"
111
+   masterpath=".."
110 112
    masterpath="`absolutepath "${masterpath}"`"
111 113
 
112 114
    if [ ! -d "${masterpath}" ]
... ...
@@ -227,8 +229,15 @@ emancipate_main()
227 229
          return
228 230
       fi
229 231
    else
232
+      log_info "Cleaning minion before emancipation"
233
+
234
+      local name
235
+
236
+      name="`basename -- "${minionpath}"`"
237
+      ( mulle-bootstrap clean --minion "${name}" )
238
+
230 239
       log_info "Cleaning master before emancipation"
231
-      ( clean_execute "output" )  # not really critical if fails
240
+      ( mulle-bootstrap clean output )
232 241
    fi
233 242
 
234 243
    log_info "Emancipating \"${minionpath}\" from \"${masterpath}\""
... ...
@@ -241,6 +250,7 @@ emancipate_main()
241 250
    # dist clean ourselves
242 251
    #
243 252
    log_info "Cleaning ex-minion after emancipation"
253
+
244 254
    clean_execute "dist"
245 255
 }
246 256
 
... ...
@@ -209,13 +209,13 @@ can_symlink_it()
209 209
 
210 210
    if [ "${OPTION_ALLOW_CREATING_SYMLINKS}" != "YES" ]
211 211
    then
212
-      log_trace "Can't symlink it, because forbidden"
212
+      log_fluff "Can't symlink it, because forbidden"
213 213
       return 1
214 214
    fi
215 215
 
216 216
    case "${UNAME}" in
217 217
       minwgw)
218
-         log_trace "Can't symlink it, because symlinking is unavailable on this platform"
218
+         log_fluff "Can't symlink it, because symlinking is unavailable on this platform"
219 219
          return 1
220 220
       ;;
221 221
    esac
... ...
@@ -280,6 +280,11 @@ _search_for_git_repository_in_cache()
280 280
 
281 281
    local found
282 282
 
283
+   if [ "${MULLE_FLAG_LOG_CACHE}" = "YES" ]
284
+   then
285
+      log_trace "Checking cache path \"${directory}\""
286
+   fi
287
+
283 288
    if [ ! -z "${branch}" ]
284 289
    then
285 290
       found="${directory}/${name}.${branch}"
... ...
@@ -323,6 +328,11 @@ search_for_git_repository_in_caches()
323 328
    local realdir
324 329
    local curdir
325 330
 
331
+   if [ "${MULLE_FLAG_LOG_CACHE}" = "YES" -a -z "${CACHES_PATH}" ]
332
+   then
333
+      log_trace "CACHES_PATH is empty"
334
+   fi
335
+
326 336
    curdir="`pwd -P`"
327 337
    IFS=":"
328 338
    for directory in ${CACHES_PATH}
... ...
@@ -343,6 +353,11 @@ search_for_git_repository_in_caches()
343 353
             symlink_relpath "${found}" "${ROOT_DIR}"
344 354
             return
345 355
          fi
356
+      else
357
+         if [ "${MULLE_FLAG_LOG_CACHE}" = "YES" ]
358
+         then
359
+            log_trace2 "Cache path \"${realdir}\" does not exist"
360
+         fi
346 361
       fi
347 362
    done
348 363
 
... ...
@@ -441,6 +456,7 @@ get_cache_item()
441 456
 
442 457
    if [ "${OPTION_ALLOW_SEARCH_CACHES}" = "NO" ]
443 458
    then
459
+      log_fluff "Not searching caches because --no-caches"
444 460
       return
445 461
    fi
446 462
 
... ...
@@ -452,6 +468,10 @@ get_cache_item()
452 468
       tar*|zip*)
453 469
          search_for_archive_in_caches "${name}" "`basename -- "${url}"`"
454 470
       ;;
471
+
472
+      *)
473
+         log_fluff "Not searching caches because scm is \"${scm}\""
474
+      ;;
455 475
    esac
456 476
 }
457 477
 
... ...
@@ -466,6 +486,7 @@ clone_or_symlink()
466 486
    local tag="$6"       # tag to checkout of the clone
467 487
    local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
468 488
 
489
+
469 490
    assert_sane_parameters "empty reposdir is ok"
470 491
 
471 492
    [ $# -le 7 ] || internal_fail "too many parameters"
... ...
@@ -564,6 +585,7 @@ clone_or_symlink()
564 585
                      fi
565 586
                   ;;
566 587
                esac
588
+               log_info "Using cached item \"${found}\""
567 589
             fi
568 590
          fi
569 591
       ;;
... ...
@@ -633,7 +655,7 @@ Suggested fix:
633 655
             return 1
634 656
          fi
635 657
       fi
636
-      _bury_stash "${reposdir}" "${name}" "${stashdir}"
658
+      bury_stash "${reposdir}" "${name}" "${stashdir}"
637 659
    fi
638 660
 
639 661
    clone_or_symlink "$@"   # pass thru rval
... ...
@@ -1032,13 +1054,13 @@ get_old_stashdir()
1032 1054
 }
1033 1055
 
1034 1056
 
1035
-work_minions()
1057
+auto_update_minions()
1036 1058
 {
1037 1059
    local minions="$1"
1038 1060
 
1039 1061
    local minion
1040 1062
 
1041
-   log_debug "Exploit \"${minions}\""
1063
+   log_debug ":auto_update_minions: (${minions})"
1042 1064
 
1043 1065
    IFS="
1044 1066
 "
... ...
@@ -1051,7 +1073,7 @@ work_minions()
1051 1073
          continue
1052 1074
       fi
1053 1075
 
1054
-      log_debug "${C_INFO}Doing ${minion}..."
1076
+      log_debug "${C_INFO}Updating minion \"${minion}\" ..."
1055 1077
 
1056 1078
       [ ! -d "${minion}" ] && fail "Minion \"${minion}\" is gone"
1057 1079
 
... ...
@@ -1114,7 +1136,7 @@ work_clones()
1114 1136
          continue
1115 1137
       fi
1116 1138
 
1117
-      log_debug "${C_INFO}Doing ${clone}..."
1139
+      log_debug "${C_INFO}Doing clone \"${clone}\" ..."
1118 1140
 
1119 1141
       __REFRESHED__="`add_line "${__REFRESHED__}" "${clone}"`"
1120 1142
 
... ...
@@ -1213,7 +1235,7 @@ work_clones()
1213 1235
                                      "${branch}" \
1214 1236
                                      "${scm}" \
1215 1237
                                      "${tag}" \
1216
-                                     "${stashdir}" > /dev/null
1238
+                                     "${stashdir}"
1217 1239
                ;;
1218 1240
 
1219 1241
                remove*)
... ...
@@ -1223,9 +1245,7 @@ work_clones()
1223 1245
                      oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1224 1246
                   fi
1225 1247
 
1226
-                  log_info "Removing old ${repotype}stash ${C_MAGENTA}${C_BOLD}${oldstashdir}${C_INFO}"
1227
-
1228
-                  rmdir_safer "${oldstashdir}"
1248
+                  bury_stash "${reposdir}" "${name}" "${oldstashdir}"
1229 1249
                ;;
1230 1250
 
1231 1251
                "set-remote")
... ...
@@ -1292,11 +1312,67 @@ fetch_once_embedded_repositories()
1292 1312
 
1293 1313
       clones="`read_root_setting "embedded_repositories"`" ;
1294 1314
       work_clones "${EMBEDDED_REPOS_DIR}" "${clones}" "NO"
1295
-   ) > /dev/null || exit 1
1315
+   ) || exit 1
1316
+}
1317
+
1318
+
1319
+#
1320
+#
1321
+#
1322
+fetch_once_minions_embedded_repositories()
1323
+{
1324
+   log_debug "fetch_once_minions_embedded_repositories"
1325
+
1326
+   local minions
1327
+
1328
+   minions="`read_root_setting minions`"
1329
+
1330
+   local minion
1331
+
1332
+   IFS="
1333
+"
1334
+   for minion in ${minions}
1335
+   do
1336
+      IFS="${DEFAULT_IFS}"
1337
+
1338
+      if [ -z "${minion}" ]
1339
+      then
1340
+         continue
1341
+      fi
1342
+
1343
+      log_debug "${C_INFO}Doing minion \"${minion}\" ..."