Browse code

Make config and expansions easier to use. Improve output for debugging. Frameworks are now "force" moved from /tmp, which fixes problems of changes in a second build not showing up. Fix various other bugs.

Nat! authored on 18-04-2017 12:12:13
Showing 23 changed files
... ...
@@ -1,7 +1,26 @@
1
+### 3.3.0
2
+
3
+* `mulle-bootstrap project-path` prints out what it thinks your project path is.
4
+This is helpful for **mulle-build**.
5
+* Improve output of `mulle-bootstrap -v help`.
6
+* An empty expansion in repositories is now an error by default. But you can
7
+change it back to previous behavior with  `mulle-bootstrap config -n empty_expansion_is_error`
8
+* The `-g` option no longer works for `mulle-bootstrap config`, use the `-u`
9
+setting to set values in `~/.bootstrap`. This unconfuses the '-g' which means
10
+`.bootstrap` and not `.bootstrap.local`, the default.
11
+* `mulle-bootstrap expansion -l` works now
12
+* You can now use `<key>=<value>` to set settings and expansions. This makes
13
+it easier to copy/paste show output.
14
+* Missing but not required repositories no longer produce a build error
15
+* added `-fb` as lesser -force mode than -f.
16
+* old Frameworks of previous builds are not a problem anymore
17
+* With config `use_cc_cxx=NO` mulle-bootstrap won't read the compiler to use
18
+from `.CC` and `.CXX`.
19
+
1 20
 ### 3.2.0
2 21
 
3
-Do not specify cmake dependency in formula, since cmake is not
4
-absolutely required. Rather check this at runtime and output
22
+Do not specify cmake dependency in homebrew formula for mulle-bootstrap, since
23
+cmake is not absolutely required. Rather check this at runtime and output
5 24
 some helpful hints.
6 25
 
7 26
 
... ...
@@ -90,7 +90,7 @@ new position of the `addictions` folder in the filesystem.
90 90
 Cloning **brew** from GitHub can get tedious. You can use a local cache with:
91 91
 
92 92
 ```
93
-mulle-brew config -g "clone_cache" "${HOME}/Library/Caches/mulle-brew"
93
+mulle-brew config -h "clone_cache" "${HOME}/Library/Caches/mulle-brew"
94 94
 ```
95 95
 
96 96
 
... ...
@@ -171,6 +171,9 @@ fi
171 171
 install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-bootstrap" || exit 1
172 172
 printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap" >&2
173 173
 
174
+install -m "${mode}" "mulle-bootstrap-dotdump" "${bin}/mulle-bootstrap-dotdump" || exit 1
175
+printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "${bin}/mulle-bootstrap-dotdump" >&2
176
+
174 177
 case `uname` in
175 178
    MINGW*)
176 179
       install -m "${mode}" "mulle-bootstrap" "${bin}/mulle-brew" || exit 1
... ...
@@ -29,8 +29,8 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_EXECUTABLE_VERSION_MAJOR=3
32
-MULLE_EXECUTABLE_VERSION_MINOR=2
33
-MULLE_EXECUTABLE_VERSION_PATCH=3
32
+MULLE_EXECUTABLE_VERSION_MINOR=3
33
+MULLE_EXECUTABLE_VERSION_PATCH=0
34 34
 
35 35
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
36 36
 
... ...
@@ -45,9 +45,56 @@ trap_fail()
45 45
 }
46 46
 
47 47
 
48
+SHOWN_COMMANDS="\
49
+   bootstrap     : does install and build recursively [default]
50
+   build         : builds fetched repositories
51
+   clean         : cleans mulle-bootstrap produced files.
52
+   defer         : join a master mulle-bootstrap project
53
+   emancipate    : emancipate from a master mulle-bootstrap project
54
+   paths         : get include and library paths
55
+   init          : initializes a bootstrap project
56
+   update        : updates repositories (fetch).
57
+   upgrade       : updates and checks out repositories (pull).
58
+   show          : show repositories and brews"
59
+
60
+DARWIN_COMMANDS="\
61
+   xcode         : sets up xcodeproj settings"
62
+HIDDEN_COMMANDS="\
63
+   config        : read or edit config settings
64
+   expansion     : read or edit fetch expansions
65
+   git           : run git commands on fetched repositories
66
+   library-path  : print path to mulle-bootstrap libexec
67
+   project-path  : print path to folder containing .bootstrap
68
+   setting       : read or edit build settings
69
+   status        : show status of repositories and brews
70
+   systeminstall : install dependencies as system headers
71
+   tag           : tag fetched repositories
72
+   uname         : mulle-bootstraps simplified uname(1)
73
+   version       : print mulle-bootstrap version"
74
+
75
+
76
+print_commands()
77
+{
78
+   local  show_all="${1:-NO}"
79
+
80
+   echo "${SHOWN_COMMANDS}"
81
+
82
+   if [ "${UNAME}" = 'darwin' ]
83
+   then
84
+      echo "${DARWIN_COMMANDS}"
85
+   fi
86
+
87
+   if [ "${show_all}" != "NO" ]
88
+   then
89
+      echo "${HIDDEN_COMMANDS}"
90
+   fi
91
+}
92
+
48 93
 
49 94
 mulle_bootstrap_usage()
50 95
 {
96
+   local  verbose="${1:-NO}"
97
+
51 98
    cat <<EOF
52 99
 usage: mulle-bootstrap [flags] [command] [options]
53 100
  Flags:
... ...
@@ -66,37 +113,21 @@ EOF
66 113
    cat <<EOF
67 114
 
68 115
  Commands:
69
-   bootstrap     : does install and build recursively [default]
70
-   build         : builds fetched repositories
71
-   clean         : cleans mulle-bootstrap produced files.
72
-   defer         : join a master mulle-bootstrap project
73
-   emancipate    : emancipate from a master mulle-bootstrap project
74
-   paths         : get include and library paths
75
-   init          : initializes a bootstrap project
76
-   update        : updates repositories (fetch).
77
-   upgrade       : updates and checks out repositories (pull).
78
-   show          : show repositories and brews
79
-
80
- Options are command specific. Use mulle-bootstrap <command> -h for help.
81 116
 EOF
82 117
 
83
-   if [ "${UNAME}" = 'darwin' ]
118
+   print_commands "${verbose}" | sort
119
+
120
+
121
+   if [ "${verbose}" = "NO" ]
84 122
    then
85 123
       cat <<EOF
86
-   xcode         : sets up xcodeproj settings
124
+      (use mulle-bootstrap -v help to show more commands)
87 125
 EOF
88 126
    fi
89 127
 
90
-   if [ !  -z "${MULLE_TRACE}" ]
91
-   then
92
-      cat <<EOF
93
-
94
-   systeminstall : install dependencies as system headers
95
-   git           : run git commands on fetched repositories
96
-   status        : show status of repositories and brews
97
-   tag           : tag fetched repositories
128
+   cat <<EOF
129
+ Options are command specific. Use mulle-bootstrap <command> -h for help.
98 130
 EOF
99
-   fi
100 131
 
101 132
    exit 1
102 133
 }
... ...
@@ -254,7 +285,7 @@ bootstrap_main()
254 285
    local ps4string
255 286
 
256 287
    local MULLE_FLAG_ANSWER="ASK"
257
-   local MULLE_FLAG_MAGNUM_FORCE="NO"
288
+   local MULLE_FLAG_MAGNUM_FORCE="none"
258 289
    local MULLE_FLAG_IGNORE_GRAVEYARD="NO"
259 290
    local MULLE_FLAG_VERBOSE_BUILD="NO"
260 291
 
... ...
@@ -304,8 +335,12 @@ bootstrap_main()
304 335
             MULLE_FLAG_FOLLOW_SYMLINKS="YES"
305 336
          ;;
306 337
 
307
-         -f|--force-fetch)
308
-            MULLE_FLAG_MAGNUM_FORCE="YES"
338
+         -fb|--force-build)
339
+            MULLE_FLAG_MAGNUM_FORCE="build"
340
+         ;;
341
+
342
+         -f|--force)
343
+            MULLE_FLAG_MAGNUM_FORCE="both"
309 344
          ;;
310 345
 
311 346
          --ignore-graveyard)
... ...
@@ -313,7 +348,7 @@ bootstrap_main()
313 348
          ;;
314 349
 
315 350
          -h|--help)
316
-            mulle_bootstrap_usage
351
+            mulle_bootstrap_usage "${MULLE_TRACE}"
317 352
          ;;
318 353
 
319 354
          -D*)  # just like C
... ...
@@ -352,11 +387,16 @@ bootstrap_main()
352 387
    #
353 388
    command="${1:-bootstrap}"
354 389
 
355
-   if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "YES" ]
356
-   then
357
-      set_fetch_needed
358
-      set_build_needed
359
-   fi
390
+   case "${MULLE_FLAG_MAGNUM_FORCE}" in
391
+      both)
392
+         set_fetch_needed
393
+         set_build_needed
394
+      ;;
395
+
396
+      build)
397
+         set_build_needed
398
+      ;;
399
+   esac
360 400
 
361 401
    case "${command}" in
362 402
       help|init|uname)
... ...
@@ -382,18 +422,26 @@ bootstrap_main()
382 422
       ;;
383 423
    esac
384 424
 
425
+   case "${command}" in
426
+      project-path)
427
+         echo "`pwd -P`"
428
+         exit 0
429
+      ;;
430
+   esac
431
+
385 432
    if bootstrap_should_defer_to_master "$@"
386 433
    then
387 434
       return 1
388 435
    fi
389 436
 
390
-   if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
437
+   #
438
+   # some commands are only valid, if the fetch went through
439
+   # defer/emancipate clean, so that's ok
440
+   #
441
+   if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "none" ]
391 442
    then
392 443
       case "${command}" in
393
-         clean|config|dist-clean|expansion|init|status|show|paths|setting|uname)
394
-         ;;
395
-
396
-         *)
444
+         bootstrap|build|systeminstall|tag|update|upgrade)
397 445
             bootstrap_ensure_consistency
398 446
          ;;
399 447
       esac
... ...
@@ -464,7 +512,7 @@ bootstrap_main()
464 512
       ;;
465 513
 
466 514
       help)
467
-         mulle_bootstrap_usage "$@" || exit 1
515
+         mulle_bootstrap_usage "${MULLE_TRACE}" || exit 1
468 516
       ;;
469 517
 
470 518
       init)
471 519
new file mode 100755
... ...
@@ -0,0 +1,126 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4
+#   Copyright (c) 2017 Nat! - Codeon GmbH
5
+#   All rights reserved.
6
+#
7
+#   Redistribution and use in source and binary forms, with or without
8
+#   modification, are permitted provided that the following conditions are met:
9
+#
10
+#   Redistributions of source code must retain the above copyright notice, this
11
+#   list of conditions and the following disclaimer.
12
+#
13
+#   Redistributions in binary form must reproduce the above copyright notice,
14
+#   this list of conditions and the following disclaimer in the documentation
15
+#   and/or other materials provided with the distribution.
16
+#
17
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
18
+#   may be used to endorse or promote products derived from this software
19
+#   without specific prior written permission.
20
+#
21
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
+#   POSSIBILITY OF SUCH DAMAGE.
32
+
33
+
34
+#
35
+# this is a quick hack to show dependencies of respositories using
36
+# graphviz. It doesn't work 100% because it can not do expansion
37
+# properly. Also the owning projectname is guessed by using the
38
+# enclosing directory-name. Still better than nothing.
39
+#
40
+fail()
41
+{
42
+   echo "Fatal error: $*" >&2
43
+   exit 1
44
+}
45
+
46
+
47
+draw_repositories()
48
+{
49
+   local path="$1"
50
+   local repository="$2"
51
+   local color="${3:-black}"
52
+   local bgcolor="${4:-white}"
53
+
54
+   [ ! -z "${path}" ]       || fail "empty path"
55
+   [ ! -z "${repository}" ] || fail "empty repository"
56
+
57
+   local origin
58
+   local filepath
59
+   local name
60
+   local repo
61
+   local line
62
+
63
+   IFS="
64
+"
65
+   for filepath in `find "${path}" -name "${repository}" -print | fgrep -v '.bootstrap.auto' | fgrep '.bootstrap/'`
66
+   do
67
+      origin="`dirname -- "${filepath}"`"
68
+      origin="`dirname -- "${origin}"`"
69
+      origin="`basename -- "${origin}"`"
70
+
71
+      for line in `cat "${filepath}" | fgrep -v '#'`
72
+      do
73
+         repo="`cut '-d;' -f1 <<< "${line}"`"
74
+         if [ ! -z "${repo}" ]
75
+         then
76
+            name="`basename -- "${repo}"`"
77
+            case "${name}" in
78
+               *.gz|*.tgz)
79
+               ;;
80
+
81
+               *)
82
+                  name="${name%.*}"  # remove extension
83
+               ;;
84
+            esac
85
+
86
+            if [ ! -z "${name}" ]
87
+            then
88
+               echo "\"${name}\"                    [ fontcolor=\"${color}\"; fillcolor=\"${bgcolor}\"; color=\"${bgcolor}\" ]"
89
+               echo "\"${origin}\" -> \"${name}\"   [ fontcolor=\"${color}\" ]"
90
+            fi
91
+         fi
92
+      done
93
+   done
94
+}
95
+
96
+
97
+
98
+main()
99
+{
100
+   local path="${1:-`pwd -P`}"
101
+
102
+   cat <<EOF >&2
103
+mulle-bootstrap-dotdump.sh has known deficiencies.
104
+Nevertheless it can be useful.
105
+
106
+Give it a path to your source code, and it will
107
+create a Graphviz dot file, showing you the
108
+dependencies of your .bootstrap enabled projects.
109
+EOF
110
+
111
+   cat <<EOF
112
+digraph dependencies
113
+{
114
+      node [ shape="box"; style="filled" ]
115
+EOF
116
+
117
+   draw_repositories "${path}" "repositories" "black" "goldenrod"
118
+   draw_repositories "${path}" "embedded_repositories" "white" "indigo"
119
+   draw_repositories "${path}" "brews" "white" "darkgreen"
120
+
121
+   cat <<EOF
122
+}
123
+EOF
124
+}
125
+
126
+main "$@"
... ...
@@ -29,8 +29,8 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_EXECUTABLE_VERSION_MAJOR=3
32
-MULLE_EXECUTABLE_VERSION_MINOR=2
33
-MULLE_EXECUTABLE_VERSION_PATCH=3
32
+MULLE_EXECUTABLE_VERSION_MINOR=3
33
+MULLE_EXECUTABLE_VERSION_PATCH=0
34 34
 
35 35
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
36 36
 
... ...
@@ -32,6 +32,20 @@
32 32
 MULLE_BOOTSTRAP_AUTO_UPDATE_SH="included"
33 33
 
34 34
 
35
+seen_check()
36
+{
37
+   local seen="$1"
38
+   local name="$1"
39
+
40
+   if [ ! -z "${seen}" -a "${name}" = "minions" ]
41
+   then
42
+      log_warning "Specifying both minions and ${seen} is usually a mistake"
43
+   fi
44
+
45
+   concat "${seen}" "${name}"
46
+}
47
+
48
+
35 49
 #
36 50
 # only to be used in bootstrap_auto_create
37 51
 #
... ...
@@ -51,6 +65,7 @@ _bootstrap_auto_copy()
51 65
    local value
52 66
    local match
53 67
    local tmpdir
68
+   local seen
54 69
 
55 70
    #
56 71
    # this first stage folds platform specific files
... ...
@@ -96,6 +111,7 @@ _bootstrap_auto_copy()
96 111
 
97 112
          repositories)
98 113
             merge_repository_files "${filepath}" "${dstfilepath}" "NO"
114
+            seen="`seen_check "${seen}" "${name}"`"
99 115
          ;;
100 116
 
101 117
          embedded_repositories)
... ...
@@ -104,6 +120,7 @@ _bootstrap_auto_copy()
104 120
                STASHES_ROOT_DIR=""
105 121
                merge_repository_files "${filepath}" "${dstfilepath}" "NO"
106 122
             )
123
+            seen="`seen_check "${seen}" "${name}"`"
107 124
          ;;
108 125
 
109 126
          minions)
... ...
@@ -111,6 +128,7 @@ _bootstrap_auto_copy()
111 128
             then
112 129
                exekutor cp -a ${COPYMOVEFLAGS} "${filepath}" "${dstfilepath}" >&2
113 130
             fi
131
+            seen="`seen_check "${seen}" "${name}"`"
114 132
          ;;
115 133
 
116 134
          *)
... ...
@@ -148,9 +166,20 @@ _bootstrap_create_required_if_needed()
148 166
    # if there is no required file add all names from repositories
149 167
    # which ought to have been expanded already
150 168
    #
151
-   if [ ! -f "${dst}/${prefix}required" -a -f "${dst}/${prefix}repositories" ]
169
+   if [ ! -f "${dst}/${prefix}required" ]
152 170
    then
153
-      redirect_exekutor "${dst}/${prefix}required" names_from_repository_file "${dst}/${prefix}repositories"
171
+      if [ -f "${dst}/${prefix}repositories" ]
172
+      then
173
+         redirect_exekutor "${dst}/${prefix}required" names_from_repository_file "${dst}/${prefix}repositories"
174
+      fi
175
+
176
+      #
177
+      # Are Minions required ? Could be annoying
178
+      #
179
+      # if [ -z "${prefix}" -a -f "${dst}/minions" ]
180
+      # then
181
+      #   redirect_exekutor "${dst}/required" read_setting "${dst}/minions"
182
+      # fi
154 183
    fi
155 184
 }
156 185
 
... ...
@@ -64,7 +64,7 @@ EOF
64 64
 
65 65
       *)
66 66
          cat <<EOF >&2
67
-   -j         :  number of cores parameter for make (${CORES})
67
+   -j             :  number of cores parameter for make (${CORES})
68 68
 EOF
69 69
       ;;
70 70
    esac
... ...
@@ -134,7 +134,7 @@ find_compiler()
134 134
    local filename
135 135
 
136 136
    compiler="`read_build_setting "${name}" "${compiler_name}"`"
137
-   if [ -z "${compiler}" ]
137
+   if [ -z "${compiler}" -a "${OPTION_USE_CC_CXX}" = "YES" ]
138 138
    then
139 139
       filename="${srcdir}/.${compiler_name}"
140 140
       compiler="`cat "${filename}" 2>/dev/null`"
... ...
@@ -307,7 +307,7 @@ dispense_binaries()
307 307
          log_fluff "Copying binaries from \"${src}\" to \"${dst}\""
308 308
          mkdir_if_missing "${dst}"
309 309
          exekutor find "${src}" -xdev -mindepth 1 -maxdepth 1 \( -type "${findtype}" -o -type "${findtype2}" \) -print0 | \
310
-            exekutor xargs -0 -I % mv ${COPYMOVEFLAGS} "${copyflag}" % "${dst}" >&2
310
+            exekutor xargs -0 -I % mulle-bootstrap-mv-force.sh ${COPYMOVEFLAGS} "${copyflag}" % "${dst}" >&2
311 311
          [ $? -eq 0 ]  || exit 1
312 312
       else
313 313
          log_fluff "But there are none"
... ...
@@ -571,7 +571,6 @@ build_log_name()
571 571
 }
572 572
 
573 573
 
574
-
575 574
 _build_flags()
576 575
 {
577 576
    local configuration="$1"
... ...
@@ -700,7 +699,7 @@ _build_flags()
700 699
       do
701 700
          IFS="${DEFAULT_IFS}"
702 701
          path="$(sed 's/ /\\ /g' <<< "${path}")"
703
-         cppflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
702
+         cppflags="`concat "${cppflags}" "${includeprefix}${path}"`"
704 703
       done
705 704
 
706 705
       IFS="${PATH_SEPARATOR}"
... ...
@@ -708,7 +707,7 @@ _build_flags()
708 707
       do
709 708
          IFS="${DEFAULT_IFS}"
710 709
          path="$(sed 's/ /\\ /g' <<< "${path}")"
711
-         ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
710
+         ldflags="`concat "${ldflags}" "${libraryprefix}${path}"`"
712 711
       done
713 712
 
714 713
       IFS="${PATH_SEPARATOR}"
... ...
@@ -716,8 +715,8 @@ _build_flags()
716 715
       do
717 716
          IFS="${DEFAULT_IFS}"
718 717
          path="$(sed 's/ /\\ /g' <<< "${path}")"
719
-         other_cppflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
720
-         ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
718
+         cppflags="`concat "${cppflags}" "${frameworkprefix}${path}"`"
719
+         ldflags="`concat "${ldflags}" "${frameworkprefix}${path}"`"
721 720
       done
722 721
       IFS="${DEFAULT_IFS}"
723 722
 
... ...
@@ -831,11 +830,11 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
831 830
    local librarylines
832 831
    local frameworklines
833 832
 
834
-   cppflags="`echo "${flaglines}"   | sed -n '1p'`"
835
-   ldflags="`echo "${flaglines}"    | sed -n '2p'`"
836
-   includelines="`echo "${flags}"   | sed -n '6p'`"
837
-   librarylines="`echo "${flags}"   | sed -n '7p'`"
838
-   frameworklines="`echo "${flags}" | sed -n '8p'`"
833
+   cppflags="`echo "${flaglines}"       | sed -n '1p'`"
834
+   ldflags="`echo "${flaglines}"        | sed -n '2p'`"
835
+   includelines="`echo "${flaglines}"   | sed -n '6p'`"
836
+   librarylines="`echo "${flaglines}"   | sed -n '7p'`"
837
+   frameworklines="`echo "${flaglines}" | sed -n '8p'`"
839 838
 
840 839
    # CMAKE_CPP_FLAGS does not exist in cmake
841 840
    # so merge into CFLAGS and CXXFLAGS
... ...
@@ -945,10 +944,14 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
945 944
          cmake_dirs="`concat "${cmake_dirs}" "-DADDICTIONS_DIR='${addictionsdir}'"`"
946 945
       fi
947 946
 
948
-      if [ ! -z "${includelines}" ]
949
-      then
950
-         cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
951
-      fi
947
+      #
948
+      # CMAKE_INCLUDE_PATH doesn't really do what one expects it would
949
+      # it's a settinh for the rarely used find_file
950
+      #
951
+      #if [ ! -z "${includelines}" ]
952
+      #then
953
+      #   cmake_dirs="`concat "${cmake_dirs}" "-DCMAKE_INCLUDE_PATH='${includelines}'"`"
954
+      #fi
952 955
 
953 956
       if [ ! -z "${librarylines}" ]
954 957
       then
... ...
@@ -1068,17 +1071,17 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1068 1071
    other_cppflags="`gcc_cppflags_value "${name}"`"
1069 1072
    other_ldflags="`gcc_ldflags_value "${name}"`"
1070 1073
 
1071
-   local flags
1074
+   local flaglines
1072 1075
    local mapped
1073 1076
 
1074 1077
    mapped="`read_build_setting "${name}" "cmake-${configuration}.map" "${configuration}"`"
1075
-   flags="`build_unix_flags "$@" "${mapped}"`"
1078
+   flaglines="`build_unix_flags "$@" "${mapped}"`"
1076 1079
 
1077 1080
    local cppflags
1078 1081
    local ldflags
1079 1082
 
1080
-   cppflags="`echo "${flags}" | sed -n '1p'`"
1081
-   ldflags="`echo "${flags}"  | sed -n '2p'`"
1083
+   cppflags="`echo "${flaglines}" | sed -n '1p'`"
1084
+   ldflags="`echo "${flaglines}"  | sed -n '2p'`"
1082 1085
 
1083 1086
    # CMAKE_CPP_FLAGS does not exist in cmake
1084 1087
    # so merge into CFLAGS and CXXFLAGS
... ...
@@ -2130,6 +2133,10 @@ build_stashes()
2130 2133
             IFS="${DEFAULT_IFS}"
2131 2134
 
2132 2135
             stashdir="`stash_of_repository "${REPOS_DIR}" "${name}"`"
2136
+            if [ -z "${stashdir}" ]
2137
+            then
2138
+               fail "${REPOS_DIR}/${name} is missing, that shouldn't have happened. Maybe it's time to dist clean"
2139
+            fi
2133 2140
 
2134 2141
             if [ -d "${stashdir}" ]
2135 2142
             then
... ...
@@ -2140,7 +2147,12 @@ build_stashes()
2140 2147
                   log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2141 2148
                   :
2142 2149
                else
2143
-                  fail "Build failed for repository \"${name}\": not found in (\"${stashdir}\") ($PWD)"
2150
+                  if [ ! -z "${stashdir}" ]
2151
+                  then
2152
+                     fail "Build failed for repository \"${name}\": not found in (\"${stashdir}\") ($PWD)"
2153
+                  else
2154
+                     log_fluff "Ignoring \"${name}\" as \"${stashdir}\" is missing, but it is not required"
2155
+                  fi
2144 2156
                fi
2145 2157
             fi
2146 2158
          done
... ...
@@ -2159,7 +2171,12 @@ build_stashes()
2159 2171
                log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a system library, so not building it"
2160 2172
                :
2161 2173
             else
2162
-               fail "Unknown repo \"${name}\""
2174
+               if [ ! -z "${stashdir}" ]
2175
+               then
2176
+                  fail "Build failed for repository \"${name}\": not found in (\"${stashdir}\") ($PWD)"
2177
+               else
2178
+                  fail "Unknown repo \"${name}\", possibly not a required one."
2179
+               fi
2163 2180
             fi
2164 2181
          fi
2165 2182
       done
... ...
@@ -2222,8 +2239,10 @@ build_main()
2222 2239
    local OPTION_CHECK_USR_LOCAL_INCLUDE
2223 2240
    local OPTION_CONFIGURATIONS
2224 2241
    local OPTION_ADD_USR_LOCAL
2242
+   local OPTION_USE_CC_CXX
2225 2243
 
2226 2244
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
2245
+   OPTION_USE_CC_CXX="`read_config_setting "use_cc_cxx" "YES"`"
2227 2246
 
2228 2247
    #
2229 2248
    # it is useful, that fetch understands build options and
... ...
@@ -2318,18 +2337,14 @@ build_main()
2318 2337
 
2319 2338
    build_complete_environment
2320 2339
 
2321
-   [ -z "${MULLE_BOOTSTRAP_COMMAND_SH}" ] && . mulle-bootstrap-command.sh
2322
-   [ -z "${MULLE_BOOTSTRAP_GCC_SH}" ] && . mulle-bootstrap-gcc.sh
2340
+   [ -z "${MULLE_BOOTSTRAP_COMMAND_SH}" ]      && . mulle-bootstrap-command.sh
2341
+   [ -z "${MULLE_BOOTSTRAP_GCC_SH}" ]          && . mulle-bootstrap-gcc.sh
2323 2342
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ] && . mulle-bootstrap-repositories.sh
2324
-   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ] && . mulle-bootstrap-scripts.sh
2343
+   [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ]      && . mulle-bootstrap-scripts.sh
2325 2344
 
2326 2345
    #
2327 2346
    #
2328 2347
    #
2329
-   if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "YES" ]
2330
-   then
2331
-      remove_file_if_present "${REPOS_DIR}/.build_done"
2332
-   fi
2333 2348
 
2334 2349
    if [ ! -f "${REPOS_DIR}/.build_done" ]
2335 2350
    then
... ...
@@ -102,7 +102,7 @@ defer_main()
102 102
       [ ! -z "${masterpath}" ]  || internal_fail "is_minion file empty"
103 103
       log_warning "Master \"${masterpath}\" already owns \"${minionpath}\""
104 104
 
105
-      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
105
+      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "none" ]
106 106
       then
107 107
          return
108 108
       fi
... ...
@@ -135,7 +135,7 @@ defer_main()
135 135
    then
136 136
       log_warning "Master \"${masterpath}\" already owns \"${minionpath}\", but it was not detected before"
137 137
 
138
-      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
138
+      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "none" ]
139 139
       then
140 140
          return
141 141
       fi
... ...
@@ -204,7 +204,7 @@ emancipate_main()
204 204
    then
205 205
       log_warning "Project \"${minionpath}\" does not defer to a master and is already emancipated"
206 206
 
207
-      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
207
+      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "none" ]
208 208
       then
209 209
          return
210 210
       fi
... ...
@@ -224,7 +224,7 @@ emancipate_main()
224 224
    if ! is_master_bootstrap_project "${masterpath}"
225 225
    then
226 226
       log_warning "\"${masterpath}\" is not a master project"
227
-      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "NO" ]
227
+      if [ "${MULLE_FLAG_MAGNUM_FORCE}" = "none" ]
228 228
       then
229 229
          return
230 230
       fi
... ...
@@ -581,6 +581,7 @@ clone_or_symlink()
581 581
                        "${tag}" \
582 582
                        "${stashdir}"
583 583
    then
584
+      log_debug "Clone \"${operation}\" failed"
584 585
       return 1
585 586
    fi
586 587
 
... ...
@@ -593,9 +594,11 @@ clone_or_symlink()
593 594
 
594 595
    if [ "${operation}" = "link_command" ]
595 596
    then
597
+      log_debug "Symlink \"${operation}\" successful"
596 598
       return 2
597 599
    fi
598 600
 
601
+   log_debug "Clone \"${operation}\" successful"
599 602
    return 0
600 603
 }
601 604
 
... ...
@@ -1142,9 +1145,13 @@ work_clones()
1142 1145
             internal_fail "failed stashdir: ${stashdir}"
1143 1146
       esac
1144 1147
 
1148
+      local skip
1149
+
1150
+      skip="NO"
1151
+
1145 1152
       if is_minion_bootstrap_project "${name}"
1146 1153
       then
1147
-         log_fluff "Is a minion, ignoring possible changes"
1154
+         log_fluff "\"${name}\" is a minion, ignoring possible changes"
1148 1155
          clone="`echo "${name};${name};${branch};minion;${tag}" | sed 's/;*$//'`"
1149 1156
          remember="YES"
1150 1157
       else
... ...
@@ -1159,9 +1166,6 @@ work_clones()
1159 1166
 
1160 1167
          log_debug "${C_INFO}Actions for \"${name}\": ${actionitems:-none}"
1161 1168
 
1162
-         local skip
1163
-
1164
-         skip="NO"
1165 1169
          IFS="
1166 1170
 "
1167 1171
          for item in ${actionitems}
... ...
@@ -1172,13 +1176,16 @@ work_clones()
1172 1176
 
1173 1177
             case "${item}" in
1174 1178
                "checkout")
1175
-                  checkout_repository "${reposdir}" \
1176
-                                      "${name}" \
1177
-                                      "${url}" \
1178
-                                      "${branch}" \
1179
-                                      "${scm}" \
1180
-                                      "${tag}" \
1181
-                                      "${stashdir}"
1179
+                  if ! checkout_repository "${reposdir}" \
1180
+                                           "${name}" \
1181
+                                           "${url}" \
1182
+                                           "${branch}" \
1183
+                                           "${scm}" \
1184
+                                           "${tag}" \
1185
+                                           "${stashdir}"
1186
+                  then
1187
+                     fail "Failed to checkout"
1188
+                  fi
1182 1189
                ;;
1183 1190
 
1184 1191
                "clone")
... ...
@@ -1208,6 +1215,7 @@ work_clones()
1208 1215
                            continue
1209 1216
                         fi
1210 1217
 
1218
+                        log_debug "don't continue, because a required fetch failed"
1211 1219
                         exit 1  # means exit
1212 1220
                      ;;
1213 1221
 
... ...
@@ -1283,6 +1291,7 @@ work_clones()
1283 1291
 
1284 1292
       if [ "${skip}" = "YES" ]
1285 1293
       then
1294
+         log_debug "skipping to next clone because..."
1286 1295
          continue
1287 1296
       fi
1288 1297
 
... ...
@@ -1299,6 +1308,8 @@ work_clones()
1299 1308
                                       "${name}"  \
1300 1309
                                       "${stashdir}" \
1301 1310
                                       "${PARENT_CLONE}"
1311
+      else
1312
+         log_debug "ignoring because..."
1302 1313
       fi
1303 1314
       mark_stash_as_alive "${reposdir}" "${name}"
1304 1315
    done
... ...
@@ -1778,6 +1789,7 @@ _common_main()
1778 1789
       ;;
1779 1790
    esac
1780 1791
 
1792
+
1781 1793
    local default_permissions
1782 1794
 
1783 1795
    #
... ...
@@ -1803,8 +1815,8 @@ _common_main()
1803 1815
    esac
1804 1816
 
1805 1817
    remove_file_if_present "${REPOS_DIR}/.build_done"
1806
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_done"
1807
-   create_file_if_missing "${REPOS_DIR}/.bootstrap_fetch_started"
1818
+   remove_file_if_present "${REPOS_DIR}/.fetch_done"
1819
+   create_file_if_missing "${REPOS_DIR}/.fetch_started"
1808 1820
 
1809 1821
    if [ "${BREW_PERMISSIONS}" != "none" ]
1810 1822
    then
... ...
@@ -1825,14 +1837,14 @@ _common_main()
1825 1837
 
1826 1838
    _common_fetch "$@"
1827 1839
 
1828
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_started"
1840
+   remove_file_if_present "${REPOS_DIR}/.fetch_started"
1829 1841
 
1830 1842
    #
1831 1843
    # only say we are done if a build_order was created
1832 1844
    #
1833 1845
    if [ -f "${BOOTSTRAP_DIR}.auto/build_order" ]
1834 1846
    then
1835
-      create_file_if_missing "${REPOS_DIR}/.bootstrap_fetch_done"
1847
+      create_file_if_missing "${REPOS_DIR}/.fetch_done"
1836 1848
    fi
1837 1849
 
1838 1850
    if read_yes_no_config_setting "upgrade_gitignore" "YES"
... ...
@@ -72,6 +72,7 @@ exekutor_trace()
72 72
 
73 73
 exekutor_trace_output()
74 74
 {
75
+   local redirect="$1"; shift
75 76
    local output="$1"; shift
76 77
 
77 78
    if [ "${MULLE_FLAG_EXEKUTOR_DRY_RUN}" = "YES" -o "${MULLE_FLAG_LOG_EXEKUTOR}" = "YES" ]
... ...
@@ -89,9 +90,9 @@ exekutor_trace_output()
89 90
 
90 91
       if [ -z "${MULLE_EXEKUTOR_LOG_DEVICE}" ]
91 92
       then
92
-         echo "${arrow}" "$@" ">" "${output}" >&2
93
+         echo "${arrow}" "$@" "${redirect}" "${output}" >&2
93 94
       else
94
-         echo "${arrow}" "$@" ">" "${output}" > "${MULLE_EXEKUTOR_LOG_DEVICE}"
95
+         echo "${arrow}" "$@" "${redirect}" "${output}" > "${MULLE_EXEKUTOR_LOG_DEVICE}"
95 96
       fi
96 97
    fi
97 98
 }
... ...
@@ -124,7 +125,7 @@ redirect_exekutor()
124 125
 {
125 126
    local output="$1"; shift
126 127
 
127
-   exekutor_trace_output "${output}" "$@"
128
+   exekutor_trace_output '>' "${output}" "$@"
128 129
 
129 130
    if [ "${MULLE_FLAG_EXEKUTOR_DRY_RUN}" != "YES" ]
130 131
    then
... ...
@@ -137,7 +138,7 @@ redirect_append_exekutor()
137 138
 {
138 139
    local output="$1"; shift
139 140
 
140
-   exekutor_trace_output "${output}" "$@"
141
+   exekutor_trace_output '>>' "${output}" "$@"
141 142
 
142 143
    if [ "${MULLE_FLAG_EXEKUTOR_DRY_RUN}" != "YES" ]
143 144
    then
... ...
@@ -150,7 +151,7 @@ _redirect_append_eval_exekutor()
150 151
 {
151 152
    local output="$1"; shift
152 153
 
153
-   exekutor_trace_output "${output}" "$@"
154
+   exekutor_trace_output '>>' "${output}" "$@"
154 155
 
155 156
    if [ "${MULLE_FLAG_EXEKUTOR_DRY_RUN}" != "YES" ]
156 157
    then
... ...
@@ -1072,6 +1073,7 @@ mkdir_if_missing()
1072 1073
 }
1073 1074
 
1074 1075
 
1076
+
1075 1077
 dir_is_empty()
1076 1078
 {
1077 1079
    [ -z "$1" ] && internal_fail "empty path"
... ...
@@ -1206,7 +1208,7 @@ create_symlink()
1206 1208
       url="`symlink_relpath "${url}" "${directory}"`"
1207 1209
    fi
1208 1210
 
1209
-   log_info "Symlinking ${C_MAGENTA}${C_BOLD}${srcname}${C_INFO} as \"${url}\" ..."
1211
+   log_info "Symlinking ${C_MAGENTA}${C_BOLD}${srcname}${C_INFO} as \"${url}\" in \"${directory}\" ..."
1210 1212
    exekutor ln -s -f "${url}" "${stashdir}"  >&2 || fail "failed to setup symlink \"${stashdir}\" (to \"${url}\")"
1211 1213
 }
1212 1214
 
... ...
@@ -61,7 +61,12 @@ gcc_cppflags_value()
61 61
 {
62 62
    local name="$1"
63 63
 
64
-   read_build_setting "${name}" "OTHER_CPPFLAGS"
64
+   local value
65
+   local result
66
+
67
+   result="${CFLAGS}"
68
+   value="`read_build_setting "${name}" "OTHER_CPPFLAGS"`"
69
+   concat "$result" "$value"
65 70
 }
66 71
 
67 72
 
... ...
@@ -73,9 +78,12 @@ gcc_cflags_value()
73 78
    local result
74 79
    local i
75 80
 
76
-   result="`read_build_setting "${name}" "OTHER_CFLAGS"`"
81
+   result="${CFLAGS}"
82
+   value="`read_build_setting "${name}" "OTHER_CFLAGS"`"
83
+   result="`concat "$result" "$value"`"
77 84
    value="`read_build_setting "${name}"  "WARNING_CFLAGS"`"
78 85
    result="`concat "$result" "$value"`"
86
+
79 87
    for i in `read_build_setting "${name}" "GCC_PREPROCESSOR_DEFINITIONS"`
80 88
    do
81 89
       result="`concat "$result" "-D${i}"`"
... ...
@@ -93,7 +101,9 @@ gcc_cxxflags_value()
93 101
    local result
94 102
    local name
95 103
 
96
-   result="`read_build_setting "${name}" "OTHER_CXXFLAGS"`"
104
+   result="${CXXFLAGS}"
105
+   value="`read_build_setting "${name}" "OTHER_CXXFLAGS"`"
106
+   result="`concat "$result" "$value"`"
97 107
    value="`gcc_cflags_value "${name}"`"
98 108
    result="`concat "$result" "$value"`"
99 109
 
... ...
@@ -105,7 +115,12 @@ gcc_ldflags_value()
105 115
 {
106 116
    local name="$1"
107 117
 
108
-   read_build_setting "${name}" "OTHER_LDFLAGS"
118
+   local value
119
+   local result
120
+
121
+   result="${LDFLAGS}"
122
+   value="`read_build_setting "${name}" "OTHER_LDFLAGS"`"
123
+   concat "$result" "$value"
109 124
 }
110 125
 
111 126
 
... ...
@@ -323,6 +323,8 @@ bootstrap_should_defer_to_master()
323 323
 
324 324
    masterpath="`get_master_of_minion_bootstrap_project`"
325 325
 
326
+   assert_sane_master_bootstrap_project "${masterpath}"
327
+
326 328
    case "${command}" in
327 329
       git|setup-xcode|xcode|tag|version|defer|emancipate|uname|library-path)
328 330
          log_verbose "Minion executes locally"
... ...
@@ -508,7 +510,7 @@ dirty_harry()
508 510
 {
509 511
    log_debug ":dirty_harry:"
510 512
 
511
-   [ -f "${REPOS_DIR}/.bootstrap_fetch_started" ]
513
+   [ -f "${REPOS_DIR}/.fetch_started" ]
512 514
 }
513 515
 
514 516
 
... ...
@@ -555,7 +557,7 @@ fetch_needed()
555 557
 
556 558
    local  referencefile
557 559
 
558
-   referencefile="${REPOS_DIR}/.bootstrap_fetch_done"
560
+   referencefile="${REPOS_DIR}/.fetch_done"
559 561
    if [ ! -f "${referencefile}" ]
560 562
    then
561 563
       log_verbose "Need fetch because \"${referencefile}\" does not exist."
... ...
@@ -623,8 +625,8 @@ set_fetch_needed()
623 625
 {
624 626
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
625 627
 
626
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_started"
627
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_fetch_done"
628
+   remove_file_if_present "${REPOS_DIR}/.fetch_started"
629
+   remove_file_if_present "${REPOS_DIR}/.fetch_done"
628 630
 }
629 631
 
630 632
 
... ...
@@ -632,8 +634,8 @@ set_build_needed()
632 634
 {
633 635
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
634 636
 
635
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_build_started"
636
-   remove_file_if_present "${REPOS_DIR}/.bootstrap_build_done"
637
+   remove_file_if_present "${REPOS_DIR}/.build_started"
638
+   remove_file_if_present "${REPOS_DIR}/.build_done"
637 639
 }
638 640
 
639 641
 
... ...
@@ -668,12 +670,14 @@ _expanded_variables()
668 670
    local next
669 671
    local default
670 672
    local tmp
673
+   local rval
671 674
 
675
+   rval=0
672 676
    key="`echo "${string}" | sed -n 's/^\(.*\)\${\([A-Za-z_][A-Za-z0-9_:-]*\)}\(.*\)$/\2/p'`"
673 677
    if [ -z "${key}" ]
674 678
    then
675 679
       echo "${string}"
676
-      return
680
+      return $rval
677 681
    fi
678 682
 
679 683
    prefix="`echo "${string}" | sed 's/^\(.*\)\${\([A-Za-z_][A-Za-z0-9_:-]*\)}\(.*\)$/\1/'`"
... ...
@@ -703,6 +707,7 @@ _expanded_variables()
703 707
       if [ -z "${default}" ]
704 708
       then
705 709
          log_warning "\${${key}} expanded to the empty string."
710
+         rval=1
706 711
       else
707 712
          log_setting "Root setting for ${C_MAGENTA}${key}${C_SETTING} set to default ${C_MAGENTA}${default}${C_SETTING}"
708 713
          value="${default}"
... ...
@@ -716,26 +721,37 @@ _expanded_variables()
716 721
    fi
717 722
 
718 723
    _expanded_variables "${next}" "${altbootstrap}"
724
+   if [ $? -ne 0 ]
725
+   then
726
+      rval=1
727
+   fi
728
+
729
+   return $rval
719 730
 }
720 731
 
721 732
 
722 733
 expanded_variables()
723 734
 {
735
+   local string=$1
724 736
    local value
737
+   local rval
725 738
 
726 739
    value="`_expanded_variables "$@"`"
740
+   rval=$?
727 741
 
728
-   if [ "$1" != "${value}" ]
742
+   echo "$value"
743
+
744
+   if [ "${string}" != "${value}" ] # $1 could not contain any $
729 745
    then
730 746
       if [ -z "${value}" ]
731 747
       then
732
-         log_warning "Expanded \"$1\" to empty string"
748
+         log_warning "Expanded \"${string}\" to empty string"
733 749
       else
734
-         log_fluff "Expanded \"$1\" to \"${value}\""
750
+         log_setting "Expanded \"${string}\" to \"${value}\""
735 751
       fi
736 752
    fi
737 753
 
738
-   echo "$value"
754
+   return $rval
739 755
 }
740 756
 
741 757
 
... ...
@@ -763,6 +779,21 @@ is_minion_bootstrap_project()
763 779
 }
764 780
 
765 781
 
782
+assert_sane_master_bootstrap_project()
783
+{
784
+   local  masterpath="$1"
785
+
786
+   if [ -d "${masterpath}/${BOOTSTRAP_DIR}" ]
787
+   then
788
+      fail "master project at \"${masterpath}\" must not have a \"${BOOTSTRAP_DIR}\" folder"
789
+   fi
790
+
791
+   if ! is_master_bootstrap_project "${masterpath}"
792
+   then
793
+      fail "\"${masterpath}\" is not a master project"
794
+   fi
795
+}
796
+
766 797
 #
767 798
 # read local environment
768 799
 # source this file
... ...
@@ -51,7 +51,13 @@ log_printf()
51 51
 
52 52
 log_error()
53 53
 {
54
-   log_printf "${C_ERROR}%b${C_RESET}\n" "$*"
54
+   log_printf "${C_ERROR}${MULLE_EXECUTABLE_FAIL_PREFIX} error: %b${C_RESET}\n" "$*"
55
+}
56
+
57
+
58
+log_fail()
59
+{
60
+   log_printf "${C_ERROR}${MULLE_EXECUTABLE_FAIL_PREFIX} fatal error: %b${C_RESET}\n" "$*"
55 61
 }
56 62
 
57 63
 
... ...
@@ -59,7 +65,7 @@ log_warning()
59 65
 {
60 66
    if [ "${MULLE_FLAG_LOG_TERSE}" != "YES" ]
61 67
    then
62
-      log_printf "${C_WARNING}%b${C_RESET}\n" "$*"
68
+      log_printf "${C_WARNING}${MULLE_EXECUTABLE_FAIL_PREFIX} warning: %b${C_RESET}\n" "$*"
63 69
    fi
64 70
 }
65 71
 
... ...
@@ -165,11 +171,6 @@ _bail()
165 171
 }
166 172
 
167 173
 
168
-log_fail()
169
-{
170
-   log_error "${MULLE_EXECUTABLE_FAIL_PREFIX} Error: $*"
171
-}
172
-
173 174
 
174 175
 fail()
175 176
 {
... ...
@@ -180,7 +181,7 @@ fail()
180 181
 
181 182
 internal_fail()
182 183
 {
183
-   log_error "${MULLE_EXECUTABLE_FAIL_PREFIX} *** Internal Error: ${C_BR_RED}$*"
184
+   log_printf "${C_ERROR}${MULLE_EXECUTABLE_FAIL_PREFIX} *** internal error ***: %b${C_RESET}\n" "$*"
184 185
    stacktrace
185 186
    _bail
186 187
 }
187 188
new file mode 100755
... ...
@@ -0,0 +1,69 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#   POSSIBILITY OF SUCH DAMAGE.
31
+#
32
+
33
+#
34
+# remove destination directory if it exists
35
+#
36
+main()
37
+{
38
+   local arguments
39
+
40
+   while [ $# -gt 2 ]
41
+   do
42
+      arguments="`concat "${arguments}" "'$1'"`"
43
+      shift
44
+   done
45
+
46
+   local src
47
+   local dst
48
+
49
+   src="$1"
50
+   dst="$2"
51
+
52
+   local name
53
+
54
+   name="`basename -- "${src}"`"
55
+   if [ -d "${dst}/${name}" ]
56
+   then
57
+      exekutor rm -rf "${dst}/${name}"
58
+   fi
59
+
60
+   eval_exekutor "mv -f ${arguments} '${src}' '${dst}'"
61
+
62
+}
63
+
64
+LIBEXEC_PATH="`dirname -- "$0"`"
65
+
66
+. "${LIBEXEC_PATH}/mulle-bootstrap-logging.sh"
67
+. "${LIBEXEC_PATH}/mulle-bootstrap-functions.sh"
68
+
69
+main "$@"
... ...
@@ -267,7 +267,7 @@ _get_all_repos_clones()
267 267
 #
268 268
 # Walkers
269 269
 #
270
-# Possible permissions: "symlink\nmissing"
270
+# Possible permissions: "symlink\nmission\nmissing"
271 271
 #
272 272
 walk_check()
273 273
 {
... ...
@@ -276,16 +276,6 @@ walk_check()
276 276
 
277 277
    local match
278 278
 
279
-   if is_minion_bootstrap_project "${stashdir}"
280
-   then
281
-      match="`echo "${permissions}" | fgrep -s -x "minion"`"
282
-      if [ -z "${match}" ]
283
-      then
284
-         log_verbose "\"${stashdir}\" is a minion, skipped"
285
-         return 1
286
-      fi
287
-   fi
288
-
289 279
    if [ -L "${stashdir}" ]
290 280
    then
291 281
       # this not being in permissions makes things easier
... ...
@@ -311,6 +301,16 @@ walk_check()
311 301
       fi
312 302
    fi
313 303
 
304
+   if is_minion_bootstrap_project "${stashdir}"
305
+   then
306
+      match="`echo "${permissions}" | fgrep -s -x "minion"`"
307
+      if [ -z "${match}" ]
308
+      then
309
+         log_verbose "\"${stashdir}\" is a minion, skipped"
310
+         return 1
311
+      fi
312
+   fi
313
+
314 314
    return 0
315 315
 }
316 316
 
... ...
@@ -848,7 +848,7 @@ process_raw_clone()
848 848
 #   local tag
849 849
 #   local stashdir
850 850
 #
851
-# expansion is now done during already during .auto creation
851
+# expansion is now done during .auto creation
852 852
 # clone="`expanded_variables "${1}"`"
853 853
 #
854 854
 parse_clone()
... ...
@@ -924,8 +924,10 @@ read_repository_file()
924 924
 
925 925
    local srcbootstrap
926 926
    local clones
927
+   local empty_expansion_is_error
927 928
 
928 929
    srcbootstrap="`dirname -- "${srcfile}"`"
930
+
929 931
    clones="`read_expanded_setting "$srcfile" "" "${srcbootstrap}"`"
930 932
 
931 933
    local url        # url of clone
... ...
@@ -167,7 +167,7 @@ git_checkout()
167 167
       (
168 168
          exekutor cd "${stashdir}" ;
169 169
          exekutor git ${GITFLAGS} checkout ${options} "${tag}"  >&2
170
-      ) || exit 1
170
+      ) || return 1
171 171
 
172 172
       if [ $? -ne 0 ]
173 173
       then
... ...
@@ -176,7 +176,7 @@ git_checkout()
176 176
 
177 177
          rmdir_safer "${stashdir}.failed"
178 178
          exekutor mv "${stashdir}" "${stashdir}.failed"  >&2
179
-         exit 1
179
+         return 1
180 180
       fi
181 181
    else
182 182
       log_fluff "Already on proper branch \"${branch}\""
... ...
@@ -51,7 +51,7 @@ run_script()
51 51
          env | sed 's/^\(.\)/   \1/' >&2
52 52
          echo "}" >&2
53 53
       fi
54
-      exekutor "${script}" "$@" >&2 || fail "script \"${script}\" did not run successfully"
54
+      exekutor "${script}" "$@" >&2 || return 1
55 55
    else
56 56
       if [ ! -e "${script}" ]
57 57
       then
... ...
@@ -36,7 +36,7 @@ config_usage()
36 36
 {
37 37
     cat <<EOF >&2
38 38
 usage:
39
-   mulle-bootstrap config [options] [key] [value]
39
+   mulle-bootstrap config [options] [key][=][value]
40 40
 
41 41
    Options:
42 42
       -d   : delete config setting
... ...
@@ -55,11 +55,12 @@ expansion_usage()
55 55
 {
56 56
     cat <<EOF >&2
57 57
 usage:
58
-   mulle-bootstrap expansion [options] <key> [value]
58
+   mulle-bootstrap expansion [options] [key][=][value]
59 59
 
60 60
    Options:
61 61
       -d   : delete setting
62 62
       -g   : use global .bootstrap folder instead of local
63
+      -l   : list expansion values
63 64
 
64 65
    Use:
65 66
       mulle-bootstrap expansion <key> to read
... ...
@@ -73,7 +74,7 @@ setting_usage()
73 74
 {
74 75
     cat <<EOF >&2
75 76
 usage:
76
-   mulle-bootstrap setting [options] <key> [value]
77
+   mulle-bootstrap setting [options] [key][=][value]
77 78
 
78 79
    Options:
79 80
       -a   : append value to setting
... ...
@@ -136,6 +137,7 @@ output_clean_folders
136 137
 override_branch
137 138
 stashes_dir
138 139
 symlinks
140
+use_cc_cxx
139 141
 warn_environment_setting
140 142
 warn_user_setting
141 143
 xcodebuild
... ...
@@ -455,7 +457,7 @@ _read_home_setting()
455 457
       return 2
456 458
    fi
457 459
 
458
-   warn_user_setting "${HOME}/.mulle-bootstrap/${key}"
460
+   # warn_user_setting "${HOME}/.mulle-bootstrap/${key}"
459 461
 
460 462
    echo "$value"
461 463
 }
... ...
@@ -464,6 +466,7 @@ _read_home_setting()
464 466
 list_dir_settings()
465 467
 {
466 468
    local directory="$1"
469
+   local sedpattern="$2"
467 470
 
468 471
    local filename
469 472
    local key
... ...
@@ -471,7 +474,7 @@ list_dir_settings()
471 474
 
472 475
    IFS="
473 476
 "
474
-   for filename in `ls -1 "${directory}" 2> /dev/null`
477
+   for filename in `ls -1 "${directory}" 2> /dev/null | sed -n "/${sedpattern}/p" `
475 478
    do
476 479
       IFS="${DEFAULT_IFS}"
477 480
 
... ...
@@ -479,7 +482,7 @@ list_dir_settings()
479 482
       value="`_read_setting "${directory}/${key}"`"
480 483
       if [ ! -z "${value}" ]
481 484
       then
482
-         echo "${key}=\"${value}\""
485
+         echo "${key} '${value}'"
483 486
       fi
484 487
    done
485 488
 
... ...
@@ -487,15 +490,17 @@ list_dir_settings()
487 490
 }
488 491
 
489 492
 
490
-list_local_settings()
493
+CONFIG_KEY_REGEXP='^[a-z_][a-z_0-9]*$'
494
+
495
+list_local_config_settings()
491 496
 {
492
-   list_dir_settings "${BOOTSTRAP_DIR}.local/config"
497
+   list_dir_settings "${BOOTSTRAP_DIR}.local/config" "${CONFIG_KEY_REGEXP}"
493 498
 }
494 499
 
495 500
 
496
-list_home_settings()
501
+list_home_config_settings()
497 502
 {
498
-   list_dir_settings "${HOME}/.mulle-bootstrap"
503
+   list_dir_settings "${HOME}/.mulle-bootstrap" "${CONFIG_KEY_REGEXP}"
499 504
 }
500 505
 
501 506
 
... ...
@@ -660,8 +665,6 @@ find_build_setting_file()
660 665
 }
661 666
 
662 667
 
663
-
664
-
665 668
 ####
666 669
 # Functions building on read_ functions
667 670
 #
... ...
@@ -715,6 +718,7 @@ read_expanded_setting()
715 718
    [ $# -eq 3 ]             || internal_fail "wrong parameters"
716 719
 
717 720
    local value
721
+   local rval
718 722
 
719 723
    value="`(
720 724
       MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES"
... ...
@@ -727,13 +731,30 @@ read_expanded_setting()
727 731
       value="${default}"
728 732
    fi
729 733
 
734
+   rval=0
735
+
730 736
    IFS="
731 737
 "
732 738
    echo "${value}" | while read line
733 739
    do
734 740
       IFS="${DEFAULT_IFS}"
741
+
735 742
       expanded_variables "${line}" "${srcbootstrap}"
743
+      if [ $? -ne 0 ]
744
+      then
745
+         empty_expansion_is_error="`read_config_setting "empty_expansion_is_error" "YES"`"
746
+         if [ "${empty_expansion_is_error}" = "YES" ]
747
+         then
748
+           fail "Aborting, because empty expansion warning is an error condition.
749
+To disable this:
750
+   ${C_RESET_BOLD}mulle-bootstrap config -n empty_expansion_is_error"
751
+         fi
752
+      fi
736 753
    done
754
+
755
+   IFS="${DEFAULT_IFS}"
756