Browse code

More general improvements and bugfixes, really too much for a simple commit message.

Nat! authored on 30-01-2017 15:29:46 • Nat! committed on 02-02-2017 11:49:13
Showing 63 changed files
... ...
@@ -7,34 +7,23 @@ build/
7 7
 .repos/
8 8
 .bootstrap.auto/
9 9
 .bootstrap.local/
10
+.bootstrap.repos/
10 11
 dependencies/
11 12
 addictions/
12 13
 mulle-bootstrap.sublime-workspace
13 14
 relpath-python.sh
14 15
 relpath.sh
15 16
 
16
-tests/refresh-embedded/a/
17
-tests/refresh-embedded/b/
18
-tests/refresh-embedded/c/
19
-tests/refresh-embedded/d/
20
-tests/dependency/a/.bootstrap
21
-tests/dependency/b/.bootstrap
22
-tests/refresh-embedded/.bootstrap
23
-tests/refresh/a/
24
-tests/refresh/b/
25
-tests/refresh/c/
26
-tests/refresh/d/
27
-tests/refresh/e/
28
-tests/refresh/f/
29
-tests/refresh/g/
30
-tests/refresh/h/
31
-tests/refresh/main/.bootstrap
32
-tests/refresh/main/e/
33
-tests/refresh/main/g/
34
-tutorial/a/.bootstrap
35
-tutorial/b/.bootstrap
36
-tutorial/c/.bootstrap
17
+tutorial/*/.bootstrap
18
+
19
+tests/*/.bootstrap
20
+tests/*/main/
21
+tests/*/a/
22
+tests/*/b/
23
+tests/*/c/
24
+tests/*/d/
25
+tests/*/e/
26
+tests/*/f/
27
+tests/*/g/
28
+tests/*/h/
37 29
 mulle-mingw-cpp.exe
38
-tests/embedded-symlink/a/
39
-tests/embedded-symlink/b/
40
-tests/embedded-symlink/c/
41 30
\ No newline at end of file
... ...
@@ -1,43 +1,45 @@
1 1
 SCRIPTS=install.sh \
2
-src/mulle-bootstrap-array.sh \
3
-src/mulle-bootstrap-auto-update.sh \
4
-src/mulle-bootstrap-brew.sh \
5
-src/mulle-bootstrap-build.sh \
6
-src/mulle-bootstrap-build-environment.sh \
7
-src/mulle-bootstrap-clean.sh \
8
-src/mulle-bootstrap-dependency-resolve.sh \
9
-src/mulle-bootstrap-fetch.sh \
10
-src/mulle-bootstrap-functions.sh \
11
-src/mulle-bootstrap-gcc.sh \
12
-src/mulle-bootstrap-init.sh \
13
-src/mulle-bootstrap-install.sh \
14
-src/mulle-bootstrap-local-environment.sh \
15
-src/mulle-bootstrap-logging.sh \
16
-src/mulle-bootstrap-mingw.sh \
17
-src/mulle-bootstrap-refresh.sh \
18
-src/mulle-bootstrap-scm.sh \
19
-src/mulle-bootstrap-scripts.sh \
20
-src/mulle-bootstrap-settings.sh \
21
-src/mulle-bootstrap-tag.sh \
22
-src/mulle-bootstrap-warn-scripts.sh \
23
-src/mulle-bootstrap-xcode.sh
2
+	src/mulle-bootstrap-array.sh \
3
+	src/mulle-bootstrap-auto-update.sh \
4
+	src/mulle-bootstrap-brew.sh \
5
+	src/mulle-bootstrap-build.sh \
6
+	src/mulle-bootstrap-clean.sh \
7
+	src/mulle-bootstrap-common-settings.sh \
8
+	src/mulle-bootstrap-copy.sh \
9
+	src/mulle-bootstrap-dependency-resolve.sh \
10
+	src/mulle-bootstrap-fetch.sh \
11
+	src/mulle-bootstrap-functions.sh \
12
+	src/mulle-bootstrap-gcc.sh \
13
+	src/mulle-bootstrap-init.sh \
14
+	src/mulle-bootstrap-install.sh \
15
+	src/mulle-bootstrap-local-environment.sh \
16
+	src/mulle-bootstrap-logging.sh \
17
+	src/mulle-bootstrap-mingw.sh \
18
+	src/mulle-bootstrap-repositories.sh \
19
+	src/mulle-bootstrap-scm.sh \
20
+	src/mulle-bootstrap-scripts.sh \
21
+	src/mulle-bootstrap-settings.sh \
22
+	src/mulle-bootstrap-tag.sh \
23
+	src/mulle-bootstrap-warn-scripts.sh \
24
+	src/mulle-bootstrap-xcode.sh \
25
+	src/mulle-bootstrap-zombify.sh
24 26
 
25 27
 CHECKSTAMPS=$(SCRIPTS:.sh=.chk)
26
-SHELLFLAGS=-x -e SC2164,SC2166,SC2006 -s sh
28
+SHELLFLAGS=-x -e SC2164,SC2166,SC2006,SC1091,SC2039,SC2181,SC2059 -s sh
27 29
 
28 30
 .PHONY: all
29 31
 .PHONY: clean
30 32
 .PHONY: shellcheck_check
31 33
 
32 34
 %.chk:	%.sh
33
-		- shellcheck $(SHELLFLAGS) $<
34
-		(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep -w error > /dev/null ) && exit 1 || touch $@
35
+	- shellcheck $(SHELLFLAGS) $<
36
+	(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep -w error > /dev/null ) && exit 1 || touch $@
35 37
 
36 38
 all:	$(CHECKSTAMPS) mulle-bootstrap.chk shellcheck_check jq_check
37 39
 
38 40
 mulle-bootstrap.chk:	mulle-bootstrap
39
-		- shellcheck $(SHELLFLAGS) $<
40
-		(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep -w error > /dev/null ) && exit 1 || touch $@
41
+	- shellcheck $(SHELLFLAGS) $<
42
+	(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep -w error > /dev/null ) && exit 1 || touch $@
41 43
 
42 44
 install:
43 45
 	@ ./install.sh
... ...
@@ -49,4 +51,4 @@ shellcheck_check:
49 51
 	which shellcheck || brew install shellcheck
50 52
 
51 53
 jq_check:
52
-		which shellcheck || brew install shellcheck
54
+	which shellcheck || brew install shellcheck
... ...
@@ -1,5 +1,19 @@
1 1
 # 3.0
2 2
 
3
+#### mulle-bootstrap command syntax was related to git, but now it's related
4
+to homebrew and apt-get. This has been done, because I wan't to have mulle-brew
5
+as a separate shell command, and the git syntax doesn't fit.
6
+
7
+That means, mulle-bootstrap fetch is now just a deprecated synonym for
8
+mulle-bootstrap install
9
+
10
+mulle-bootstrap update is now mulle-bootstrap upgrade.
11
+
12
+mulle-bootstrap install is now mulle-bootstrap systeminstall
13
+
14
+
15
+#### The way settings work as drastically changed too much to list here
16
+
3 17
 * config now returns the default value, if nothing is configured
4 18
 * various changes in variables
5 19
 
... ...
@@ -16,7 +30,8 @@ REPOS_DIR         | CLONES_SUBDIR       |
16 30
 patch anymore. It's also convenient for the test scripts
17 31
 * various status files are now prefixed with .bootstrap_
18 32
 * **tag** as a setting does not exist anymore. Now its part of the repositories line
19
-* renamed -u fetch option to -us and exposed it on refresh too
33
+* A lot of options have changed. Sorry about this, but progres...
34
+
20 35
 
21 36
 ### 2.6.1
22 37
 
... ...
@@ -12,8 +12,6 @@ VERSION="${1:-`./mulle-bootstrap version`}"
12 12
 ARCHIVEURL="${1:-http://www.mulle-kybernetik.com/software/git/${TARGET}/tarball/$VERSION}"
13 13
 [ $# -eq 0 ] || shift
14 14
 
15
-set -e
16
-
17 15
 [ "$VERSION" = "" ] && exit 1
18 16
 [ "$ARCHIVEURL" = "" ] && exit 1
19 17
 
... ...
@@ -7,4 +7,8 @@ then
7 7
   exit 1
8 8
 fi
9 9
 
10
-egrep -h '[^_]read_[a-z0-9_]*setting \"' "$@" | sed 's/^[^`]*`\(.*\)$/\1/' | sed 's/^[ \t]*\(.*\)/\1/' | sort | sort -u
11 10
\ No newline at end of file
11
+egrep -h '[^_]read_[a-z0-9_]*setting \"' "$@" | \
12
+   sed 's/^[^`]*`\(.*\)$/\1/' | \
13
+   sed 's/^[ \t]*\(.*\)/\1/'  | \
14
+   sort | \
15
+   sort -u
12 16
\ No newline at end of file
... ...
@@ -26,8 +26,6 @@ git_must_be_clean()
26 26
 }
27 27
 
28 28
 
29
-set -e
30
-
31 29
 git_must_be_clean
32 30
 
33 31
 branch="`git rev-parse --abbrev-ref HEAD`"
34 32
new file mode 100644
... ...
@@ -0,0 +1,30 @@
1
+digraph reposdir {
2
+   node [ shape="folder"]
3
+
4
+   ".bootstrap.auto"           -> ".bootstrap.auto/repositories"
5
+
6
+   ".bootstrap.auto/repositories"  [ shape="none", label=< <TABLE BORDER="1" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0">
7
+<TR><TD bgcolor="#DDDDDD">repositories</TD></TR>
8
+<TR><TD>https://github.com/mulle-nat/Noobie</TD></TR>
9
+</TABLE>>];
10
+
11
+   ".bootstrap.repos"           -> ".bootstrap.repos/.embedded"
12
+   ".bootstrap.repos"           -> ".bootstrap.repos/.zombies"
13
+   ".bootstrap.repos/.embedded" -> ".bootstrap.repos/.embedded/.zombies"
14
+   ".bootstrap.repos"           -> ".bootstrap.repos/.graveyard"
15
+   ".bootstrap.repos/.embedded" -> ".bootstrap.repos/.embedded/.graveyard"
16
+
17
+   ".bootstrap.repos/.embedded"             [ label=".embedded" ]
18
+   ".bootstrap.repos/.zombies"              [ label=".zombies" ]
19
+   ".bootstrap.repos/.graveyard"            [ label=".graveyard" ]
20
+   ".bootstrap.repos/.embedded/.zombies"    [ label=".zombies" ]
21
+   ".bootstrap.repos/.embedded/.graveyard"  [ label=".graveyard" ]
22
+
23
+
24
+   ".bootstrap.repos" -> "Noobie"
25
+   "Noobie"  [ shape="none", label=< <TABLE BGCOLOR="#0000FF" BORDER="0" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0">
26
+<TR><TD><FONT COLOR="#FFFFFF">Noobie</FONT></TD></TR>
27
+<TR><TD bgcolor="#FFFFFF" PORT="f0">../stashes/Noobie</TD></TR>
28
+<TR><TD bgcolor="#FFFFFF">https://github.com/mulle-nat/Noobie</TD></TR>
29
+</TABLE>>];
30
+}
0 31
\ No newline at end of file
1 32
new file mode 100644
... ...
@@ -0,0 +1,48 @@
1
+digraph refresh {
2
+   compound=true
3
+   node [shape="none"]
4
+
5
+   "fetch"  [ fillcolor="red", style="filled", fontcolor="white"]
6
+   "update" [ fillcolor="blue", style="filled", fontcolor="white"]
7
+
8
+   node [shape="record"]
9
+
10
+   fetch  -> "mark_all_repositories_as_zombies" [ lhead=cluster_0]
11
+   update -> "update_embedded_repositories"     [ lhead=cluster_1]
12
+   "run_update_scripts"            -> "fetch" [ lhead=cluster_0]
13
+
14
+
15
+   subgraph cluster_0 {
16
+      node [shape="record"]
17
+      color="red"
18
+
19
+      "bootstrap_auto_update"
20
+      "inviso" [ style="invisible"]
21
+      "mark_all_repositories_as_zombies"    -> "bootstrap_auto_create"
22
+
23
+      "bootstrap_auto_create"               -> "fetch_missing_embedded_repositories"
24
+
25
+      "fetch_missing_embedded_repositories" -> "fetch_missing_repositories" [color="red"]
26
+      "fetch_missing_repositories"          -> "bootstrap_auto_update" [color="red"]
27
+      "bootstrap_auto_update"               -> "fetch_missing_repositories"   [color="red"]
28
+
29
+      "bootstrap_auto_update"               -> "fetch_missing_deep_embedded_repositories" [color="red"]
30
+      "fetch_missing_deep_embedded_repositories" -> "bootstrap_auto_final"
31
+      "bootstrap_auto_final"                -> "unmark_alive_stashes"
32
+
33
+      "unmark_alive_stashes"                -> "bury_zombies_in_graveyard"
34
+      "bury_zombies_in_graveyard"           -> "run_fetch_scripts"
35
+
36
+      "fetch_missing_embedded_repositories"        [ fontcolor="red"]
37
+      "fetch_missing_repositories"                 [ fontcolor="red"]
38
+      "fetch_missing_deep_embedded_repositories"   [ fontcolor="red"]
39
+   }
40
+   subgraph cluster_1 {
41
+      node [shape="record"]
42
+      color="blue"
43
+
44
+      "update_embedded_repositories"  -> "update_repositories"
45
+      "update_repositories"           -> "update_deep_embedded_repositories"
46
+      "update_deep_embedded_repositories"  -> "run_update_scripts"
47
+   }
48
+}
0 49
\ No newline at end of file
1 50
similarity index 100%
2 51
rename from dox/SETTINGS.md
3 52
rename to dox/settings/SETTING_KEYS.md
... ...
@@ -10,7 +10,7 @@ digraph pic {
10 10
 <TR><TD PORT="f0">b</TD></TR>
11 11
 </TABLE>>];
12 12
 		"a.bootstrap" -> "a.b"
13
-		"a.b"                  [ label="b.info" ]
13
+		"a.b"                  [ label="b.build" ]
14 14
 		"a.b"         -> "a.build_preferences"
15 15
 		"a.build_preferences"  [ label="build_preferences", shape="note" ]
16 16
 	}
... ...
@@ -24,7 +24,7 @@ digraph pic {
24 24
 <TR><TD PORT="f0">c</TD></TR>
25 25
 </TABLE>>];
26 26
 		"b.bootstrap" -> "b.c"
27
-		"b.c"                  [ label="c.info" ]
27
+		"b.c"                  [ label="c.build" ]
28 28
 		"b.c"         -> "b.build_preferences"
29 29
 		"b.build_preferences"  [ label="build_preferences", shape="note" ]
30 30
 	}
... ...
@@ -10,7 +10,7 @@ digraph pic {
10 10
 <TR><TD PORT="f0">b</TD></TR>
11 11
 </TABLE>>];
12 12
 		"a.bootstrap" -> "a.b"
13
-		"a.b"                  [ label="b.info" ]
13
+		"a.b"                  [ label="b.build" ]
14 14
 		"a.b"         -> "a.build_preferences"
15 15
 		"a.build_preferences"  [ label="build_preferences", shape="note" ]
16 16
 	}
... ...
@@ -24,7 +24,7 @@ digraph pic {
24 24
 <TR><TD PORT="f0">c</TD></TR>
25 25
 </TABLE>>];
26 26
 		"b.bootstrap" -> "b.c"
27
-		"b.c"                  [ label="c.info" ]
27
+		"b.c"                  [ label="c.build" ]
28 28
 		"b.c"         -> "b.build_preferences"
29 29
 		"b.build_preferences"  [ label="build_preferences", shape="note" ]
30 30
 	}
... ...
@@ -33,7 +33,7 @@ digraph pic {
33 33
 		"c" -> "c.bootstrap"
34 34
 		"c.bootstrap" [ label=".bootstrap" ]
35 35
 		"c.bootstrap" -> "c.c"
36
-		"c.c"                  [ label="c.info" ]
36
+		"c.c"                  [ label="c.build" ]
37 37
 		"c.c"         -> "c.build_preferences"
38 38
 		"c.build_preferences"  [ label="build_preferences", shape="note" ]
39 39
 	}
... ...
@@ -68,7 +68,10 @@ resolve_symlinks()
68 68
 
69 69
 _canonicalize_dir_path()
70 70
 {
71
-    (cd "$1" 2>/dev/null && pwd -P)
71
+   (
72
+      cd "$1" 2>/dev/null &&
73
+      pwd -P
74
+   ) || exit 1
72 75
 }
73 76
 
74 77
 
... ...
@@ -78,7 +81,10 @@ _canonicalize_file_path()
78 81
 
79 82
     dir="` dirname "$1"`"
80 83
     file="`basename -- "$1"`"
81
-    (cd "${dir}" 2>/dev/null && echo "`pwd -P`/${file}")
84
+    (
85
+      cd "${dir}" 2>/dev/null &&
86
+      echo "`pwd -P`/${file}"
87
+    ) || exit 1
82 88
 }
83 89
 
84 90
 
... ...
@@ -109,7 +115,7 @@ get_windows_path()
109 115
       return 1
110 116
    fi
111 117
 
112
-   ( cd "$directory" ; pwd -PW )
118
+   ( cd "$directory" ; pwd -PW ) || fail "failed to get pwd"
113 119
    return 0
114 120
 }
115 121
 
... ...
@@ -144,7 +150,7 @@ mode=${1:-755}
144 150
 [ $# -eq 0 ] || shift
145 151
 
146 152
 bin="${prefix}/bin"
147
-libexec="${prefix}/libexec/mulle-bootstrap"
153
+libexec="${prefix}/libexec/mulle-bootstrap-3"
148 154
 
149 155
 if [ "$prefix" = "" ] || [ "$bin" = "" ] || [ "$libexec" = "" ] || [ "$mode" = "" ]
150 156
 then
... ...
@@ -162,7 +168,7 @@ then
162 168
 fi
163 169
 
164 170
 
165
-for i in mulle*bootstrap
171
+for i in mulle*bootstrap-3
166 172
 do
167 173
    install -m "${mode}" "${i}" "${bin}/$i" || exit 1
168 174
    printf "install: ${C_MAGENTA}${C_BOLD}%s${C_RESET}\n" "$bin/$i" >&2
... ...
@@ -66,10 +66,10 @@ EOF
66 66
    -ig       : ignore .repos/.graveyard
67 67
    -te       : trace execution
68 68
    -tm       : trace merge and dependencies
69
-   -ts       : trace scripts
70
-   -tit      : don't trace settings
71
-   -tip      : don't trace path functionality
72
-   -t        : trace executrion
69
+   -tss      : also trace scripts
70
+   -tst      : also trace settings
71
+   -tsp      : also trace path functionality
72
+   -t        : trace execution
73 73
    -vv       : very verbose
74 74
    -vvv      : extremely vebose
75 75
    -s        : be silent
... ...
@@ -80,16 +80,17 @@ EOF
80 80
    cat <<EOF
81 81
 
82 82
  Commands:
83
-   bootstrap : does fetch and build recursively [default]
84
-   build     : builds fetched repositories
85
-   clean     : cleans mulle-bootstrap produced files.
86
-   fetch     : fetches required repositories recursively. Use it after updating
87
-               the repositories and embedded_repositories files.
88
-   init      : initializes a bootstrap project
89
-   install   : install dependencies as system headers
90
-   git       : run git commands on fetched repositories
91
-   tag       : tag fetched repositories
92
-   update    : updates repositories (pull).
83
+   bootstrap     : does install and build recursively [default]
84
+   build         : builds fetched repositories
85
+   clean         : cleans mulle-bootstrap produced files.
86
+   install       : fetches required repositories recursively. Use it after
87
+                   updating the repositories and embedded_repositories files.
88
+   init          : initializes a bootstrap project
89
+   systeminstall : install dependencies as system headers
90
+   git           : run git commands on fetched repositories
91
+   tag           : tag fetched repositories
92
+   update        : updates repositories (fetch).
93
+   upgrade       : updates and checks out repositories (pull).
93 94
 
94 95
  Options are command specific. Use mulle-bootstrap <command> -h for help.
95 96
 EOF
... ...
@@ -109,10 +110,6 @@ EOF
109 110
 
110 111
 ensure_consistency()
111 112
 {
112
-   local owd
113
-
114
-   owd="`pwd -P`"
115
-
116 113
    if [ -f "${REPOS_DIR}/.bootstrap_fetch_started" ]
117 114
    then
118 115
       log_error "A previous fetch or update was incomplete.
... ...
@@ -182,8 +179,6 @@ bootstrap_nomagic_main()
182 179
    . mulle-bootstrap-build.sh
183 180
    . mulle-bootstrap-warn-scripts.sh
184 181
 
185
-   [ -z "${MULLE_BOOTSTRAP_REFRESH_SH}" ] && . mulle-bootstrap-refresh.sh
186
-
187 182
    # used for option handling only
188 183
    MULLE_BOOTSTRAP_WILL_BUILD="YES"
189 184
 
... ...
@@ -238,9 +233,9 @@ bootstrap_libexec_path()
238 233
    local libexecpath
239 234
 
240 235
    exedir="`dirname "$1"`"
241
-   exedirpath="`( cd "${exedir}" ; pwd -P )`"
236
+   exedirpath="`( cd "${exedir}" ; pwd -P )`" || fail "failed to get pwd"
242 237
    prefix="`dirname "${exedirpath}"`"
243
-   libexecpath="${prefix}/libexec/mulle-bootstrap"
238
+   libexecpath="${prefix}/libexec/mulle-bootstrap-3"
244 239
 
245 240
    if [ ! -x "${libexecpath}/mulle-bootstrap-functions.sh" ]
246 241
    then
... ...
@@ -282,7 +277,7 @@ bootstrap_main()
282 277
    #
283 278
    case "${1}" in
284 279
       library-path)
285
-         echo "$libexecpath}"
280
+         echo "${libexecpath}"
286 281
          exit 0
287 282
       ;;
288 283
 
... ...
@@ -292,9 +287,13 @@ bootstrap_main()
292 287
       ;;
293 288
    esac
294 289
 
290
+   MULLE_BOOTSTRAP_ARGUMENTS="$@"
295 291
    MULLE_BOOTSTRAP_PID="$$"
296 292
    export MULLE_BOOTSTRAP_PID
297 293
 
294
+   #  set -e # more pain then gain in the end
295
+   #  set -u # doesn't work with my style
296
+
298 297
    # now include this first to get
299 298
    # logging and UNAME
300 299
 
... ...
@@ -304,7 +303,6 @@ bootstrap_main()
304 303
    trap trap_fail INT
305 304
 
306 305
    source_environment
307
-
308 306
    #
309 307
    # simple option handling
310 308
    #
... ...
@@ -340,25 +338,38 @@ bootstrap_main()
340 338
          ;;
341 339
 
342 340
          -tm|--trace-settings-merge)
341
+            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
343 342
             MULLE_BOOTSTRAP_TRACE_MERGE="YES"
344 343
          ;;
345 344
 
346
-         -ts|--trace-scripts)
345
+         -tsc|--trace-show-scripts)
346
+            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
347 347
             MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="YES"
348 348
          ;;
349 349
 
350
-         -tit|--trace-ignores-settings)
351
-            MULLE_BOOTSTRAP_SETTINGS_FLIP_X="YES"
350
+         -tsr|--trace-show-resolver)
351
+            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
352
+            MULLE_BOOTSTRAP_RESOLVER_FLIP_X="NO"
352 353
          ;;
353 354
 
354
-         -tip|--trace-ignores-paths)
355
-            MULLE_BOOTSTRAP_PATHS_FLIP_X="YES"
355
+         -tss|--trace-show-settings)
356
+            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
357
+            MULLE_BOOTSTRAP_SETTINGS_FLIP_X="NO"
358
+         ;;
359
+
360
+         -tsp|--trace-show-paths)
361
+            [ "${MULLE_BOOTSTRAP_TRACE}" = "1848" ] || fail "option \"$1\" must be specified after -t"
362
+            MULLE_BOOTSTRAP_PATHS_FLIP_X="NO"
356 363
          ;;
357 364
 
358 365
          -t|--trace)
359 366
             MULLE_BOOTSTRAP_TRACE="1848"
360 367
             COPYMOVEFLAGS="-v"
361 368
             GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
369
+            MULLE_BOOTSTRAP_PATHS_FLIP_X="YES"
370
+            MULLE_BOOTSTRAP_RESOLVER_FLIP_X="YES"
371
+            MULLE_BOOTSTRAP_SETTINGS_FLIP_X="YES"
372
+            MULLE_BOOTSTRAP_TRACE_SCRIPT_CALLS="NO"
362 373
          ;;
363 374
 
364 375
          -v|--verbose)
... ...
@@ -441,13 +452,17 @@ bootstrap_main()
441 452
             MULLE_BOOTSTRAP_VERBOSE_BUILD="NO"
442 453
          fi
443 454
          log_trace "FULL trace started"
455
+         log_trace "ARGS:${C_TRACE2} ${MULLE_BOOTSTRAP_ARGUMENTS}"
456
+         log_trace "PWD :${C_TRACE2} `pwd -P`"
457
+         log_trace "ENV :${C_TRACE2} `env | sort`"
458
+         log_trace "LS  :${C_TRACE2} `ls -a1F`"
444 459
       ;;
445 460
 
446 461
       1848)
447
-         MULLE_BOOTSTRAP_TRACE_SETTINGS="NO"
462
+         MULLE_BOOTSTRAP_TRACE_SETTINGS="YES"
448 463
          MULLE_EXECUTOR_TRACE="NO"
449
-         MULLE_BOOTSTRAP_FLUFF="NO"
450
-         MULLE_BOOTSTRAP_VERBOSE="NO"
464
+         MULLE_BOOTSTRAP_FLUFF="YES"
465
+         MULLE_BOOTSTRAP_VERBOSE="YES"
451 466
          if [ -z "${MULLE_BOOTSTRAP_VERBOSE_BUILD}" ]
452 467
          then
453 468
             MULLE_BOOTSTRAP_VERBOSE_BUILD="YES"
... ...
@@ -466,7 +481,6 @@ bootstrap_main()
466 481
 
467 482
    local_environment_main
468 483
 
469
-
470 484
    #
471 485
    # some commands only run when we have a .bootstrap folder
472 486
    #
... ...
@@ -475,88 +489,66 @@ bootstrap_main()
475 489
 
476 490
    if [ ! -d "${BOOTSTRAP_DIR}" ]
477 491
    then
478
-      case "${command}" in
479
-         bootstrap|nomagic|build|refresh|dist|clean|dist-clean|fetch|update|setup-xcode|xcode|tag)
480
-            fail "There is no ${BOOTSTRAP_DIR} folder here, can't continue"
481
-      esac
482
-   fi
483
-
484
-   #
485
-   # if we have a.bootstrap.local/minion file then
486
-   # some commands can't run, and some commands are re-executed in master
487
-   # and some commands (like fetch and clean) are executed locally AND in the
488
-   # master
489
-   #
490
-   local masterpath
491
-
492
-   masterpath="${BOOTSTRAP_DIR}.local/master"
493
-   if [ -e "${masterpath}" ]
494
-   then
495
-      case "${command}" in
496
-         build)
497
-            log_info "Minion .bootstrap: defer to master for execution"
498
-            exec bootstrap_execute_in_master "${masterpath}" "$@"
499
-         ;;
500
-
501
-         fetch|update|refresh|clean|dist-clean)
502
-            log_info "Minion .bootstrap: execute parly in master"
503
-            bootstrap_execute_in_master "${masterpath}" "$@"
504
-            EMBEDDED_ONLY=YES
505
-         ;;
506
-
507
-         git|setup-xcode|xcode|tag|version)
508
-            log_verbose "Minion .bootstrap: execute locally"
492
+      case "$1" in
493
+         -h|--help)
509 494
          ;;
510 495
 
511 496
          *)
512
-            fail "This is a minion bootstrap project (${minionpath}), can't continue"
497
+            case "${command}" in
498
+            bootstrap|nomagic|build|dist|clean|dist-clean|fetch|install|syteminstall|upgrade|update|setup-xcode|xcode|tag)
499
+               fail "There is no ${BOOTSTRAP_DIR} folder here, can't continue"
500
+            esac
513 501
          ;;
514 502
       esac
515
-   fi
503
+   else
504
+      #
505
+      # if we have a.bootstrap.local/minion file then
506
+      # some commands can't run, and some commands are re-executed in master
507
+      # and some commands (like fetch and clean) are executed locally AND in the
508
+      # master
509
+      #
510
+      local masterpath
511
+
512
+      masterpath="${BOOTSTRAP_DIR}.local/master"
513
+      if [ -e "${masterpath}" ]
514
+      then
515
+         case "${command}" in
516
+            build)
517
+               log_info "Minion .bootstrap: defer to master for execution"
518
+               exec bootstrap_execute_in_master "${masterpath}" "$@"
519
+            ;;
520
+
521
+            fetch|install|upgrade|update|clean|dist-clean)
522
+               log_info "Minion .bootstrap: execute partly in master"
523
+               bootstrap_execute_in_master "${masterpath}" "$@"
524
+               EMBEDDED_ONLY=YES
525
+            ;;
526
+
527
+            git|setup-xcode|xcode|tag|version)
528
+               log_verbose "Minion .bootstrap: execute locally"
529
+            ;;
530
+
531
+            *)
532
+               fail "This is a minion bootstrap project (${masterpath}), can't continue"
533
+            ;;
534
+         esac
535
+      fi
516 536
 
517
-   if [ "${MULLE_BOOTSTRAP_DIRTY_HARRY}" != "NO" ]
518
-   then
519
-      case "${command}" in
520
-         clean|dist-clean|init)
521
-            :
522
-         ;;
523
-         *)
524
-            ensure_consistency
525
-         ;;
526
-      esac
537
+      if [ "${MULLE_BOOTSTRAP_DIRTY_HARRY}" != "NO" ]
538
+      then
539
+         case "${command}" in
540
+            clean|dist-clean|init)
541
+               :
542
+            ;;
543
+
544
+            *)
545
+               ensure_consistency
546
+            ;;
547
+         esac
548
+      fi
527 549
    fi
528 550
 
529
-   #
530
-   # some commands should refresh before execution
531
-   # try to avoid pulling in the header if not needed
532
-   #
533
-   if refresh_needed
534
-   then
535
-      case "${command}" in
536
-         bootstrap|nomagic|fetch|update)
537
-            MULLE_BOOTSTRAP_WILL_FETCH="YES"
538
-            . mulle-bootstrap-refresh.sh
539
-            refresh_main || exit 1
540
-         ;;
541
-
542
-         setup-xcode|xcode|tag)
543
-           . mulle-bootstrap-refresh.sh
544
-            refresh_main || exit 1
545
-         ;;
546
-
547
-         build)
548
-           . mulle-bootstrap-refresh.sh
549
-
550
-            refresh_main refresh_if_bare || exit 1
551
-         ;;
552
-
553
-         refresh)
554
-           . mulle-bootstrap-refresh.sh
555
-
556
-           # 4 laters
557
-         ;;
558
-      esac
559
-   fi
551
+   MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap ${command}"
560 552
 
561 553
    case "${command}" in
562 554
       bootstrap|nomagic)
... ...
@@ -566,51 +558,49 @@ bootstrap_main()
566 558
       build)
567 559
          . mulle-bootstrap-build.sh
568 560
 
569
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap build"
570 561
          build_main "$@" || exit 1
571 562
       ;;
572 563
 
573 564
       clean)
574 565
          . mulle-bootstrap-clean.sh
575 566
 
576
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap clean"
577 567
          clean_main "$@" || exit 1
578 568
       ;;
579 569
 
580 570
       config)
581 571
          . mulle-bootstrap-settings.sh
582
-         . mulle-bootstrap-build-environment.sh
583 572
 
584
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap config"
585 573
          config_main "$@" || exit 1
586 574
       ;;
587 575
 
576
+      setting)
577
+         . mulle-bootstrap-settings.sh
578
+
579
+         setting_main "$@" || exit 1
580
+      ;;
581
+
588 582
       dist)
589 583
          . mulle-bootstrap-clean.sh
590 584
 
591
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap clean"
592 585
          clean_main "dist" || exit 1
593 586
       ;;
594 587
 
595
-      fetch)
596
-         . mulle-bootstrap-fetch.sh
588
+      git)
589
+         . mulle-bootstrap-scm.sh
597 590
 
598
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap fetch"
599
-         DONT_ASK_AFTER_WARNING=YES fetch_main "$@" || exit 1
591
+         git_main "$@" || exit 1
600 592
       ;;
601 593
 
602 594
       init)
603 595
          . mulle-bootstrap-init.sh
604 596
 
605
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap init"
606 597
          init_main "$@" || exit 1
607 598
       ;;
608 599
 
609
-      install)
610
-         . mulle-bootstrap-install.sh
600
+      install|fetch)
601
+         . mulle-bootstrap-fetch.sh
611 602
 
612
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap install"
613
-         install_main "$@" || exit 1
603
+         DONT_ASK_AFTER_WARNING=YES fetch_main "$@" || exit 1
614 604
       ;;
615 605
 
616 606
       library-path)
... ...
@@ -618,22 +608,16 @@ bootstrap_main()
618 608
          return 0
619 609
       ;;
620 610
 
621
-      refresh)
622
-         [ -z "${MULLE_BOOTSTRAP_REFRESH_SH}" ] && . mulle-bootstrap-refresh.sh
611
+      update)
612
+         . mulle-bootstrap-fetch.sh
623 613
 
624
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap refresh"
625
-         refresh_main "$@" || exit 1
614
+         update_main "$@" || exit 1
626 615
       ;;
627 616
 
628
-      update|pull)
617
+      upgrade)
629 618
          . mulle-bootstrap-fetch.sh
630 619
 
631
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap update"
632
-         update_main "$@" || exit 1
633
-
634
-         [ -z "${MULLE_BOOTSTRAP_REFRESH_SH}" ] && . mulle-bootstrap-refresh.sh
635
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap refresh"
636
-         refresh_main || exit 1
620
+         upgrade_main "$@" || exit 1
637 621
       ;;
638 622
 
639 623
       setup-xcode|xcode)
... ...
@@ -643,6 +627,12 @@ bootstrap_main()
643 627
          xcode_main "$@" || exit 1
644 628
       ;;
645 629
 
630
+      systeminstall)
631
+         . mulle-bootstrap-install.sh
632
+
633
+         install_main "$@" || exit 1
634
+      ;;
635
+
646 636
       tag)
647 637
          . mulle-bootstrap-tag.sh
648 638
 
... ...
@@ -650,11 +640,9 @@ bootstrap_main()
650 640
          tag_main "$@" || exit 1
651 641
       ;;
652 642
 
653
-      git)
654
-         . mulle-bootstrap-scm.sh
655
-
656
-         MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap git"
657
-         git_main "$@" || exit 1
643
+      uname)
644
+         echo "${UNAME}"
645
+         exit 0
658 646
       ;;
659 647
 
660 648
       version)
... ...
@@ -33,14 +33,13 @@ MULLE_BOOTSTRAP_ARRAY_SH="included"
33 33
 
34 34
 # declare "fail" outside
35 35
 # array contents can contain any characters except newline
36
-
37 36
 array_value_check()
38 37
 {
39 38
    local n
40 39
 
41 40
    n=`echo "$1" | wc -l  | awk '{ print $1}'`
42
-   [ $n -eq 0 ] && internal_fail "empty value"
43
-   [ $n -ne 1 ] && internal_fail "value \"$1\" has linebreaks"
41
+   [ "$n" -eq 0 ] && internal_fail "empty value"
42
+   [ "$n" -ne 1 ] && internal_fail "value \"$1\" has linebreaks"
44 43
 
45 44
    echo "$1"
46 45
 }
... ...
@@ -54,12 +53,12 @@ array_index_check()
54 53
    array="$1"
55 54
    i="$2"
56 55
 
57
-   [ -z "${i}" ] && internal_fail "empty index"
56
+   [ -z "$i" ] && internal_fail "empty index"
58 57
 
59 58
    local n
60 59
    n=`array_count "${array}"`
61 60
 
62
-   [ ${i} -ge ${n} ] && internal_fail "index ${i} out of bounds ${n}"
61
+   [ "$i" -ge "$n" ] && internal_fail "index ${i} out of bounds ${n}"
63 62
 
64 63
    echo "${i}"
65 64
 }
... ...
@@ -97,8 +96,8 @@ array_count()
97 96
 
98 97
    local n
99 98
 
100
-   n=`echo "${array}" | wc -l | awk '{ print $1}'`
101
-   echo ${n}
99
+   n=`echo "${array}" | wc -l | awk '{ print $1 }'`
100
+   echo "$n"
102 101
 }
103 102
 
104 103
 
... ...
@@ -109,9 +108,9 @@ array_get()
109 108
 
110 109
    array="$1"
111 110
    i="`array_index_check "${array}" "$2"`"
112
-   i=`expr $i + 1`
111
+   i="`expr "$i" + 1`"
113 112
 
114
-   echo "${array}" | head -${i} | tail -1
113
+   echo "${array}" | head "-$i" | tail -1
115 114
 }
116 115
 
117 116
 
... ...
@@ -139,24 +138,24 @@ array_insert()
139 138
    local tail_count
140 139
    local n
141 140
 
142
-   [ "${i}" = "" ] && internal_fail "empty index"
141
+   [ -z "${i}" ] && internal_fail "empty index"
143 142
 
144
-   n=`array_count "${array}"`
145
-   [ ${i} -gt ${n} ] && internal_fail "index ${i} out of bounds ${n}"
143
+   n="`array_count "${array}"`"
144
+   [ "$i" -gt "$n" ] && internal_fail "index ${i} out of bounds ${n}"
146 145
 
147
-   head_count=$i
148
-   tail_count=`expr $n - $i`
146
+   head_count="$i"
147
+   tail_count="`expr "$n" - "$i"`"
149 148
 
150
-   if [ ${head_count} -ne 0 ]
149
+   if [ "${head_count}" -ne 0 ]
151 150
    then
152
-      echo "${array}" | head -${head_count}
151
+      echo "${array}" | head "-${head_count}"
153 152
    fi
154 153
 
155 154
    echo "${value}"
156 155
 
157
-   if [ ${tail_count} -ne 0 ]
156
+   if [ "${tail_count}" -ne 0 ]
158 157
    then
159
-      echo "${array}" | tail -${tail_count}
158
+      echo "${array}" | tail "-${tail_count}"
160 159
    fi
161 160
 }
162 161
 
... ...
@@ -195,11 +194,11 @@ array_remove_last()
195 194
       ;;
196 195
 
197 196
       *)
198
-         n="`expr $n - 1`"
197
+         n="`expr "$n" - 1`"
199 198
       ;;
200 199
    esac
201 200
 
202
-   echo "${array}" | head -$n
201
+   echo "${array}" | head "-$n"
203 202
 }
204 203
 
205 204
 
... ...
@@ -234,8 +233,8 @@ _assoc_array_key_check()
234 233
    local n
235 234
 
236 235
    n=`echo "$1" | wc -w`
237
-   [ $n -eq 0 ] && internal_fail "empty value"
238
-   [ $n -ne 1 ] && internal_fail "key \"$1\" has spaces"
236
+   [ "$n" -eq 0 ] && internal_fail "empty value"
237
+   [ "$n" -ne 1 ] && internal_fail "key \"$1\" has spaces"
239 238
 
240 239
    #
241 240
    # escape charactes
... ...
@@ -32,15 +32,180 @@ MULLE_BOOTSTRAP_AUTO_UPDATE_SH="included"
32 32
 
33 33
 
34 34
 #
35
-# What auto_update does:
36
-#
37
-# 1. bootstrap_auto_create:
38
-#    1.a. run once to copy roots .bootstrap.local to .bootstrap.auto
39
-#    1.b) augment .bootstrap.local with stuff from .bootstrap
35
+# This function is called initially to setup .bootstrap.auto before
36
+# doing anything else. It is clear that .bootstrap.auto does not exist
40 37
 #
41
-# 2. bootstrap_auto_update:
42
-#    2.a) augment .bootstrap.local with stuff from .repos/<name>/.bootstrap
38
+# copy contents of .bootstrap.local to .bootstrap.auto
39
+# them add contents of .bootstrap to .bootstrap.auto, if not present
43 40
 #
41
+bootstrap_auto_create()
42
+{
43
+   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "empty bootstrap"
44
+
45
+   log_fluff "Creating ${BOOTSTRAP_DIR}.auto from ${BOOTSTRAP_DIR} (`pwd`)"
46
+
47
+   assert_mulle_bootstrap_version
48
+
49
+   rmdir_safer "${BOOTSTRAP_DIR}.auto"
50
+   mkdir_if_missing "${BOOTSTRAP_DIR}.auto"
51
+
52
+   #
53
+   # Copy over .local verbatim
54
+   #
55
+   if dir_has_files "${BOOTSTRAP_DIR}.local"
56
+   then
57
+      exekutor cp -Ra "${BOOTSTRAP_DIR}.local/" "${BOOTSTRAP_DIR}.auto/"
58
+   fi
59
+
60
+   #
61
+   # add stuff from bootstrap folder
62
+   # don't copy config if exists (it could be malicious)
63
+   #
64
+   local path
65
+   local name
66
+
67
+   [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
68
+   IFS="
69
+"
70
+   for path in `ls -1 "${BOOTSTRAP_DIR}"`
71
+   do
72
+      IFS="${DEFAULT_IFS}"
73
+      name="`basename -- "${path}"`"
74
+
75
+      case "${name}" in
76
+         config)
77
+            continue
78
+         ;;
79
+
80
+         *.build|settings|overrides)
81
+            if [ -d "${BOOTSTRAP_DIR}/${name}" ]
82
+            then
83
+               inherit_files "${BOOTSTRAP_DIR}.auto/${name}" "${BOOTSTRAP_DIR}/${name}"
84
+            fi
85
+         ;;
86
+
87
+         *)
88
+            exekutor cp -Ran "${BOOTSTRAP_DIR}/${name}" "${BOOTSTRAP_DIR}.auto/"
89
+         ;;
90
+      esac
91
+   done
92
+
93
+   IFS="${DEFAULT_IFS}"
94
+}
95
+
96
+
97
+
98
+_bootstrap_auto_refresh_repository_file()
99
+{
100
+   local clones
101
+   local stop
102
+   local refreshed
103
+   local match
104
+   local dependency_map
105
+   local unexpanded
106
+
107
+   [ -z "${MULLE_BOOTSTRAP_DEPENDENY_RESOLVE_SH}" ] && . mulle-bootstrap-dependency-resolve.sh
108
+
109
+   refreshed=""
110
+   dependency_map=""
111
+
112
+   clones="`read_root_setting "repositories"`"
113
+   if [ -z "${clones}" ]
114
+   then
115
+      return
116
+   fi
117
+
118
+   IFS="
119
+"
120
+   for unexpanded in ${clones}
121
+   do
122
+      IFS="${DEFAULT_IFS}"
123
+
124
+      # cat for -e
125
+      match="`echo "${refreshed}" | fgrep -s -x "${unexpanded}"`"
126
+      if [ ! -z "${match}" ]
127
+      then
128
+         continue
129
+      fi
130
+
131
+      refreshed="${refreshed}
132
+${unexpanded}"
133
+
134
+      if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
135
+      then
136
+         log_trace2 "Dealing with ${unexpanded}"
137
+      fi
138
+
139
+      # avoid superflous updates
140
+
141
+      local branch
142
+      local stashdir
143
+      local name
144
+      local scm
145
+      local tag
146
+      local url
147
+      local clone
148
+      local dstdir
149
+
150
+      clone="`expanded_variables "${unexpanded}"`"
151
+      parse_clone "${clone}"
152
+
153
+      dependency_map="`dependency_add "${dependency_map}" "__ROOT__" "${unexpanded}"`"
154
+
155
+      #
156
+      # dependency management, it could be nicer, but isn't.
157
+      # Currently matches only URLs
158
+      #
159
+
160
+      if [ ! -d "${stashdir}" ]
161
+      then
162
+         if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
163
+         then
164
+            log_trace2 "${stashdir} not fetched yet"
165
+         fi
166
+         continue
167
+      fi
168
+
169
+      local sub_repos
170
+      local filename
171
+
172
+      filename="${stashdir}/.bootstrap/repositories"
173
+      sub_repos="`read_setting "${filename}" "repositories"`"
174
+      if [ ! -z "${sub_repos}" ]
175
+      then
176
+#                  unexpanded_url="`url_from_clone "${unexpanded}"`"
177
+         dependency_map="`dependency_add_array "${dependency_map}" "${unexpanded}" "${sub_repos}"`"
178
+         if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
179
+         then
180
+            log_trace2 "add \"${unexpanded}\" to __ROOT__ as dependencies"
181
+            log_trace2 "add [ ${sub_repos} ] to ${unexpanded} as dependencies"
182
+         fi
183
+      else
184
+         log_fluff "${name} has no repositories"
185
+      fi
186
+   done
187
+
188
+   IFS="${DEFAULT_IFS}"
189
+
190
+   #
191
+   # output true repository dependencies
192
+   #
193
+   local repositories
194
+
195
+   repositories="`dependency_resolve "${dependency_map}" "__ROOT__" | fgrep -v -x "__ROOT__"`"
196
+   if [ ! -z "${repositories}" ]
197
+   then
198
+      if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
199
+      then
200
+         log_trace2 "----------------------"
201
+         log_trace2 "resolved dependencies:"
202
+         log_trace2 "----------------------"
203
+         log_trace2 "${repositories}"
204
+         log_trace2 "----------------------"
205
+      fi
206
+      echo "${repositories}" > "${BOOTSTRAP_DIR}.auto/repositories"
207
+   fi
208
+}
44 209
 
45 210
 #
46 211
 # prepend new contents to old contents
... ...
@@ -48,10 +213,8 @@ MULLE_BOOTSTRAP_AUTO_UPDATE_SH="included"
48 213
 # `BOOTSTRAP_DIR` is the "root" bootstrap to update
49 214
 # `directory` can be the inferior bootstrap of a fetched repository
50 215
 #
51
-_bootstrap_auto_update_merge()
216
+_bootstrap_auto_merge_root_settings()
52 217
 {
53
-   local directory
54
-
55 218
    directory="$1"
56 219
 
57 220
    [ -z "${directory}" ] && internal_fail "wrong"
... ...
@@ -89,6 +252,7 @@ _bootstrap_auto_update_merge()
89 252
          continue
90 253
       fi
91 254
 
255
+      # cat is for -e
92 256
       match="`echo "${NON_MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
93 257
       if [ ! -z "${match}" ]
94 258
       then
... ...
@@ -96,6 +260,7 @@ _bootstrap_auto_update_merge()
96 260
          continue
97 261
       fi
98 262
 
263
+      # cat is for -e
99 264
       match="`echo "${MERGABLE_SETTINGS}" | fgrep -s -x "${settingname}"`"
100 265
       if [ -z "${match}" ]
101 266
       then
... ...
@@ -124,147 +289,116 @@ _bootstrap_auto_update_merge()
124 289
 }
125 290
 
126 291
 
127
-_bootstrap_auto_update_repo_settings()
292
+bootstrap_auto_update()
128 293
 {
129 294
    local directory
130 295
 
296
+   log_fluff ":bootstrap_auto_update: begin"
131 297
    directory="$1"
132 298
 
133
-   local srcdir
134
-   local dstdir
135
-   local reponame
136
-
137
-   srcdir="${directory}/.bootstrap"
138
-   dstdir="${BOOTSTRAP_DIR}.auto"
299
+   if [ -d "${directory}/${BOOTSTRAP_DIR}" ]
300
+   then
301
+      _bootstrap_auto_merge_root_settings "${directory}"
302
+      _bootstrap_auto_refresh_repository_file "${directory}"
303
+   fi
304
+   log_fluff ":bootstrap_auto_update: end"
305
+}
139 306
 
140
-   [ -d "${dstdir}" ] || internal_fail "missing ${dstdir}"
141 307
 
308
+bootstrap_create_build_folders()
309
+{
142 310
    #
143
-   # copy repo settings flat if not present already
311
+   # now pick up on build order and produce .build folders
312
+   # but build order could be "hand coded", lets use it
144 313
    #
145
-   for i in `find "${srcdir}" -mindepth 1 -maxdepth 1 -type d -print 2> /dev/null`
146
-   do
147
-      reponame="`basename -- "${i}"`"
314
+   local revclonenames
315
+   local clonenames
316
+   local srcdir
317
+   local dstdir
148 318
 
149
-      case "${reponame}" in
150
-         .*)
151
-            # skip hidden stuff
152
-         ;;
319
+   local has_settings
320
+   local has_overrides
153 321
 
154
-         *.info)
155
-            if [ -d "${dstdir}/${reponame}" ]
156
-            then
157
-               log_verbose "Settings for \"${reponame}\" are already present, so skipped"
158
-               continue
159
-            fi
322
+   [ -d "${BOOTSTRAP_DIR}.auto/settings" ]
323
+   has_settings=$?
160 324
 
161
-            exekutor cp -Ra "${i}" "${dstdir}/${reponame}"
162
-         ;;
163
-      esac
164
-   done
325
+   [ -d "${BOOTSTRAP_DIR}.auto/overrides" ]
326
+   has_overrides=$?
165 327
 
166
-   rmdir_if_empty "${dstdir}"
167
-}
328
+   clonenames="`read_root_setting "build_order"`"
329
+   revclonenames="`echo "${clonenames}" | sed '1!G;h;$!d'`"  # reverse lines
168 330
 
169
-
170
-#
171
-# This function is called periodocally to update .bootstrap.auto with the
172
-# contents of fetched repository .bootstraps
173
-#
174
-# `BOOTSTRAP_DIR` is the "root" bootstrap to update
175
-# `directory` the fetched repository
176
-# return 0, if something changed
177
-#
178
-bootstrap_auto_update()
179
-{
331
+   local tmp
332
+   local apath
180 333
    local name
181
-   local directory
182
-
183
-   name="$1"
184
-   directory="$2"
334
+   local revname
185 335
 
186
-   [ -z "${BOOTSTRAP_DIR}" ]     && internal_fail "BOOTSTRAP_DIR was empty"
187
-   [ -z "${directory}" ]         && internal_fail "directory was empty"
188
-   [ "${PWD}" = "${directory}" ] && internal_fail "configuration error"
189
-
190
-   if [ "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES" ]
191
-   then
192
-      log_trace2 "bootstrap.auto: ${name} from ${directory}"
193
-   fi
194
-
195
-   log_verbose "Auto update \"${name}\" settings ($directory)"
196
-
197
-   # contains own bootstrap ? and not a symlink
198
-   if [ ! -d "${directory}/.bootstrap" ] # -a ! -L "${dst}" ]
199
-   then
200
-      log_fluff "No .bootstrap folder in \"${directory}\" found"
201
-      return 1
202
-   fi
203
-
204
-   log_verbose "Updating .bootstrap.auto with ${directory}/.bootstrap ($PWD)"
205
-
206
-   log_fluff "Acquiring \"${name}\" merge settings"
207
-   _bootstrap_auto_update_merge "${directory}"
208
-
209
-   log_fluff "Acquiring \"${name}\" repo settings"
210
-   _bootstrap_auto_update_repo_settings "${directory}"
336
+   #
337
+   # small optimization,
338
+   # throw out revclones  that have no .bootstrap folder
339
+   #
211 340
 
212
-   log_fluff "Acquisiton of \"${name}\" settings complete"
341
+   tmp="${revclonenames}"
342
+   revclonenames=""
213 343
 
214
-   return 0
215
-}
344
+   IFS="
345
+"
346
+   for revname in ${tmp}
347
+   do
348
+      IFS="${DEFAULT_IFS}"
216 349
 
350
+      apath="`stash_of_repository "${REPOS_DIR}" "${revname}"`/.bootstrap"
351
+      if [ -d "${apath}" ]
352
+      then
353
+         revclonenames="`add_line "${revclonenames}" "${revname}"`"
354
+      fi
355
+   done
217 356
 
218
-#
219
-# This function is called initially to setup .bootstrap.auto before
220
-# doing anything else. It is clear that .bootstrap.auto does not exist
221
-#
222
-# copy contents of .bootstrap.local to .bootstrap.auto
223
-# them add contents of .bootstrap to .bootstrap.auto, if not present
224
-#
225
-bootstrap_auto_create()
226
-{
227
-   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "empty bootstrap"
228
-   [ -d "${BOOTSTRAP_DIR}.auto" ] && internal_fail "${BOOTSTRAP_DIR}.auto already exists"
357
+   IFS="
358
+"
359
+   for name in ${clonenames}
360
+   do
361
+      IFS="${DEFAULT_IFS}"
229 362
 
230
-   log_verbose "Creating .bootstrap.auto from ${BOOTSTRAP_DIR} (`pwd -P`)"
363
+      dstdir="${BOOTSTRAP_DIR}.auto/.${name}.build"
364
+      if [ ${has_settings} -eq 0 ]
365
+      then
366
+         inherit_files "${dstdir}" "${BOOTSTRAP_DIR}.auto/settings"
367
+      fi
231 368
 
232
-   assert_mulle_bootstrap_version
369
+      if [ "`read_build_setting "${name}" "final" "NO"`" = "YES" ]
370
+      then
371
+         break
372
+      fi
233 373
 
234
-   mkdir_if_missing "${BOOTSTRAP_DIR}.auto"
374
+      IFS="
375
+"
376
+      for revname in ${revclonenames}
377
+      do
378
+         IFS="${DEFAULT_IFS}"
235 379
 
236
-   #
237
-   # Copy over .local verbatim
238
-   #
239
-   if dir_has_files "${BOOTSTRAP_DIR}.local"
240
-   then
241
-      exekutor cp -Ra "${BOOTSTRAP_DIR}.local/" "${BOOTSTRAP_DIR}.auto/"
242
-   fi
380
+         srcdir="`stash_of_repository "${REPOS_DIR}" "${revname}"`/.bootstrap/${name}.build"
243 381
 
244
-   #
245
-   # add stuff from bootstrap folder
246
-   # don't copy config if exists (it could be malicious)
247
-   #
248
-   local path
249
-   local name
382
+         if [ -d "${srcdir}" ]
383
+         then
384
+            inherit_files "${dstdir}" "${srcdir}"
385
+            if [ "`read_build_setting "${name}" "final" "NO"`" = "YES" ]
386
+            then
387
+               break
388
+            fi
389
+         fi
250 390
 
251
-   [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
252
-   IFS="
253
-"
254
-   for path in `ls -1 "${BOOTSTRAP_DIR}"`
255
-   do
256
-      IFS="${DEFAULT_IFS}"
257
-      name="`basename -- "${path}"`"
391
+         if [ "${revname}" = "${name}" ]
392
+         then
393
+            break
394
+         fi
258 395
 
259
-      case "${name}" in
260
-         config)
261
-            continue
262
-         ;;
396
+      done
263 397
 
264
-         *)
265
-            exekutor cp -Ran "${BOOTSTRAP_DIR}/${name}" "${BOOTSTRAP_DIR}.auto/"
266
-         ;;
267
-      esac
398
+      if [ ${has_overrides} -eq 0 ]
399
+      then
400
+         override_files "${dstdir}" "${BOOTSTRAP_DIR}.auto/overrides"
401
+      fi
268 402
    done
269 403
 
270 404
    IFS="${DEFAULT_IFS}"
... ...
@@ -275,11 +409,8 @@ bootstrap_auto_final()
275 409
 {
276 410
    [ -d "${BOOTSTRAP_DIR}.auto" ] || internal_fail "${BOOTSTRAP_DIR}.auto does not exists"
277 411
 
278
-   log_verbose "Creating build_order from repositories"
412
+   log_fluff "Creating ${C_MAGENTA}${C_BOLD}build_order${C_VERBOSE} from repositories"
279 413
 
280
-   #
281
-   # Copy over .local verbatim
282
-   #
283 414
    if [ -f "${BOOTSTRAP_DIR}.auto/build_order" ]
284 415
    then
285 416
       log_fluff "build_order already exists"
... ...
@@ -303,17 +434,19 @@ bootstrap_auto_final()
303 434
 
304 435
    IFS="
305 436
 "
306
-   for clone in `read_fetch_setting "repositories"`
437
+   for clone in `read_root_setting "repositories"`
307 438
    do
308 439
       IFS="${DEFAULT_IFS}"
309 440
 
310
-      __parse_embedded_clone "${clone}"
441
+      parse_clone "${clone}"
311 442
       order="`add_line "${order}" "${name}"`"
312 443
    done
313 444
 
314
-   echo "${order}"  > "${BOOTSTRAP_DIR}.auto/build_order"
315
-
316 445
    IFS="${DEFAULT_IFS}"
446
+
447
+   echo "${order}" > "${BOOTSTRAP_DIR}.auto/build_order"
448
+
449
+   bootstrap_create_build_folders
317 450
 }
318 451
 
319 452
 
... ...
@@ -322,7 +455,6 @@ auto_update_initialize()
322