Browse code

With hindsight, v0.15 and v0.16 were trash. Fixed.

Nat! authored on 25-02-2016 19:08:48
Showing 4 changed files
... ...
@@ -1,3 +1,9 @@
1
+0.17
2
+===
3
+   Fixed the broken inheritance. The "Always redo bootstrap.auto folder
4
+   on fetch" fix in 0.15, was in the wrong position. So 0.15 and 0.16 are
5
+   totally broken releases. Sorry.
6
+
1 7
 0.16
2 8
 ===
3 9
    Fixed misnamed exekutor.
... ...
@@ -29,7 +29,7 @@
29 29
 #   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 
32
-VERSION=0.16
32
+VERSION=0.17
33 33
 
34 34
 #
35 35
 # This is the main user interface to mulle-bootstrap
... ...
@@ -60,17 +60,17 @@ check_and_usage_and_help()
60 60
 {
61 61
    case "$COMMAND" in
62 62
       install)
63
-      ;;
63
+         ;;
64 64
       nonrecursive)
65 65
         COMMAND=install
66 66
         DONT_RECURSE="YES"
67
-      ;;
68
-      update)
69
-      ;;
67
+         ;;
68
+         update)
69
+         ;;
70 70
       *)
71
-      usage >&2
72
-      exit 1
73
-      ;;
71
+         usage >&2
72
+         exit 1
73
+         ;;
74 74
    esac
75 75
 }
76 76
 
... ...
@@ -264,6 +264,7 @@ install_pips()
264 264
    fi
265 265
 }
266 266
 
267
+
267 268
 #
268 269
 ###
269 270
 #
... ...
@@ -369,28 +370,29 @@ gems
369 370
 settings/build_order
370 371
 settings/build_ignore'
371 372
 
373
+
372 374
 bootstrap_auto_update()
373 375
 {
374 376
    local name
375 377
    local url
376
-   local dir
378
+   local directory
377 379
 
378 380
    name="$1"
379 381
    url="$2"
380
-   dir="$3"
382
+   directory="$3"
381 383
 
382
-   [ ! -z "${dir}" ]        || internal_fail "src was empty"
383
-   [ "${PWD}" != "${dir}" ] || internal_fail "configuration error"
384
+   [ ! -z "${directory}" ]        || internal_fail "src was empty"
385
+   [ "${PWD}" != "${directory}" ] || internal_fail "configuration error"
384 386
 
385 387
 
386 388
    # contains own bootstrap ? and not a symlink
387
-   if [ ! -d "${dir}/.bootstrap" ] # -a ! -L "${dst}" ]
389
+   if [ ! -d "${directory}/.bootstrap" ] # -a ! -L "${dst}" ]
388 390
    then
389
-      log_fluff "no .bootstrap folder in \"${dir}\" found"
391
+      log_fluff "no .bootstrap folder in \"${directory}\" found"
390 392
       return 1
391 393
    fi
392 394
 
393
-   log_info "Recursively acquiring ${dir} .bootstrap settings ..."
395
+   log_info "Recursively acquiring ${directory} .bootstrap settings ..."
394 396
 
395 397
    local old
396 398
    local name
... ...
@@ -398,39 +400,40 @@ bootstrap_auto_update()
398 400
    old="${IFS:-" "}"
399 401
 
400 402
    #
401
-   # if an auto folder exists it could be stale, due to user edits
402
-   # it's better to completely redo it
403
+   # prepare auto folder if it doesn't exist yet
404
+   # means copy our own files to .auto first,
403 405
    #
406
+   if [ ! -d "${BOOTSTRAP_SUBDIR}.auto" ]
407
+   then
408
+      log_info "Found a .bootstrap folder for \"${name}\" will set up ${BOOTSTRAP_SUBDIR}.auto"
404 409
 
405
-   mkdir_if_missing "${BOOTSTRAP_SUBDIR}.tmp/settings"
410
+      mkdir_if_missing "${BOOTSTRAP_SUBDIR}.tmp/settings"
406 411
 
407
-   IFS="
412
+      IFS="
408 413
 "
409
-   for i in $INHERIT_SETTINGS
410
-   do
411
-      IFS="${old}"
412
-      if [ -f "${BOOTSTRAP_SUBDIR}.local/${i}" ]
413
-      then
414
-         exekutor cp "${BOOTSTRAP_SUBDIR}.local/${i}" "${BOOTSTRAP_SUBDIR}.tmp/${i}" || exit 1
415
-      else
416
-         if [ -f "${BOOTSTRAP_SUBDIR}/${i}" ]
414
+      for i in $INHERIT_SETTINGS
415
+      do
416
+         IFS="${old}"
417
+         if [ -f "${BOOTSTRAP_SUBDIR}.local/${i}" ]
417 418
          then
418
-            exekutor cp "${BOOTSTRAP_SUBDIR}/${i}" "${BOOTSTRAP_SUBDIR}.tmp/${i}" || exit 1
419
+            exekutor cp "${BOOTSTRAP_SUBDIR}.local/${i}" "${BOOTSTRAP_SUBDIR}.tmp/${i}" || exit 1
419 420
          else
420
-            name="`basename -- "${i}"`"
421
-            log_fluff "Setting \"${name}\" is not specified, so not inherited"
421
+            if [ -f "${BOOTSTRAP_SUBDIR}/${i}" ]
422
+            then
423
+               exekutor cp "${BOOTSTRAP_SUBDIR}/${i}" "${BOOTSTRAP_SUBDIR}.tmp/${i}" || exit 1
424
+            else
425
+               name="`basename -- "${i}"`"
426
+               log_fluff "Setting \"${name}\" is not specified, so not inherited"
427
+            fi
422 428
          fi
423
-      fi
424
-   done
425
-   IFS="${old}"
429
+      done
430
+      IFS="${old}"
426 431
 
427
-   # now move it
428
-   if [ -d "${BOOTSTRAP_SUBDIR}.auto" ]
429
-   then
430
-      exekutor rm -rf  "${BOOTSTRAP_SUBDIR}.auto"
431
-   fi
432
-   exekutor mv "${BOOTSTRAP_SUBDIR}.tmp" "${BOOTSTRAP_SUBDIR}.auto" || exit 1
432
+      # now move it
433
+      exekutor mv "${BOOTSTRAP_SUBDIR}.tmp" "${BOOTSTRAP_SUBDIR}.auto" || exit 1
433 434
 
435
+      # leave .scm files behind
436
+   fi
434 437
 
435 438
    #
436 439
    # prepend new contents to old contents
... ...
@@ -439,24 +442,21 @@ bootstrap_auto_update()
439 442
    local srcfile
440 443
    local dstfile
441 444
    local i
442
-   local settingname
443
-   local directory
444 445
 
445 446
    IFS="
446 447
 "
447 448
    for i in $INHERIT_SETTINGS
448 449
    do
449 450
       IFS="{old}"
450
-      srcfile="${dir}/.bootstrap/${i}"
451
+      srcfile="${directory}/.bootstrap/${i}"
451 452
       dstfile="${BOOTSTRAP_SUBDIR}.auto/${i}"
452
-      settingname="`basename -- "${i}"`"
453
+      name="`basename -- "${i}"`"
453 454
 
454 455
       if [ -f "${srcfile}" ]
455 456
       then
456
-         log_fluff "Inheriting \"${settingname}\" from \"${srcfile}\""
457
+         log_fluff "Inheriting \"${name}\" from \"${srcfile}\""
457 458
 
458
-         directory="`dirname -- "${i}"`"
459
-         mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/${directory}"
459
+         mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/`dirname -- "${i}"`"
460 460
          if [ -f "${BOOTSTRAP_SUBDIR}.auto/${i}" ]
461 461
          then
462 462
             local tmpfile
... ...
@@ -470,7 +470,7 @@ bootstrap_auto_update()
470 470
             exekutor cp "${srcfile}" "${dstfile}" || exit 1
471 471
          fi
472 472
       else
473
-         log_fluff "Setting \"${settingname}\" is not specified, so not inherited"
473
+         log_fluff "Setting \"${name}\" is not specified, so not inherited"
474 474
       fi
475 475
    done
476 476
    IFS="{old}"
... ...
@@ -479,30 +479,30 @@ bootstrap_auto_update()
479 479
    local relative
480 480
 
481 481
    relative="`compute_relative "${BOOTSTRAP_SUBDIR}"`"
482
-   exekutor find "${dir}/.bootstrap" -xdev -mindepth 1 -maxdepth 1 -name "*.scm" -type f -print0 | \
482
+   exekutor find "${directory}/.bootstrap" -xdev -mindepth 1 -maxdepth 1 -name "*.scm" -type f -print0 | \
483 483
          exekutor xargs -0 -I % ln -s -f "${relative}/../"% "${BOOTSTRAP_SUBDIR}.auto/${name}"
484 484
 
485 485
    #
486 486
    # link up other non-inheriting settings
487 487
    #
488
-   if dir_has_files "${dir}/.bootstrap/settings"
488
+   if dir_has_files "${directory}/.bootstrap/settings"
489 489
    then
490 490
       local relative
491 491
 
492 492
       log_fluff "Link up build settings of \"${name}\" to \"${BOOTSTRAP_SUBDIR}.auto/settings/${name}\""
493 493
 
494
-      mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/settings"
495
-      exekutor find "${dir}/.bootstrap/settings" -xdev -mindepth 1 -maxdepth 1 -type f -print0 | \
494
+      mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
495
+      exekutor find "${directory}/.bootstrap/settings" -xdev -mindepth 1 -maxdepth 1 -type f -print0 | \
496 496
          exekutor xargs -0 -I % ln -s -f "${relative}/../../"% "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
497 497
 
498
-      if [ -e "${dir}/.bootstrap/settings/bin"  ]
498
+      if [ -e "${directory}/.bootstrap/settings/bin"  ]
499 499
       then
500
-         exekutor ln -s -f "${relative}/../../${dir}/.bootstrap/settings/bin" "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
500
+         exekutor ln -s -f "${relative}/../../${directory}/.bootstrap/settings/bin" "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
501 501
       fi
502 502
 
503 503
       # flatten other folders into our own settings
504 504
       # don't force though, keep first
505
-      exekutor find "${dir}/.bootstrap/settings" -xdev -mindepth 1 -maxdepth 1 -type d -print0 | \
505
+      exekutor find "${directory}/.bootstrap/settings" -xdev -mindepth 1 -maxdepth 1 -type d -print0 | \
506 506
          exekutor xargs -0 -I % ln -s "${relative}/../"% "${BOOTSTRAP_SUBDIR}.auto/settings"
507 507
    fi
508 508
 
... ...
@@ -1186,6 +1186,14 @@ main()
1186 1186
          exit 1
1187 1187
       fi
1188 1188
 
1189
+      #
1190
+      # remove .auto because it's contents could be stale
1191
+      #
1192
+      if [ -d "${BOOTSTRAP_SUBDIR}.auto" ]
1193
+      then
1194
+         exekutor rm -rf "${BOOTSTRAP_SUBDIR}.auto"
1195
+      fi
1196
+
1189 1197
       clone_repositories
1190 1198
 
1191 1199
       install_embedded_repositories
... ...
@@ -112,7 +112,7 @@ _read_setting()
112 112
       then
113 113
          local os
114 114
          os="`uname`"
115
-         log_fluff "${C_MAGENTA}`basename -- "${file}" ".${os}"`${C_FLUFF} found as \"${file}\""
115
+         log_fluff "${C_MAGENTA_BOLD}`basename -- "${file}" ".${os}"`${C_FLUFF} found as \"${file}\""
116 116
       fi
117 117
    else
118 118
       value=`egrep -v '^#|^[ ]*$' "${file}"`
... ...
@@ -120,7 +120,7 @@ _read_setting()
120 120
       then
121 121
          local os
122 122
          os="`uname`"
123
-         log_fluff "Setting ${C_MAGENTA}`basename -- "${file}" ".${os}"`${C_FLUFF} found in \"${file}\" as ${C_MAGENTA}${value}${C_FLUFF}"
123
+         log_fluff "Setting ${C_MAGENTA_BOLD}`basename -- "${file}" ".${os}"`${C_FLUFF} found in \"${file}\" as ${C_MAGENTA_BOLD}${value}${C_FLUFF}"
124 124
       fi
125 125
    fi
126 126