Browse code

Lotsa changes All tests pass now, but that doesn't mean its bugfree.

Nat! authored on 14-02-2017 21:34:25
Showing 28 changed files
... ...
@@ -33,7 +33,7 @@ During all operatios execept **mulle-bootstrap build**, **mulle-bootstrap** will
33 33
 
34 34
 ![Fetch Setting](fetch-search.svg)
35 35
 
36
-If nothing is found, a built in default is used.
36
+If nothing is found, a built-in default is used.
37 37
 
38 38
 ### 3. Build Settings
39 39
 
... ...
@@ -79,7 +79,7 @@ _canonicalize_file_path()
79 79
 {
80 80
     local dir file
81 81
 
82
-    dir="` dirname "$1"`"
82
+    dir="`dirname "$1"`"
83 83
     file="`basename -- "$1"`"
84 84
     (
85 85
       cd "${dir}" 2>/dev/null &&
... ...
@@ -206,21 +206,25 @@ _bootstrap_main()
206 206
 
207 207
    warn_scripts_main "${BOOTSTRAP_DIR}" || exit 1
208 208
 
209
-   if fetch_needed
209
+   if [ "${MULLE_FLAG_DIRTY_HARRY}" = "NO" ] || fetch_needed
210 210
    then
211 211
       MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap fetch"
212 212
       fetch_main "$@" || exit 1
213 213
       # used for option handling only
214 214
       MULLE_BOOTSTRAP_DID_FETCH="YES"
215
+   else
216
+      log_verbose "No fetch needed"
215 217
    fi
216 218
 
217 219
    if build_needed
218 220
    then
219 221
       MULLE_EXECUTABLE_FAIL_PREFIX="mulle-bootstrap build"
220 222
       build_main "$@" || exit 1
223
+   else
224
+      log_verbose "No build needed"
221 225
    fi
222 226
 
223
-   log_fluff "::: $command end :::"
227
+   log_fluff "::: bootstrap end :::"
224 228
 }
225 229
 
226 230
 
... ...
@@ -393,7 +397,7 @@ bootstrap_technical_flags()
393 397
 
394 398
       -t|--trace)
395 399
          MULLE_TRACE="1848"
396
-         COPYMOVEFLAGS="-v"
400
+         COPYMOVETARFLAGS="-v"
397 401
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
398 402
          MULLE_TRACE_PATHS_FLIP_X="YES"
399 403
          MULLE_TRACE_RESOLVER_FLIP_X="YES"
... ...
@@ -454,7 +458,7 @@ bootstrap_technical_flags()
454 458
         [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vv after -t invalidates -t"
455 459
 
456 460
          MULLE_TRACE="FLUFF"
457
-         COPYMOVEFLAGS="-v"
461
+         COPYMOVETARFLAGS="-v"
458 462
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
459 463
       ;;
460 464
 
... ...
@@ -462,7 +466,7 @@ bootstrap_technical_flags()
462 466
         [ "${MULLE_TRACE}" = "1848" ] && log_warning "${MULLE_EXECUTABLE_FAIL_PREFIX}: -vvv after -t invalidates -t"
463 467
 
464 468
          MULLE_TRACE="TRACE"
465
-         COPYMOVEFLAGS="-v"
469
+         COPYMOVETARFLAGS="-v"
466 470
          GITOPTIONS="`concat "${GITOPTIONS}" "-v"`"
467 471
       ;;
468 472
 
... ...
@@ -503,13 +507,6 @@ bootstrap_should_defer_to_master()
503 507
    masterpath="`get_master_of_minion_bootstrap_project`"
504 508
 
505 509
    case "${command}" in
506
-      build|flags|status|fetch|install|upgrade|update|clean)
507
-         log_info "Minion defers to master \"$masterpath\" for execution"
508
-
509
-         cd "${masterpath}" || fail "master is missing"
510
-         return 0  # this leads to  main deferring later on (but cd is set!)
511
-      ;;
512
-
513 510
       git|setup-xcode|xcode|tag|version|defer|emancipate)
514 511
          log_verbose "Minion executes locally"
515 512
       ;;
... ...
@@ -518,6 +515,13 @@ bootstrap_should_defer_to_master()
518 515
          fail "This is a minion bootstrap project.\n \
519 516
 ${MULLE_BOOTSTRAP_EXECUTABLE} ${command}t is not possible."
520 517
       ;;
518
+
519
+      *)
520
+         log_info "Minion defers to master \"$masterpath\" for execution"
521
+
522
+         cd "${masterpath}" || fail "master is missing"
523
+         return 0  # this leads to  main deferring later on (but cd is set!)
524
+      ;;
521 525
    esac
522 526
 
523 527
    return 1
... ...
@@ -71,14 +71,14 @@ _bootstrap_auto_copy()
71 71
          config)
72 72
             if [ "${is_local}" = "YES" ]
73 73
             then
74
-               exekutor cp -Ran ${COPYMOVEFLAGS} "${dstfilepath}" "${filepath}"
74
+               exekutor cp -Ran ${COPYMOVETARFLAGS} "${filepath}" "${dstfilepath}"
75 75
             fi
76 76
          ;;
77 77
 
78 78
          *.build|settings|overrides)
79 79
             if [ -d "${filepath}" ]
80 80
             then
81
-               exekutor cp -Ran ${COPYMOVEFLAGS} "${dstfilepath}" "${filepath}"
81
+               exekutor cp -Ran ${COPYMOVETARFLAGS} "${filepath}" "${dstfilepath}"
82 82
             fi
83 83
          ;;
84 84
 
... ...
@@ -100,11 +100,11 @@ _bootstrap_auto_copy()
100 100
             match="`echo "${filepath}" | sed '/[a-z]/d'`"
101 101
             if [ -z "${match}" ] ## has lowercase (not environment)
102 102
             then
103
-               # log_fluff "****" "${filepath}" "${src}" "${name}" "${tmpdir}" "****"
103
+               log_fluff "Copy expanded value of \"${filepath}\""
104 104
                value="`_read_expanded_setting "${filepath}" "${name}" "" "${tmpdir}"`"
105 105
                redirect_exekutor "${dstfilepath}" echo "${value}"
106 106
             else
107
-               exekutor cp -a ${COPYMOVEFLAGS} "${filepath}" "${dstfilepath}"
107
+               exekutor cp -a ${COPYMOVETARFLAGS} "${filepath}" "${dstfilepath}"
108 108
             fi
109 109
          ;;
110 110
       esac
... ...
@@ -121,36 +121,46 @@ _bootstrap_auto_copy()
121 121
 # copy contents of .bootstrap.local to .bootstrap.auto
122 122
 # them add contents of .bootstrap to .bootstrap.auto, if not present
123 123
 #
124
-bootstrap_auto_create()
124
+_bootstrap_auto_create()
125 125
 {
126
-   [ -z "${BOOTSTRAP_DIR}" ] && internal_fail "empty bootstrap"
126
+   local dst="$1"
127
+   local src="$2"
127 128
 
128
-   log_fluff "Creating clean \"${BOOTSTRAP_DIR}.auto\" from \"${BOOTSTRAP_DIR}\""
129
+   [ -z "${src}" ] && internal_fail "empty bootstrap"
130
+
131
+   log_fluff "Creating clean \"${dst}\" from \"${src}\""
129 132
 
130 133
    assert_mulle_bootstrap_version
131 134
 
132
-   rmdir_safer "${BOOTSTRAP_DIR}.auto"
133
-   mkdir_if_missing "${BOOTSTRAP_DIR}.auto"
135
+   rmdir_safer "${dst}"
136
+   mkdir_if_missing "${dst}"
134 137
 
135 138
    #
136 139
    # Copy over .local with config
137 140
    #
138
-   if dir_has_files "${BOOTSTRAP_DIR}.local"
141
+   if dir_has_files "${src}.local"
139 142
    then
140
-      _bootstrap_auto_copy "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}.local" "YES"
143
+      _bootstrap_auto_copy "${dst}" "${src}.local" "YES"
141 144
    fi
142 145
 
143 146
    #
144 147
    # add stuff from bootstrap folder
145 148
    # don't copy config if exists (it could be malicious)
146 149
    #
147
-   if dir_has_files "${BOOTSTRAP_DIR}"
150
+   if dir_has_files "${src}"
148 151
    then
149
-      _bootstrap_auto_copy "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}" "NO"
152
+      _bootstrap_auto_copy "${dst}" "${src}" "NO"
150 153
    fi
151 154
 }
152 155
 
153 156
 
157
+bootstrap_auto_create()
158
+{
159
+   _bootstrap_auto_create "${BOOTSTRAP_DIR}.auto" "${BOOTSTRAP_DIR}"
160
+}
161
+
162
+
163
+
154 164
 _bootstrap_merge_expanded_settings_in_front()
155 165
 {
156 166
    local addition="$1"
... ...
@@ -172,6 +182,60 @@ _bootstrap_merge_expanded_settings_in_front()
172 182
    _merge_settings_in_front "${settings1}" "${settings2}"
173 183
 }
174 184
 
185
+
186
+_make_master_clones()
187
+{
188
+   local clones="$1"
189
+
190
+   local clone
191
+   local name       # name of the clone
192
+   local url        # url of clone
193
+   local branch
194
+   local scm
195
+   local tag
196
+   local stashdir   # dir of repository (usually inside stashes)
197
+
198
+   IFS="
199
+"
200
+   for clone in ${clones}
201
+   do
202
+      IFS="${DEFAULT_IFS}"
203
+
204
+      parse_clone "${clone}"
205
+
206
+      echo "${url};${name};${branch};${scm};${tag}" | sed 's/;*$//'
207
+   done
208
+
209
+   IFS="${DEFAULT_IFS}"
210
+}
211
+
212
+
213
+_remove_dstdir_from_clones()
214
+{
215
+   local clones="$1"
216
+
217
+   local clone
218
+   local name       # name of the clone
219
+   local url        # url of clone
220
+   local branch
221
+   local scm
222
+   local tag
223
+   local stashdir   # dir of repository (usually inside stashes)
224
+
225
+   IFS="
226
+"
227
+   for clone in ${clones}
228
+   do
229
+      IFS="${DEFAULT_IFS}"
230
+
231
+      parse_clone "${clone}"
232
+
233
+      echo "${url};;${branch};${scm};${tag}" | sed 's/;*$//'
234
+   done
235
+
236
+   IFS="${DEFAULT_IFS}"
237
+}
238
+
175 239
 #
176 240
 # prepend new contents to old contents
177 241
 # of a few select and known files, these are merged with whats there
... ...
@@ -180,7 +244,8 @@ _bootstrap_merge_expanded_settings_in_front()
180 244
 #
181 245
 _bootstrap_auto_merge_root_settings()
182 246
 {
183
-   directory="$1"
247
+   dst="$1"
248
+   directory="$2"
184 249
 
185 250
    [ -z "${directory}" ] && internal_fail "wrong"
186 251
 
... ...
@@ -207,7 +272,7 @@ _bootstrap_auto_merge_root_settings()
207 272
          continue
208 273
       fi
209 274
 
210
-      dstfile="${BOOTSTRAP_DIR}.auto/${settingname}"
275
+      dstfile="${dst}/${settingname}"
211 276
 
212 277
       #
213 278
       # "repositories" file gets special treatment
... ...
@@ -217,6 +282,13 @@ _bootstrap_auto_merge_root_settings()
217 282
          local newcontents
218 283
 
219 284
          newcontents="`_bootstrap_merge_expanded_settings_in_front "${srcfile}" ""`"
285
+         if is_master_bootstrap_project
286
+         then
287
+            newcontents="`_make_master_clones "${newcontents}"`"
288
+         else
289
+            newcontents="`_remove_dstdir_from_clones "${newcontents}"`"
290
+         fi
291
+
220 292
          if [ -f "${dstfile}" ]
221 293
          then
222 294
             local contents2
... ...
@@ -263,9 +335,9 @@ _bootstrap_auto_merge_root_settings()
263 335
 
264 336
          log_fluff "Merging expanded \"${settingname}\" from \"${srcfile}\""
265 337
 
266
-         exekutor mv ${COPYMOVEFLAGS}  "${dstfile}" "${tmpfile}" >&2 || exit 1
338
+         exekutor mv ${COPYMOVETARFLAGS}  "${dstfile}" "${tmpfile}" >&2 || exit 1
267 339
          redirect_exekutor "${dstfile}" _bootstrap_merge_expanded_settings_in_front "${srcfile}" "${tmpfile}"  || exit 1
268
-         exekutor rm ${COPYMOVEFLAGS}  "${tmpfile}" >&2 || exit 1
340
+         exekutor rm ${COPYMOVETARFLAGS}  "${tmpfile}" >&2 || exit 1
269 341
       else
270 342
          log_fluff "Copying expanded \"${settingname}\" from \"${srcfile}\""
271 343
 
... ...
@@ -277,22 +349,54 @@ _bootstrap_auto_merge_root_settings()
277 349
 }
278 350
 
279 351
 
352
+_bootstrap_auto_embedded_copy()
353
+{
354
+   local name="$1"
355
+   local directory="$2"
356
+   local srcfile="$3"
357
+
358
+   local dst
359
+
360
+   dst="${BOOTSTRAP_DIR}.auto/.deep/${name}.d"
361
+
362
+   [ -d "${dst}" ] && internal_fail "${dst} already exists"
363
+   mkdir_if_missing "${dst}"
364
+
365
+   # copy over our stuff
366
+   # _bootstrap_auto_create "${dst}" "${BOOTSTRAP_DIR}"
367
+
368
+   # then augment with embedded_settings
369
+   local clones
370
+
371
+   clones="`_bootstrap_merge_expanded_settings_in_front "${srcfile}" ""`" || exit 1
372
+   redirect_exekutor "${dst}/embedded_repositories" echo "${clones}"
373
+}
374
+
375
+
280 376
 bootstrap_auto_update()
281 377
 {
282
-   local directory
378
+   local name="$1"
379
+   local stashdir="$2"
283 380
 
284 381
    log_fluff ":bootstrap_auto_update: begin"
285
-   directory="$1"
286 382
 
287
-   if [ -d "${directory}/${BOOTSTRAP_DIR}" ]
383
+   if [ -d "${stashdir}/${BOOTSTRAP_DIR}" ]
288 384
    then
289
-      _bootstrap_auto_merge_root_settings "${directory}"
290
-      sort_repository_file "${directory}"
385
+      _bootstrap_auto_merge_root_settings "${BOOTSTRAP_DIR}.auto" "${stashdir}"
386
+      sort_repository_file "${stashdir}"
387
+
388
+      local srcfile
389
+
390
+      srcfile="${stashdir}/${BOOTSTRAP_DIR}/embedded_repositories"
391
+      if [ -f "${srcfile}" ]
392
+      then
393
+         _bootstrap_auto_embedded_copy "${name}" "${stashdir}" "${srcfile}"
394
+      fi
291 395
    else
292 396
       # could be helpful to user
293
-      if [ -d "${directory}/${BOOTSTRAP_DIR}.local" ]
397
+      if [ -d "${stashdir}/${BOOTSTRAP_DIR}.local" ]
294 398
       then
295
-         log_fluff "Inferior \"${directory}/${BOOTSTRAP_DIR}.local\" ignored"
399
+         log_fluff "Inferior \"${stashdir}/${BOOTSTRAP_DIR}.local\" ignored"
296 400
       fi
297 401
    fi
298 402
 
... ...
@@ -455,6 +559,8 @@ bootstrap_auto_final()
455 559
 
456 560
 auto_update_initialize()
457 561
 {
562
+   [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
563
+
458 564
    log_fluff ":auto_update_initialize:"
459 565
 
460 566
    MERGABLE_SETTINGS='brews
... ...
@@ -333,6 +333,8 @@ brew_install_main()
333 333
 
334 334
 brew_initialize()
335 335
 {
336
+   [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
337
+
336 338
    log_fluff ":brew_initialize:"
337 339
 
338 340
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
... ...
@@ -116,7 +116,7 @@ dispense_headers()
116 116
          # this fails with more nested header set ups, need to fix!
117 117
 
118 118
          log_fluff "Copying \"${src}\" to \"${dst}\""
119
-         exekutor cp -Ra ${COPYMOVEFLAGS} "${src}"/* "${dst}" >&2 || exit 1
119
+         exekutor cp -Ra ${COPYMOVETARFLAGS} "${src}"/* "${dst}" >&2 || exit 1
120 120
 
121 121
          rmdir_safer "${src}"
122 122
       else
... ...
@@ -163,7 +163,7 @@ dispense_binaries()
163 163
          log_fluff "Copying \"${src}\" to \"${dst}\""
164 164
          mkdir_if_missing "${dst}"
165 165
          exekutor find "${src}" -xdev -mindepth 1 -maxdepth 1 \( -type "${findtype}" -o -type "${findtype2}" \) -print0 | \
166
-            exekutor xargs -0 -I % mv ${COPYMOVEFLAGS} "${copyflag}" % "${dst}" >&2
166
+            exekutor xargs -0 -I % mv ${COPYMOVETARFLAGS} "${copyflag}" % "${dst}" >&2
167 167
          [ $? -eq 0 ]  || exit 1
168 168
       else
169 169
          log_fluff "But there are none"
... ...
@@ -285,7 +285,7 @@ collect_and_dispense_product()
285 285
 
286 286
          log_fluff "Copying everything from \"${src}\" to \"${dst}\""
287 287
          exekutor find "${src}" -xdev -mindepth 1 -maxdepth 1 -print0 | \
288
-               exekutor xargs -0 -I % mv ${COPYMOVEFLAGS} -f % "${dst}" >&2
288
+               exekutor xargs -0 -I % mv ${COPYMOVETARFLAGS} -f % "${dst}" >&2
289 289
          [ $? -eq 0 ]  || fail "moving files from ${src} to ${dst} failed"
290 290
       fi
291 291
 
... ...
@@ -445,7 +445,7 @@ build_log_name()
445 445
    [ $# -eq 0 ] || shift
446 446
 
447 447
    local logfile
448
-   logfile="${BUILDLOG_SUBDIR}/${name}"
448
+   logfile="${BUILDLOGS_SUBDIR}/${name}"
449 449
 
450 450
    while [ $# -gt 0 ]
451 451
    do
... ...
@@ -749,7 +749,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
749 749
    local logfile1
750 750
    local logfile2
751 751
 
752
-   mkdir_if_missing "${BUILDLOG_SUBDIR}"
752
+   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
753 753
 
754 754
    logfile1="`build_log_name "cmake" "${name}" "${configuration}" "${sdk}"`"
755 755
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
... ...
@@ -1051,7 +1051,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1051 1051
    local logfile1
1052 1052
    local logfile2
1053 1053
 
1054
-   mkdir_if_missing "${BUILDLOG_SUBDIR}"
1054
+   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1055 1055
 
1056 1056
    logfile1="`build_log_name "configure" "${name}" "${configuration}" "${sdk}"`"
1057 1057
    logfile2="`build_log_name "make" "${name}" "${configuration}" "${sdk}"`"
... ...
@@ -1482,7 +1482,7 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO}${info} in \
1482 1482
 
1483 1483
    local logfile
1484 1484
 
1485
-   mkdir_if_missing "${BUILDLOG_SUBDIR}"
1485
+   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1486 1486
 
1487 1487
    logfile="`build_log_name "${toolname}" "${name}" "${configuration}" "${targetname}" "${schemename}" "${sdk}"`"
1488 1488
    log_verbose "Build log will be in: ${C_RESET_BOLD}${logfile}${C_VERBOSE}"
... ...
@@ -1749,9 +1749,9 @@ build_script()
1749 1749
    local targetname
1750 1750
    local logfile
1751 1751
 
1752
-   mkdir_if_missing "${BUILDLOG_SUBDIR}"
1752
+   mkdir_if_missing "${BUILDLOGS_SUBDIR}"
1753 1753
 
1754
-   logfile="${BUILDLOG_SUBDIR}/${name}-${configuration}-${sdk}.script.log"
1754
+   logfile="${BUILDLOGS_SUBDIR}/${name}-${configuration}-${sdk}.script.log"
1755 1755
    log_fluff "Build log will be in: ${C_RESET_BOLD}${logfile}${C_INFO}"
1756 1756
 
1757 1757
    mkdir_if_missing "${builddir}"
... ...
@@ -2099,7 +2099,7 @@ build_stashes()
2099 2099
 
2100 2100
    IFS="
2101 2101
 "
2102
-   for name in `ls -1d "${STASHES_DIR}"/*.failed 2> /dev/null`
2102
+   for name in `ls -1d "${STASHES_DEFAULT_DIR}"/*.failed 2> /dev/null`
2103 2103
    do
2104 2104
       IFS="${DEFAULT_IFS}"
2105 2105
       if [ -d "${name}" ]
... ...
@@ -2318,7 +2318,7 @@ build_main()
2318 2318
 
2319 2319
    if [ ! -f "${BOOTSTRAP_DIR}.auto/build_order" ]
2320 2320
    then
2321
-      log_error "No build_order found. You need to install first."
2321
+      log_error "No ${C_MAGENTA}${C_BOLD}build_order${C_ERROR} found. You need to install first."
2322 2322
       return 1
2323 2323
    fi
2324 2324
 
... ...
@@ -37,7 +37,7 @@ setup_clean_environment()
37 37
    [ -z "${DEPENDENCIES_DIR}"  ]  && internal_fail "DEPENDENCIES_DIR is empty"
38 38
    [ -z "${CLONESBUILD_SUBDIR}" ] && internal_fail "CLONESBUILD_SUBDIR is empty"
39 39
    [ -z "${ADDICTIONS_DIR}"   ]   && internal_fail "ADDICTIONS_DIR is empty"
40
-   [ -z "${STASHES_DIR}"   ]      && internal_fail "STASHES_DIR is empty"
40
+   [ -z "${STASHES_DEFAULT_DIR}"   ]      && internal_fail "STASHES_DEFAULT_DIR is empty"
41 41
 
42 42
    CLEAN_EMPTY_PARENTS="`read_config_setting "clean_empty_parent_folders" "YES"`"
43 43
 
... ...
@@ -47,11 +47,11 @@ setup_clean_environment()
47 47
 ${DEPENDENCIES_DIR}/tmp"`"
48 48
    OUTPUT_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "output_clean_folders" "${DEPENDENCIES_DIR}"`"
49 49
    INSTALL_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "install_clean_folders" "${REPOS_DIR}
50
-${STASHES_DIR}
50
+${STASHES_DEFAULT_DIR}
51 51
 .bootstrap.auto"`"
52 52
    DIST_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "dist_clean_folders" "${REPOS_DIR}
53 53
 ${ADDICTIONS_DIR}
54
-${STASHES_DIR}
54
+${STASHES_DEFAULT_DIR}
55 55
 .bootstrap.auto"`"
56 56
    EMBEDDED="`stashes_of_embedded_repositories "${REPOS_DIR}"`"
57 57
 
... ...
@@ -224,7 +224,7 @@ _dist_clean()
224 224
 
225 225
    DIST_CLEANABLE_SUBDIRS="`read_sane_config_path_setting "dist_clean_folders" "${REPOS_DIR}
226 226
 ${ADDICTIONS_DIR}
227
-${STASHES_DIR}
227
+${STASHES_DEFAULT_DIR}
228 228
 .bootstrap.auto"`"
229 229
    EMBEDDED="`stashes_of_embedded_repositories "${REPOS_DIR}"`"
230 230
 
... ...
@@ -249,10 +249,10 @@ _clean_execute()
249 249
 {
250 250
    local flag
251 251
 
252
-   [ -z "${DEPENDENCIES_DIR}"  ]  && internal_fail "DEPENDENCIES_DIR is empty"
253
-   [ -z "${CLONESBUILD_SUBDIR}" ] && internal_fail "CLONESBUILD_SUBDIR is empty"
254
-   [ -z "${ADDICTIONS_DIR}"   ]   && internal_fail "ADDICTIONS_DIR is empty"
255
-   [ -z "${STASHES_DIR}"   ]      && internal_fail "STASHES_DIR is empty"
252
+   [ -z "${DEPENDENCIES_DIR}"  ]   && internal_fail "DEPENDENCIES_DIR is empty"
253
+   [ -z "${CLONESBUILD_SUBDIR}" ]  && internal_fail "CLONESBUILD_SUBDIR is empty"
254
+   [ -z "${ADDICTIONS_DIR}"   ]    && internal_fail "ADDICTIONS_DIR is empty"
255
+   [ -z "${STASHES_DEFAULT_DIR}" ] && internal_fail "STASHES_DEFAULT_DIR is empty"
256 256
 
257 257
    flag=
258 258
    CLEAN_EMPTY_PARENTS="`read_config_setting "clean_empty_parent_folders" "YES"`"
... ...
@@ -91,22 +91,30 @@ build_complete_environment()
91 91
 
92 92
 common_settings_initialize()
93 93
 {
94
+   [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
95
+
94 96
    log_fluff ":common_settings_initialize:"
95 97
 
96 98
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
97 99
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
98 100
 
101
+   # experimentally, these could reside outside the project folder but never tested
99 102
    CLONESBUILD_SUBDIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
100
-   BUILDLOG_SUBDIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_SUBDIR}/.logs"`"
103
+   BUILDLOGS_SUBDIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_SUBDIR}/.logs"`"
104
+
105
+   # all of these must reside in the project folder
101 106
    DEPENDENCIES_DIR="`read_sane_config_path_setting "dependencies_dir" "dependencies"`"
102 107
    ADDICTIONS_DIR="`read_sane_config_path_setting "addictions_dir" "addictions"`"
103
-   STASHES_DIR="`read_sane_config_path_setting "stashes_dir" "stashes"`"
108
+   STASHES_DEFAULT_DIR="`read_sane_config_path_setting "stashes_dir" "stashes"`"
109
+
110
+   # "repository" caches can and usually are outside the project folder
111
+   CACHES_DIR="`read_config_setting "cashes_dir" "${DEFAULT_CACHES_DIR}"`"
104 112
 
105 113
    [ -z "${CLONESBUILD_SUBDIR}" ] && internal_fail "variable CLONESBUILD_SUBDIR is empty"
106
-   [ -z "${BUILDLOG_SUBDIR}" ]    && internal_fail "variable BUILDLOG_SUBDIR is empty"
114
+   [ -z "${BUILDLOGS_SUBDIR}" ]    && internal_fail "variable BUILDLOGS_SUBDIR is empty"
107 115
    [ -z "${DEPENDENCIES_DIR}" ]   && internal_fail "variable DEPENDENCIES_DIR is empty"
108 116
    [ -z "${ADDICTIONS_DIR}" ]     && internal_fail "variable ADDICTIONS_DIR is empty"
109
-   [ -z "${STASHES_DIR}" ]        && internal_fail "variable STASHES_DIR is empty"
117
+   [ -z "${STASHES_DEFAULT_DIR}" ]        && internal_fail "variable STASHES_DEFAULT_DIR is empty"
110 118
 }
111 119
 
112 120
 common_settings_initialize
... ...
@@ -81,7 +81,7 @@ _copy_files()
81 81
    # copy over files only, let tar remove extension
82 82
    #
83 83
    (
84
-      cd "${srcdir}" ;
84
+      exekutor cd "${srcdir}" ;
85 85
       if [ -z "${ext}" ]
86 86
       then
87 87
          exekutor find . \( -type f -a ! -name "*.*" \) -print
... ...
@@ -91,15 +91,15 @@ _copy_files()
91 91
          exekutor tar -c ${taroptions} -f - -T -
92 92
    ) |
93 93
    (
94
-      cd "${dstdir}" ;
94
+      exekutor cd "${dstdir}" ;
95 95
       if [ -z "${noclobber}" ]
96 96
       then
97
-         exekutor tar xf - ${COPYMOVEFLAGS} $*
97
+         exekutor tar -x ${COPYMOVETARFLAGS} -f -
98 98
       else
99
-         exekutor tar xf - ${COPYMOVEFLAGS} -k 2> /dev/null
99
+         exekutor tar -x ${COPYMOVETARFLAGS} -k -f -
100 100
          :
101 101
       fi
102
-   ) >&2
102
+   )
103 103
 }
104 104
 
105 105
 
... ...
@@ -118,10 +118,21 @@ defer_main()
118 118
       internal_fail "Master \"${masterpath}\" already owns \"${minionpath}\", but it was not detected before"
119 119
    fi
120 120
 
121
+   log_info "Deferring to \"${masterpath}\""
122
+
121 123
    make_master_bootstrap_project "${masterpath}"
122 124
    make_minion_bootstrap_project "${minionpath}" "${masterpath}"
123
-   log_info "Deferring to \"${masterpath}\""
125
+
126
+   [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
127
+   [ -z "${MULLE_BOOTSTRAP_CLEAN_SH}" ] && . mulle-bootstrap-clean.sh
128
+
129
+   #
130
+   # dist clean ourselves
131
+   #
132
+   clean_execute "dist"
133
+
124 134
    master_add_minion_bootstrap_project "${masterpath}" "${minionpath}"
135
+
125 136
 }
126 137
 
127 138
 
... ...
@@ -185,5 +196,13 @@ emancipate_main()
185 196
    log_info "Emancipating from \"${masterpath}\""
186 197
    master_remove_minion_bootstrap_project "${masterpath}" "${minionpath}"
187 198
    emancipate_minion_bootstrap_project "${minionpath}"
199
+
200
+   [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
201
+   [ -z "${MULLE_BOOTSTRAP_CLEAN_SH}" ] && . mulle-bootstrap-clean.sh
202
+
203
+   #
204
+   # dist clean ourselves
205
+   #
206
+   clean_execute "dist"
188 207
 }
189 208
 
... ...
@@ -220,6 +220,10 @@ dependency_resolve()
220 220
 
221 221
 dependency_resolve_initialize()
222 222
 {
223
+   [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
224
+
225
+   log_fluff ":dependency_resolve_initialize:"
226
+
223 227
    [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
224 228
    :
225 229
 }
... ...
@@ -178,21 +178,27 @@ log_action()
178 178
    log_fluff "Perform ${action}${info}${url} into ${stashdir} ..."
179 179
 }
180 180
 
181
+
181 182
 #
182 183
 ###
183 184
 #
184 185
 link_command()
185 186
 {
186
-   local reposdir="$1"  # ususally .bootstrap.repos
187
-   local name="$2"      # name of the clone
187
+#   local reposdir="$1"  # ususally .bootstrap.repos
188
+#   local name="$2"      # name of the clone
188 189
    local url="$3"       # URL of the clone
189 190
    local branch="$4"    # branch of the clone
190
-   local scm="$5"       # scm to use for this clone
191
+#   local scm="$5"       # scm to use for this clone
191 192
    local tag="$6"       # tag to checkout of the clone
192 193
    local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
193 194
 
194 195
    assert_sane_parameters "empty reposdir is ok"
195 196
 
197
+   local absolute
198
+
199
+   absolute="`read_config_setting "absolute_symlinks" "NO"`"
200
+   exekutor create_symlink "${url}" "${stashdir}" "${absolute}"
201
+
196 202
    local branchlabel
197 203
 
198 204
    branchlabel="branch"
... ...
@@ -202,42 +208,6 @@ link_command()
202 208
       branch="${tag}"
203 209
    fi
204 210
 
205
-   local srcname
206
-   local linkname
207
-   local directory
208
-
209
-   srcname="`basename -- ${url}`"
210
-   linkname="`basename -- ${stashdir}`"
211
-   directory="`dirname -- "${stashdir}"`"
212
-
213
-   if [ "${MULLE_FLAG_EXECUTOR_DRY_RUN}" != "YES" ]
214
-   then
215
-      (
216
-         cd "${directory}" ;
217
-         if [ ! -e "${url}" ]
218
-         then
219
-            fail "${C_RESET}${C_BOLD}${url}${C_ERROR} does not exist ($PWD)"
220
-         fi
221
-      ) || exit 1
222
-   fi
223
-
224
-   #
225
-   # relative paths look nicer, but could fail in more complicated
226
-   # settings, when you symlink something, and that repo has symlinks
227
-   # itself
228
-   #
229
-   if read_yes_no_config_setting "absolute_symlinks" "NO"
230
-   then
231
-      local real
232
-
233
-      real="`( cd "${directory}" ; realpath "${url}")`" || fail "failed to get realpath of $url"
234
-      log_fluff "Converted symlink \"${url}\" to \"${real}\""
235
-      url="${real}"
236
-   fi
237
-
238
-   log_info "Symlinking ${C_MAGENTA}${C_BOLD}${srcname}${C_INFO} ..."
239
-   exekutor ln -s -f "${url}" "${stashdir}" || fail "failed to setup symlink \"${stashdir}\" (to \"${url}\")"
240
-
241 211
    if [ ! -z "${branch}" ]
242 212
    then
243 213
       log_warning "The intended ${branchlabel} ${C_RESET_BOLD}${branch}${C_WARNING} will be ignored, because"
... ...
@@ -256,7 +226,7 @@ ask_symlink_it()
256 226
 
257 227
    if [ ! -d "${clone}" ]
258 228
    then
259
-      fail "You need to check out ${clone} yourself, as it's not there."
229
+      fail "You need to check out \"${clone}\" yourself, as it's not there."
260 230
    fi
261 231
 
262 232
    #
... ...
@@ -317,8 +287,7 @@ Use --embedded-symlinks option to allow it"
317 287
 }
318 288
 
319 289
 
320
-
321
-_search_git_repo_in_directory()
290
+_search_for_repository_in_caches()
322 291
 {
323 292
    local directory
324 293
    local name
... ...
@@ -368,16 +337,14 @@ _search_git_repo_in_directory()
368 337
 }
369 338
 
370 339
 
371
-search_git_repo_in_parent_of_root()
340
+search_for_repository_in_caches()
372 341
 {
373 342
    local found
374
-   local directory
375 343
 
376
-   directory="`dirname -- "${ROOT_DIR}"`"
377
-   found="`_search_git_repo_in_directory "${directory}" "$@"`" || exit 1
344
+   found="`_search_for_repository_in_caches "${CACHES_DIR}" "$@"`" || exit 1
378 345
    if [ ! -z "${found}" ]
379 346
    then
380
-      _relative_path_between "${found}" "`pwd -P`"
347
+      symlink_relpath "${found}" "${ROOT_DIR}"
381 348
    fi
382 349
 }
383 350
 
... ...
@@ -398,13 +365,13 @@ mkdir_stashparent_if_missing()
398 365
          echo "${stashparent}"
399 366
       ;;
400 367
    esac
401
-
402 368
 }
403 369
 
370
+
404 371
 clone_or_symlink()
405 372
 {
406 373
    local reposdir="$1"  # ususally .bootstrap.repos
407
-   local name="$2"      # name of the clone
374
+   local name="$2"      # name of the clone, extensionless
408 375
    local url="$3"       # URL of the clone
409 376
    local branch="$4"    # branch of the clone
410 377
    local scm="$5"       # scm to use for this clone
... ...
@@ -437,7 +404,6 @@ clone_or_symlink()
437 404
 
438 405
    stashparent="`mkdir_stashparent_if_missing "${stashdir}"`"
439 406
 
440
-
441 407
    local found
442 408
    local script
443 409
 
... ...
@@ -449,14 +415,6 @@ clone_or_symlink()
449 415
       return $?
450 416
    fi
451 417
 
452
-   local relative
453
-   local name2
454
-
455
-   relative="`compute_relative "${stashparent}"`"
456
-   [ ! -z "${relative}" ] && relative="${relative}/"
457
-
458
-   name2="`basename -- "${url}"`"  # only works for git really
459
-
460 418
    case "${url}" in
461 419
       /*)
462 420
          if ask_symlink_it "${url}"
... ...
@@ -475,10 +433,10 @@ clone_or_symlink()
475 433
       *)
476 434
          if [ "${OPTION_ALLOW_SEARCH_PARENT}" = "YES" ]
477 435
          then
478
-            found="`search_git_repo_in_parent_of_root "${name}" "${branch}"`"
436
+            found="`search_for_repository_in_caches "${name}" "${branch}"`"
479 437
             if [ -z "${found}" ]
480 438
             then
481
-               found="`search_git_repo_in_parent_of_root "${name2}" "${branch}"`"
439
+               found="`search_for_repository_in_caches "${name}.git" "${branch}"`"
482 440
             fi
483 441
 
484 442
             if [ ! -z "${found}" ]
... ...
@@ -493,10 +451,7 @@ clone_or_symlink()
493 451
                   if [ $? -eq 0 ]
494 452
                   then
495 453
                      operation=link_command
496
-                     url="${relative}${found}"
497 454
                   fi
498
-
499
-                  log_info "Using ${C_MAGENTA}${C_BOLD}${found}${C_INFO} as URL"
500 455
                fi
501 456
             fi
502 457
          fi
... ...
@@ -552,7 +507,7 @@ _clone()
552 507
 should be a minion but it isn't.
553 508
 Suggested fix:
554 509
    ${C_RESET}${C_BOLD}cd \"${stashdir}\" ; mulle-bootstrap defer \"\
555
-`perfect_relative_path_between "${PWD}" "${stashdir}"`\
510
+`symlink_relpath "${PWD}" "${stashdir}"`\
556 511
 \""
557 512
             log_info "${C_MAGENTA}${C_BOLD}${name}${C_INFO} is a minion, so cloning is skipped"
558 513
             return 1
... ...
@@ -630,61 +585,9 @@ checkout_repository()
630 585
 }
631 586
 
632 587
 
633
-##
634
-## PULL
635
-##
636
-_pull()
637
-{
638
-   local reposdir="$1"  # ususally .bootstrap.repos
639
-   local name="$2"      # name of the clone
640
-   local url="$3"       # URL of the clone
641
-   local branch="$4"    # branch of the clone
642
-   local scm="$5"       # scm to use for this clone
643
-   local tag="$6"       # tag to checkout of the clone
644
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
645
-
646
-   local operation
647
-
648
-   case "${scm}" in
649
-      git|"" )
650
-         operation="git_pull"
651
-      ;;
652
-      svn)
653
-         operation="svn_update"
654
-      ;;
655
-      *)
656
-         fail "Unknown scm system ${scm}"
657
-      ;;
658
-   esac
659
-
660
-   script="`find_build_setting_file "${name}" "bin/pull.sh"`"
661
-   if [ ! -z "${script}" ]
662
-   then
663
-      fetch__run_script "${script}" "$@"
664
-   else
665
-      "${operation}" "$@"
666
-   fi
667
-}
668
-
669
-
670
-update_repository()
671
-{
672
-   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
673
-
674
-   if [ -L "${stashdir}" -a "${OPTION_ALLOW_FOLLOWING_SYMLINKS}" != "YES" ]
675
-   then
676
-      echo "Ignoring ${stashdir} because it's a symlink"
677
-      return
678
-   fi
679
-
680
-   log_action "pull" "$@"
681
-
682
-   _update "$@"
683
-}
684
-
685
-
686 588
 ##
687 589
 ## UPDATE
590
+## this like git fetch, does not update repository
688 591
 ##
689 592
 
690 593
 _update()
... ...
@@ -723,15 +626,23 @@ _update()
723 626
 
724 627
 update_repository()
725 628
 {
629
+   if [ -L "${stashdir}" -a "${OPTION_ALLOW_FOLLOWING_SYMLINKS}" != "YES" ]
630
+   then
631
+      log_fluff "Ignoring ${stashdir} because it's a symlink"
632
+      return
633
+   fi
634
+
726 635
    log_action "update" "$@"
727 636
 
728
-   _update "$@"
637
+   _update "$@" > /dev/null
638
+
639
+   echo "${clone}"  # hackish
729 640
 }
730 641
 
731 642
 
732 643
 ##
733
-## UPDATE
734
-##
644
+## UPGRADE
645
+## This is a pull
735 646
 
736 647
 _upgrade()
737 648
 {
... ...
@@ -769,9 +680,17 @@ _upgrade()
769 680
 
770 681
 upgrade_repository()
771 682
 {
683
+   if [ -L "${stashdir}" -a "${OPTION_ALLOW_FOLLOWING_SYMLINKS}" != "YES" ]
684
+   then
685
+      log_fluff "Ignoring ${stashdir} because it's a symlink"
686
+      return
687
+   fi
688
+
772 689
    log_action "upgrade" "$@"
773 690
 
774
-   _upgrade "$@"
691
+   _upgrade "$@" > /dev/null
692
+
693
+   echo "${clone}"  # hackish
775 694
 }
776 695
 
777 696
 
... ...
@@ -815,13 +734,14 @@ _operation_walk_embedded_repositories()
815 734
    # stashes (for backwards compatibility)
816 735
    #
817 736
    (
818
-      STASHES_DIR="" ;
737
+      STASHES_ROOT_DIR=""
738
+      STASHES_DEFAULT_DIR=""
819 739
       OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
820 740
 
821 741
       walk_repositories "embedded_repositories"  \
822 742
                         "${operation}" \
823 743
                         "${permissions}" \
824
-                        "${REPOS_DIR}/.embedded"
744
+                        "${EMBEDDED_REPOS_DIR}"
825 745
    ) || exit 1
826 746
 }
827 747
 
... ...
@@ -963,9 +883,11 @@ required_action_for_clone()
963 883
 
964 884
    parse_clone "${clone}"
965 885
 
966
-   if is_minion_bootstrap_directory "${stashdir}"
886
+   if is_minion_bootstrap_project "${stashdir}"
967 887
    then
968
-      fail "\"${stashdir}\" is a minion. Don't hand edit master repositories."
888
+      log_fluff "\"${stashdir}\" is a minion. Ignoring possible differences."
889
+      echo "ignore"
890
+      return
969 891
    fi
970 892
 
971 893
    if [ "${scm}" != "${newscm}" ]
... ...
@@ -976,12 +898,6 @@ clone"
976 898
       return
977 899
    fi
978 900
 
979
-   if [ "${stashdir}" != "${newstashdir}" ]
980
-   then
981
-      log_fluff "Destination has changed from \"${stashdir}\" to \"${newstashdir}\", need to move"
982
-      echo "move"
983
-   fi
984
-
985 901
    #
986 902
    # if scm is not git, don't try to be clever
987 903
    #
... ...
@@ -992,17 +908,16 @@ clone"
992 908
       return
993 909
    fi
994 910
 
995
-   if [ "${scm}" != "${newscm}" ]
911
+   if [ "${stashdir}" != "${newstashdir}" ]
996 912
    then
997
-      echo "remove
998
-clone"
999
-      return
913
+      log_fluff "Destination has changed from \"${stashdir}\" to \"${newstashdir}\", need to move"
914
+      echo "move"
1000 915
    fi
1001 916
 
1002 917
    if [ "${branch}" != "${newbranch}" ]
1003 918
    then
1004 919
       log_fluff "Branch has changed from \"${branch}\" to \"${newbranch}\", need to fetch"
1005
-      echo "pull"
920
+      echo "upgrade"
1006 921
    fi
1007 922
 
1008 923
    if [ "${tag}" != "${newtag}" ]
... ...
@@ -1015,8 +930,38 @@ clone"
1015 930
    then
1016 931
       log_fluff "URL has changed from \"${url}\" to \"${newurl}\", need to set remote url and fetch"
1017 932
       echo "set-remote"
1018
-      echo "pull"
933
+      echo "upgrade"
934
+   fi
935
+}
936
+
937
+
938
+get_old_stashdir()
939
+{
940
+   local reposdir="$1"
941
+   local name="$2"
942
+
943
+   local oldstashdir
944
+
945
+   oldstashdir="`stash_of_repository "${reposdir}" "${name}"`"
946
+
947
+   if [ ! -d "${oldstashdir}" ]
948
+   then
949
+      local dstdir
950
+      local url
951
+      local name
952
+      local oldclone
953
+
954
+      oldclone="`clone_of_repository "${reposdir}" "${name}"`"
955
+      [ -z "${oldclone}" ] && fail "Old clone information for \"${name}\" in \"${reposdir}\" is missing"
956
+
957
+      dstdir="`_dstdir_part_from_clone "${oldclone}"`"
958
+      url="`_url_part_from_clone "${oldclone}"`"
959
+      name="`_canonical_clone_name "${url}"`"
960
+
961
+      oldstashdir="`computed_stashdir "${url}" "${name}" "${dstdir}"`"
1019 962
    fi
963
+
964
+   echo "${oldstashdir}"
1020 965
 }
1021 966
 
1022 967
 
... ...
@@ -1036,6 +981,7 @@ work_clones()
1036 981
 
1037 982
    local actionitems
1038 983
    local fetched
984
+   local remember
1039 985
    local repotype
1040 986
    local oldstashdir
1041 987
    local url_is_stash
... ...
@@ -1083,16 +1029,18 @@ work_clones()
1083 1029
                                               "${tag}" \
1084 1030
                                               "${stashdir}"`" || exit 1
1085 1031
 
1032
+      log_fluff "Actions for \"${name}\": ${actionitems}"
1033
+
1086 1034
       IFS="
1087 1035
 "
1088 1036
       for item in ${actionitems}
1089 1037
       do
1090 1038
          IFS="${DEFAULT_IFS}"
1091 1039
 
1040
+         remember="YES"
1041
+
1092 1042
          case "${item}" in
1093 1043
             "checkout")
1094
-               log_verbose "Checking out \"${tag}\" in ${repotype}\"`absolutepath ${stashdir}`\""
1095
-
1096 1044
                checkout_repository "${reposdir}" \
1097 1045
                                    "${name}" \
1098 1046
                                    "${url}" \
... ...
@@ -1103,8 +1051,6 @@ work_clones()
1103 1051
             ;;
1104 1052
 
1105 1053
             "clone")
1106
-               log_verbose "Cloning \"${url}\" into ${repotype}\"`absolutepath ${stashdir}`\""
1107
-
1108 1054
                if clone_repository "${reposdir}" \
1109 1055
                                    "${name}" \
1110 1056
                                    "${url}" \
... ...
@@ -1117,34 +1063,41 @@ work_clones()
1117 1063
                fi
1118 1064
             ;;
1119 1065
 
1066
+            "ignore")
1067
+               remember="NO"
1068
+            ;;
1069
+
1120 1070
             "move")
1121
-               oldstashdir="`stash_of_repository "${reposdir}" "${name}"`"
1122
-               log_verbose "Moving ${repotype}stash \"${name}\" from \"${oldstashdir}\" to \"`absolutepath ${stashdir}`\""
1071
+               oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1123 1072
 
1124
-               exekutor mv ${COPYMOVEFLAGS} "${oldstashdir}" "${stashdir}"
1125
-            ;;
1073
+               log_info "Moving ${repotype}stash ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"${oldstashdir}\" to \"${stashdir}\""
1126 1074
 
1127
-            "pull")
1128
-               log_verbose "Pulling from \"${url}\" into ${repotype}\"`absolutepath ${stashdir}`\""
1075
+               if ! exekutor mv ${COPYMOVETARFLAGS} "${oldstashdir}" "${stashdir}"
1076
+               then
1077
+                  fail "Move failed!"
1078
+               fi
1079
+            ;;
1129 1080
 
1130
-               pull_repository "${reposdir}" \
1131
-                               "${name}" \
1132
-                               "${url}" \
1133
-                               "${branch}" \
1134
-                               "${scm}" \
1135
-                               "${tag}" \
1136
-                               "${stashdir}"
1081
+            "upgrade")
1082
+               upgrade_repository "${reposdir}" \
1083
+                                  "${name}" \
1084
+                                  "${url}" \
1085
+                                  "${branch}" \
1086
+                                  "${scm}" \
1087
+                                  "${tag}" \
1088
+                                  "${stashdir}" > /dev/null
1137 1089
             ;;
1138 1090
 
1139 1091
             "remove")
1140
-               log_verbose "Removing old ${repotype}stash \"`absolutepath ${oldstashdir}`\""
1092
+               oldstashdir="`get_old_stashdir "${reposdir}" "${name}"`"
1093
+
1094
+               log_info "Removing old ${repotype}stash ${C_MAGENTA}${C_BOLD}${oldstashdir}${C_INFO}"
1141 1095
 
1142
-               oldstashdir="`stash_of_repository "${reposdir}" "${name}"`"
1143 1096
                rmdir_safer "${oldstashdir}"
1144 1097
             ;;
1145 1098
 
1146 1099
             "set-remote")
1147
-               log_verbose "Changing ${repotype}remote to \"${url}\""
1100
+               log_info "Changing ${repotype}remote to \"${url}\""
1148 1101
 
1149 1102
                local remote
1150 1103
 
... ...
@@ -1164,44 +1117,24 @@ work_clones()
1164 1117
 
1165 1118
       if [ "${autoupdate}" = "YES" ]
1166 1119
       then
1167
-         bootstrap_auto_update "${stashdir}"
1120
+         bootstrap_auto_update "${name}" "${stashdir}"
1168 1121
       fi
1169 1122
 
1170 1123
       #
1171
-      # always remember, what we have now
1124
+      # always remember, what we have now (except if its a minion)
1172 1125
       #
1173
-      remember_stash_of_repository "${clone}" \
1174
-                                   "${reposdir}" \
1175
-                                   "${name}"  \
1176
-                                   "${url}" \
1177
-                                   "${branch}" \
1178
-                                   "${scm}" \
1179
-                                   "${tag}" \
1180
-                                   "${stashdir}"
1181
-
1182
-      mark_stash_as_alive "${reposdir}" "${name}"
1183
-
1184
-      if [ ! -L "${stashdir}" -o "${OPTION_ALLOW_FOLLOWING_SYMLINKS}" = "YES" ]
1126
+      if [ "${remember}" = "YES" ]
1185 1127
       then
1186
-         (
1187
-            local embedded_clones;
1188
-
1189
-            OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1190
-            MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES" ;
1191
-            STASHES_DIR=""
1192
-
1193
-            cd_physical "${stashdir}" &&
1194
-            embedded_clones="`read_root_setting "embedded_repositories"`" &&
1195
-            work_clones "${REPOS_DIR}/.embedded" "${embedded_clones}" "NO"  > /dev/null
1196
-         ) || exit 1
1197
-      else
1198
-         log_fluff "Not following \"${stashdir}\" to embedded repositories of \"${name}\" because it's a symlink"
1199
-         # but need to mark them as alive
1200
-         (
1201
-            cd_physical "${stashdir}" &&
1202
-            mark_all_stashes_as_alive "${REPOS_DIR}/.embedded"
1203
-         ) || exit 1
1128
+         remember_stash_of_repository "${clone}" \
1129
+                                      "${reposdir}" \
1130
+                                      "${name}"  \
1131
+                                      "${url}" \
1132
+                                      "${branch}" \
1133
+                                      "${scm}" \
1134
+                                      "${tag}" \
1135
+                                      "${stashdir}"
1204 1136
       fi
1137
+      mark_stash_as_alive "${reposdir}" "${name}"
1205 1138
    done
1206 1139
 
1207 1140
    IFS="${DEFAULT_IFS}"
... ...
@@ -1212,68 +1145,115 @@ work_clones()
1212 1145
    fi
1213 1146
 }
1214 1147
 
1215
-
1216 1148
 #
1217 1149
 #
1218 1150
 #
1219
-work_all_repositories()
1151
+fetch_once_embedded_repositories()
1220 1152
 {
1221
-   local fetched
1222
-   local all_fetched
1223
-   local loops
1153
+   log_fluff "fetch_once_embedded_repositories"
1154
+   (
1155
+      STASHES_DEFAULT_DIR=""
1156
+      STASHES_ROOT_DIR=""
1157
+      OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1224 1158
 
1225
-   local before
1226
-   local after
1159
+      local clones
1160
+
1161
+      clones="`read_root_setting "embedded_repositories"`" ;
1162
+      work_clones "${EMBEDDED_REPOS_DIR}" "${clones}" "NO" > /dev/null
1163
+   ) || exit 1
1164
+}
1165
+
1166
+
1167
+_fetch_once_deep_repository()
1168
+{
1169
+   local reposdir="$1"  # ususally .bootstrap.repos
1170
+   local name="$2"      # name of the clone
1171
+   local url="$3"       # URL of the clone
1172
+   local branch="$4"    # branch of the clone
1173
+   local scm="$5"       # scm to use for this clone
1174
+   local tag="$6"       # tag to checkout of the clone
1175
+   local stashdir="$7"  # stashdir of this clone (absolute or relative to $PWD)
1176
+
1177
+   local autodir
1178
+
1179
+   autodir="${BOOTSTRAP_DIR}.auto/.deep/${name}.d"
1180
+
1181
+   if [ ! -d "${autodir}" ]
1182
+   then
1183
+      return
1184
+   fi
1227 1185
 
1186
+   reposdir="${reposdir}/.deep/${name}.d"
1228 1187
    (
1229
-      STASHES_DIR="" ;
1188
+      STASHES_DEFAULT_DIR=""
1189
+      STASHES_ROOT_DIR="${stashdir}"
1230 1190
       OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
1231 1191
 
1232
-      before="`read_root_setting "embedded_repositories"`" ;
1233
-      work_clones "${REPOS_DIR}/.embedded" "${before}" "NO"
1192
+      local clones
1193
+
1194
+      clones="`_read_setting "${autodir}/embedded_repositories" "embedded_repositories"`" ;
1195
+      work_clones "${reposdir}" "${clones}" "NO" > /dev/null
1234 1196
    ) || exit 1
1197
+}
1235 1198
 
1236
-   [  -z "${STASHES_DIR}" ] && internal_fail "hein"
1237 1199
 
1238
-   if [ -z "${OPTION_EMBEDDED_ONLY}" ]
1239
-   then
1240
-      loops=""
1241
-      before=""
1200
+fetch_once_deep_embedded_repositories()
1201
+{
1202
+   log_fluff "fetch_once_deep_embedded_repositories"
1242 1203
 
1243
-      __IGNORE__=""
1204
+   _operation_walk_repositories "_fetch_once_deep_repository"
1205
+}
1244 1206
 
1245
-      while :
1246
-      do
1247
-         loops="${loops}X"
1248
-         case "${loops}" in
1249
-            XXXXXXXXXXXXXXXX)
1250
-               internal_fail "Loop overflow in worker loop"
1251
-            ;;
1252
-         esac
1253 1207
 
1254
-         after="${before}"
1255
-         before="`read_root_setting "repositories" | sed 's/[ \t]*$//' | sort`"
1256
-         if [ "${after}" = "${before}" ]
1257
-         then
1258
-            log_fluff "Repositories file is unchanged, so done"
1259
-            break
1260
-         fi
1208
+fetch_loop_repositories()
1209
+{
1210
+   local fetched
1211
+   local all_fetched
1212
+   local loops
1213
+
1214
+   local before
1215
+   local after
1261 1216
 
1262
-         __REFRESHED__=""
1217
+   log_fluff "fetch_loop_repositories"
1263 1218
 
1264
-         fetched="`work_clones "${REPOS_DIR}" "${before}" "YES"`" || exit 1
1265
-         all_fetched="`add_line "${all_fetched}" "${fetched}"`"
1219
+   loops=""
1220
+   before=""
1266 1221
 
1267
-         __IGNORE__="`add_line "${__IGNORE__}" "${__REFRESHED__}"`"
1222
+   __IGNORE__=""
1268 1223
 
1269
-         log_fluff "Get back in the ring to take another swing"
1270
-      done
1224
+   while :
1225
+   do
1226
+      loops="${loops}X"
1227
+      case "${loops}" in
1228
+         XXXXXXXXXXXXXXXX)
1229
+            internal_fail "Loop overflow in worker loop"
1230
+         ;;
1231
+      esac
1271 1232
 
1272
-      if [ ! -z "${fetched}" ]
1233
+      after="${before}"
1234
+      before="`read_root_setting "repositories" | sed 's/[ \t]*$//' | sort`"
1235
+      if [ "${after}" = "${before}" ]
1273 1236
       then
1274
-         echo "${fetched}"
1237
+         log_fluff "Repositories file is unchanged, so done"
1238
+         break
1275 1239
       fi
1240
+
1241
+      __REFRESHED__=""
1242
+
1243
+      fetched="`work_clones "${REPOS_DIR}" "${before}" "YES"`" || exit 1
1244
+      all_fetched="`add_line "${all_fetched}" "${fetched}"`"
1245
+
1246
+      __IGNORE__="`add_line "${__IGNORE__}" "${__REFRESHED__}"`"
1247
+
1248
+      log_fluff "Get back in the ring to take another swing"
1249
+   done
1250
+
1251
+   if [ ! -z "${fetched}" ]
1252
+   then
1253
+      echo "${fetched}"
1276 1254
    fi
1255
+
1256
+   :
1277 1257
 }
1278 1258
 
1279 1259
                       #----#
... ...
@@ -1351,7 +1331,13 @@ fetch_loop()
1351 1331
 
1352 1332
    bootstrap_auto_create
1353 1333
 
1354
-   fetched="`work_all_repositories`" || exit 1
1334
+   fetch_once_embedded_repositories
1335
+
1336
+   if [ -z "${OPTION_EMBEDDED_ONLY}" ]
1337
+   then
1338
+      fetched="`fetch_loop_repositories`" || exit 1
1339
+      fetch_once_deep_embedded_repositories
1340
+   fi
1355 1341
 
1356 1342
    bootstrap_auto_final
1357 1343
 
... ...
@@ -1370,7 +1356,7 @@ _common_fetch()
1370 1356
 {
1371 1357
    local fetched
1372 1358
 
1373
-   fetched="`fetch_loop "${REPOS_DIR}"`" || exit 1
1359
+   fetched="`fetch_loop "${REPOS_DIR}"`"
1374 1360
 
1375 1361
    #
1376 1362
    # do this afterwards, because brews will have been composited
... ...
@@ -1396,14 +1382,14 @@ _common_update()
1396 1382
       ;;
1397 1383
    esac
1398 1384
 
1399
-   update_embedded_repositories
1385
+   update_embedded_repositories > /dev/null
1400 1386
    if [ ! -z "${OPTION_EMBEDDED_ONLY}" ]
1401 1387
    then
1402 1388
       return
1403 1389
    fi
1404 1390
 
1405
-   update_repositories "$@"
1406
-   update_deep_embedded_repositories
1391
+   update_repositories "$@" > /dev/null
1392
+   update_deep_embedded_repositories > /dev/null
1407 1393
 }
1408 1394
 
1409 1395
 
... ...
@@ -1490,7 +1476,7 @@ _common_main()
1490 1476
 
1491 1477
          -cs|--check-usr-local-include)
1492 1478
             OPTION_CHECK_USR_LOCAL_INCLUDE="YES"
1493
-            ;;
1479
+         ;;
1494 1480
 
1495 1481
          -e|--embedded-only)
1496 1482
             OPTION_EMBEDDED_ONLY="YES"
... ...
@@ -1513,7 +1499,6 @@ _common_main()
1513 1499
             OPTION_ALLOW_CREATING_SYMLINKS=
1514 1500
          ;;
1515 1501
 
1516
-
1517 1502
          # build options with no parameters
1518 1503
          -K|--clean|-k|--no-clean|--use-prefix-libraries|--debug|--release)
1519 1504
             if [ -z "${MULLE_BOOTSTRAP_WILL_BUILD}" ]
... ...
@@ -1552,12 +1537,11 @@ _common_main()
1552 1537
       shift
1553 1538
    done
1554 1539
 
1555
-
1540
+   [ -z "${MULLE_BOOTSTRAP_AUTO_UPDATE_SH}" ]     && . mulle-bootstrap-auto-update.sh
1556 1541
    [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
1557 1542
    [ -z "${MULLE_BOOTSTRAP_SCM_SH}" ]             && . mulle-bootstrap-scm.sh
1558 1543
    [ -z "${MULLE_BOOTSTRAP_SCRIPTS_SH}" ]         && . mulle-bootstrap-scripts.sh
1559 1544
    [ -z "${MULLE_BOOTSTRAP_WARN_SCRIPTS_SH}" ]    && . mulle-bootstrap-warn-scripts.sh
1560
-   [ -z "${MULLE_BOOTSTRAP_AUTO_UPDATE_SH}" ]     && . mulle-bootstrap-auto-update.sh
1561 1545
    [ -z "${MULLE_BOOTSTRAP_ZOMBIFY_SH}" ]         && . mulle-bootstrap-zombify.sh
1562 1546
 
1563 1547
    #
... ...
@@ -1625,10 +1609,6 @@ _common_main()
1625 1609
    [ -z "${DEFAULT_IFS}" ] && internal_fail "IFS fail"
1626 1610
 
1627 1611
    case "${COMMAND}" in
1628
-      fetch)
1629
-         _common_fetch "$@"
1630
-      ;;
1631
-
1632 1612
       update)
1633 1613
          _common_update "$@"
1634 1614
       ;;
... ...