Browse code

* use a different mechanism for walking repositories during update/upgrade, to catch problems with embedded_repositories of minions not being updated * properly forget repositories being removed

Nat! authored on 16-10-2017 17:45:55
Showing 12 changed files
... ...
@@ -3,6 +3,7 @@
3 3
 *.chk
4 4
 *.bak
5 5
 *.old
6
+tmp.*
6 7
 *.xcworkspace
7 8
 xcuserdata/
8 9
 build/
... ...
@@ -19,65 +20,5 @@ tap-info.sh
19 20
 
20 21
 tutorial/*/.bootstrap
21 22
 
22
-tests/*/.bootstrap
23
-tests/*/main/
24
-tests/*/a/
25
-tests/*/b/
26
-tests/*/c/
27
-tests/*/d/
28
-tests/*/e/
29
-tests/*/f/
30
-tests/*/g/
31
-tests/*/h/
32
-mulle-mingw-cpp.exe
33
-tests/05-deep_embedded/log
34
-tests/05-deep_embedded/log1
35
-tests/05-deep_embedded/log2
36
-tests/07-embedded_symlink/checking
37
-tests/08-refresh/log
38
-tests/11-copy/a.tar
39
-tests/17-deep_embedded_environment/README.md
40
-tests/17-deep_embedded_environment/log
41
-tests/18-cmake/CMakeLists.txt
42
-tests/18-cmake/b.c
43
-tests/18-cmake/b.h
44
-tests/20-defer_embedded/Boobie/
45
-tests/20-defer_embedded/Foobie/
46
-tests/20-defer_embedded/Master/Minion/.bootstrap/embedded_repositories
47
-tests/20-defer_embedded/Master/Minion/.bootstrap/repositories
48
-tests/20-defer_embedded/Master/stashes/Foobie
49
-tests/20-defer_embedded/log
50
-tests/20-defer_embedded/log1
51
-tests/20-defer_embedded/log2
52
-tests/21-defer_advanced/Boobie/
53
-tests/21-defer_advanced/Foobie/
54
-tests/21-defer_advanced/Master/Minion/.bootstrap/embedded_repositories
55
-tests/21-defer_advanced/Master/Minion/.bootstrap/repositories
56
-tests/21-defer_advanced/Master/Minion/Boobie/
57
-tests/21-defer_advanced/Master/Minion2/.bootstrap/embedded_repositories
58
-tests/21-defer_advanced/Master/Minion2/.bootstrap/repositories
59
-tests/21-defer_advanced/Master/Minion2/Boobie/
60
-tests/21-defer_advanced/Master/stashes/Foobie
61
-tests/21-defer_advanced/README.md
62
-tests/21-defer_advanced/log
63
-tests/21-defer_advanced/log1
64
-tests/21-defer_advanced/log2
65
-tests/Boobie/
66
-tests/Foobie/
67
-tests/Master/Minion/.bootstrap/embedded_repositories
68
-tests/Master/Minion/.bootstrap/repositories
69
-tests/Master/Minion/Boobie/
70
-tests/Master/Minion2/.bootstrap/embedded_repositories
71
-tests/Master/Minion2/.bootstrap/repositories
72
-tests/Master/Minion2/Boobie/
73
-tests/Master/stashes/Foobie
74
-tests/a/b
75
-tests/a/c
76
-tests/b/
77
-tests/c/
78
-tests/d/
79
-tests/e/
80
-tests/f/
81
-tests/g/
82
-tests/h/
83
-package/
23
+tests/
24
+!*.sh
... ...
@@ -115,9 +115,10 @@ print_stashdir_repositories()
115 115
    local permissions
116 116
 
117 117
    permissions=""
118
-   walk_repos_repositories "${REPOS_DIR}" \
118
+   walk_repos_repositories "repositories" \
119 119
                            "_collect_stashdir" \
120
-                           "${permissions}"
120
+                           "${permissions}" \
121
+                           "${REPOS_DIR}" 
121 122
 }
122 123
 
123 124
 
... ...
@@ -126,9 +127,10 @@ print_embedded_stashdir_repositories()
126 127
    local permissions
127 128
 
128 129
    permissions=""
129
-   walk_repos_repositories "${EMBEDDED_REPOS_DIR}" \
130
+   walk_repos_repositories  "embedded_repositories" \
130 131
                             "_collect_stashdir" \
131
-                            "${permissions}"
132
+                            "${permissions}" \
133
+                            "${EMBEDDED_REPOS_DIR}" 
132 134
 }
133 135
 
134 136
 
... ...
@@ -137,8 +139,9 @@ print_stashdir_deep_embedded_repositories()
137 139
    local permissions
138 140
 
139 141
    permissions="minion"
140
-   walk_deep_embedded_repos_repositories "_collect_stashdir" \
141
-                                         "${permissions}"
142
+   walk_repos_deep_embedded_repositories "_collect_stashdir" \
143
+                                         "${permissions}" \
144
+                                         "${REPOS_DIR}"
142 145
 }
143 146
 
144 147
 
... ...
@@ -147,8 +150,9 @@ print_stashdir_deep_embedded_minion_repositories()
147 150
    local permissions
148 151
 
149 152
    permissions="minion"
150
-   walk_deep_embedded_minion_repositories "_collect_stashdir" \
151
-                                         "${permissions}"
153
+   walk_repos_deep_embedded_minion_repositories "_collect_stashdir" \
154
+                                                "${permissions}" \
155
+                                                "${REPOS_DIR}"
152 156
 }
153 157
 
154 158
 
... ...
@@ -775,29 +775,29 @@ upgrade_repository()
775 775
 
776 776
 #
777 777
 # Walk repositories with a callback function
778
+# update/upgrade use the actually fetched repositories
779
+# as present in reposdir
778 780
 #
779 781
 _update_operation_walk_repositories()
780 782
 {
783
+   log_debug "_update_operation_walk_repositories" "$@"
784
+
781 785
    local operation="$1"
782 786
 
783 787
    local permissions
784 788
 
785 789
    permissions="minion"
786
-   walk_auto_repositories "repositories"  \
787
-                          "${operation}" \
788
-                          "${permissions}" \
789
-                          "${REPOS_DIR}"
790
-
791
-   permissions="minion"
792
-   walk_auto_repositories "additional_repositories"  \
793
-                          "${operation}" \
794
-                          "${permissions}" \
795
-                          "${REPOS_DIR}"
790
+   walk_repos_repositories "repositories"  \
791
+                           "${operation}" \
792
+                           "${permissions}" \
793
+                           "${REPOS_DIR}"
796 794
 }
797 795
 
798 796
 
799 797
 _update_operation_walk_embedded_repositories()
800 798
 {
799
+   log_debug "_update_operation_walk_embedded_repositories" "$@"
800
+
801 801
    local operation="$1"
802 802
 
803 803
    local permissions
... ...
@@ -813,16 +813,18 @@ _update_operation_walk_embedded_repositories()
813 813
       STASHES_DEFAULT_DIR=""
814 814
       OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
815 815
 
816
-      walk_auto_repositories "embedded_repositories"  \
817
-                             "${operation}" \
818
-                             "${permissions}" \
819
-                             "${EMBEDDED_REPOS_DIR}"
816
+      walk_repos_repositories "embedded_repositories"  \
817
+                              "${operation}" \
818
+                              "${permissions}" \
819
+                              "${EMBEDDED_REPOS_DIR}"
820 820
    ) || exit 1
821 821
 }
822 822
 
823 823
 
824
-_update_operation_walk_deep_embedded_auto_repositories()
824
+_update_operation_walk_auto_deep_embedded_repositories()
825 825
 {
826
+   log_debug "_update_operation_walk_auto_deep_embedded_repositories" "$@"
827
+
826 828
    local operation="$1"
827 829
 
828 830
    local permissions
... ...
@@ -832,8 +834,8 @@ _update_operation_walk_deep_embedded_auto_repositories()
832 834
    (
833 835
       OPTION_ALLOW_CREATING_SYMLINKS="${OPTION_ALLOW_CREATING_EMBEDDED_SYMLINKS}" ;
834 836
 
835
-      walk_deep_embedded_auto_repositories "${operation}" \
836
-                                           "${permissions}"
837
+      walk_repos_deep_embedded_repositories "${operation}" \
838
+                                            "${permissions}"
837 839
    ) || exit 1
838 840
 }
839 841
 
... ...
@@ -843,19 +845,25 @@ _update_operation_walk_deep_embedded_auto_repositories()
843 845
 ##
844 846
 update_repositories()
845 847
 {
848
+   log_debug "update_repositories"
849
+
846 850
    _update_operation_walk_repositories "update_repository"
847 851
 }
848 852
 
849 853
 
850 854
 update_embedded_repositories()
851 855
 {
856
+   log_debug "update_embedded_repositories"
857
+
852 858
    _update_operation_walk_embedded_repositories "update_repository"
853 859
 }
854 860
 
855 861
 
856 862
 update_deep_embedded_repositories()
857 863
 {
858
-   _update_operation_walk_deep_embedded_auto_repositories "update_repository"
864
+   log_debug "update_deep_embedded_repositories"
865
+
866
+   _update_operation_walk_auto_deep_embedded_repositories "update_repository"
859 867
 }
860 868
 
861 869
 
... ...
@@ -864,19 +872,25 @@ update_deep_embedded_repositories()
864 872
 ##
865 873
 upgrade_repositories()
866 874
 {
875
+   log_debug "upgrade_repositories"
876
+
867 877
    _update_operation_walk_repositories "upgrade_repository"
868 878
 }
869 879
 
870 880
 
871 881
 upgrade_embedded_repositories()
872 882
 {
883
+   log_debug "upgrade_embedded_repositories"
884
+
873 885
    _update_operation_walk_embedded_repositories "upgrade_repository"
874 886
 }
875 887
 
876 888
 
877 889
 upgrade_deep_embedded_repositories()
878 890
 {
879
-   _update_operation_walk_deep_embedded_auto_repositories "upgrade_repository"
891
+   log_debug "upgrade_deep_embedded_repositories"
892
+
893
+   _update_operation_walk_auto_deep_embedded_repositories "upgrade_repository"
880 894
 }
881 895
 
882 896
 
... ...
@@ -1064,12 +1078,12 @@ get_old_stashdir()
1064 1078
 
1065 1079
 auto_update_minions()
1066 1080
 {
1081
+   log_debug "auto_update_minions" "$@"
1082
+
1067 1083
    local minions="$1"
1068 1084
 
1069 1085
    local minion
1070 1086
 
1071
-   log_debug ":auto_update_minions: (${minions})"
1072
-
1073 1087
    IFS="
1074 1088
 "
1075 1089
    for minion in ${minions}
... ...
@@ -1094,6 +1108,8 @@ auto_update_minions()
1094 1108
 
1095 1109
 work_clones()
1096 1110
 {
1111
+   log_debug "work_clones" "$@"
1112
+
1097 1113
    local reposdir="$1"
1098 1114
    local clones="$2"
1099 1115
    local required_clones="$3"
... ...
@@ -1123,6 +1139,12 @@ work_clones()
1123 1139
       ;;
1124 1140
    esac
1125 1141
 
1142
+   if [ -z "${clones}" ]
1143
+   then
1144
+      log_debug "work_clones has nothing to do"        
1145
+      return
1146
+   fi
1147
+   
1126 1148
    log_debug "Working \"${clones}\""
1127 1149
 
1128 1150
    IFS="
... ...
@@ -1280,6 +1302,7 @@ work_clones()
1280 1302
                   fi
1281 1303
 
1282 1304
                   bury_stash "${reposdir}" "${name}" "${oldstashdir}"
1305
+                  forget_repository "${reposdir}" "${name}" 
1283 1306
                ;;
1284 1307
 
1285 1308
                "set-remote")
... ...
@@ -1312,7 +1335,7 @@ work_clones()
1312 1335
 
1313 1336
       if [ "${skip}" = "YES" ]
1314 1337
       then
1315
-         log_debug "skipping to next clone because..."
1338
+         log_debug "Skipping to next clone as indicated..."
1316 1339
          continue
1317 1340
       fi
1318 1341
 
... ...
@@ -1324,13 +1347,12 @@ work_clones()
1324 1347
          # branch could be overwritten
1325 1348
          log_debug "${C_INFO}Remembering ${clone} ..."
1326 1349
 
1327
-         remember_stash_of_repository "${clone}" \
1328
-                                      "${reposdir}" \
1329
-                                      "${name}"  \
1330
-                                      "${stashdir}" \
1331
-                                      "${PARENT_CLONE}"
1350
+         remember_repository "${clone}" \
1351
+                             "${reposdir}" \
1352
+                             "${name}"  \
1353
+                             "${PARENT_CLONE}"
1332 1354
       else
1333
-         log_debug "ignoring because..."
1355
+         log_debug "Not remembering ${clone} as indicated..."
1334 1356
       fi
1335 1357
       mark_stash_as_alive "${reposdir}" "${name}"
1336 1358
    done
... ...
@@ -1608,6 +1630,7 @@ fetch_loop()
1608 1630
 #
1609 1631
 _common_fetch()
1610 1632
 {
1633
+   log_debug "_common_fetch" "$@"
1611 1634
 
1612 1635
    fetch_loop "${REPOS_DIR}"
1613 1636
 
... ...
@@ -1627,6 +1650,8 @@ _common_fetch()
1627 1650
 
1628 1651
 _common_update()
1629 1652
 {
1653
+   log_debug "_common_update" "$@"
1654
+
1630 1655
    case "${BREW_PERMISSIONS}" in
1631 1656
       update|upgrade)
1632 1657
          brew_update_main
... ...
@@ -1643,6 +1668,8 @@ _common_update()
1643 1668
 
1644 1669
 _common_upgrade()
1645 1670
 {
1671
+   log_debug "_common_upgrade" "$@"
1672
+
1646 1673
    case "${BREW_PERMISSIONS}" in
1647 1674
       upgrade)
1648 1675
          brew_upgrade_main
... ...
@@ -1655,12 +1682,17 @@ _common_upgrade()
1655 1682
    upgrade_repositories "$@"
1656 1683
    upgrade_deep_embedded_repositories
1657 1684
 
1685
+   # now we need to redo the auto update and
1686
+   # fetch new dependencies if needed
1687
+   
1658 1688
    _common_fetch  # update what needs to be update
1659 1689
 }
1660 1690
 
1661 1691
 
1662 1692
 _common_main()
1663 1693
 {
1694
+   log_debug "_common_main" "$@"
1695
+
1664 1696
    [ -z "${MULLE_BOOTSTRAP_REPOSITORIES_SH}" ]      && . mulle-bootstrap-repositories.sh
1665 1697
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
1666 1698
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]          && . mulle-bootstrap-settings.sh
... ...
@@ -1672,7 +1704,7 @@ _common_main()
1672 1704
    local OPTION_ALLOW_SEARCH_CACHES="YES"
1673 1705
    local OPTION_ALLOW_GIT_MIRROR="YES"
1674 1706
    local OPTION_ALLOW_REFRESH_GIT_MIRROR="YES"
1675
-   local OPTION_EMBEDDED_ONLY="NO"
1707
+   local OPTION_EMBEDDED_ONLY="${OPTION_EMBEDDED_ONLY:-NO}"
1676 1708
    local OVERRIDE_BRANCH
1677 1709
    local DONT_WARN_SCRIPTS="NO"
1678 1710
 
... ...
@@ -48,17 +48,16 @@ MULLE_BOOTSTRAP_REPOSITORIES_SH="included"
48 48
 #
49 49
 # store it inside the possibly recursed dstprefix dependency
50 50
 #
51
-remember_stash_of_repository()
51
+remember_repository()
52 52
 {
53 53
    local clone="$1"
54 54
    local reposdir="$2"  # ususally .bootstrap.repos
55 55
    local name="$3"      # name of the clone
56
-   local parentclone="$5"
56
+   local parentclone="$4"
57 57
 
58 58
    [ -z "${clone}" ]    && internal_fail "clone is missing"
59 59
    [ -z "${reposdir}" ] && internal_fail "reposdir is missing"
60 60
    [ -z "${name}" ]     && internal_fail "name is missing"
61
-   [ -z "${stashdir}" ] && internal_fail "stashdir is missing"
62 61
 
63 62
    local content
64 63
    local filepath
... ...
@@ -75,6 +74,23 @@ ${parentclone}"  ## a clone line
75 74
 }
76 75
 
77 76
 
77
+forget_repository()
78
+{
79
+   local reposdir="$1"  # ususally .bootstrap.repos
80
+   local name="$2"      # name of the clone
81
+
82
+   [ -z "${reposdir}" ] && internal_fail "reposdir is missing"
83
+   [ -z "${name}" ]     && internal_fail "name is missing"
84
+
85
+   local content
86
+   local filepath
87
+
88
+   filepath="${reposdir}/${name}"
89
+   log_fluff "Forgetting about repository \"${name}\" via \"${filepath}\""
90
+   remove_file_if_present "${filepath}"
91
+}
92
+
93
+
78 94
 _clone_of_reposdir_file()
79 95
 {
80 96
    sed -n '1p' "${1}"
... ...
@@ -247,6 +263,7 @@ _get_all_repos_headers()
247 263
 
248 264
    for i in "${reposdir}"/*
249 265
    do
266
+      log_debug "repository: $i"
250 267
       head -1 "$i"
251 268
    done
252 269
 }
... ...
@@ -254,12 +271,16 @@ _get_all_repos_headers()
254 271
 
255 272
 _get_all_repos_minions()
256 273
 {
274
+   log_debug "_get_all_repos_minions" "$@" "($PWD)"
275
+
257 276
    _get_all_repos_headers "$@" | egrep '^[^;]*;[^;]*;[^;]*;minion'
258 277
 }
259 278
 
260 279
 
261 280
 _get_all_repos_clones()
262 281
 {
282
+   log_debug "_get_all_repos_clones" "$@" "($PWD)"
283
+
263 284
    _get_all_repos_headers "$@" | egrep -v '^[^;]*;[^;]*;[^;]*;minion'
264 285
 }
265 286
 
... ...
@@ -271,6 +292,8 @@ _get_all_repos_clones()
271 292
 #
272 293
 walk_check()
273 294
 {
295
+   log_debug "walk_check" "$@"
296
+
274 297
    local stashdir="$1"
275 298
    local permissions="$2"
276 299
 
... ...
@@ -317,6 +340,8 @@ walk_check()
317 340
 
318 341
 _walk_minions()
319 342
 {
343
+   log_debug "_walk_minions" "$@"
344
+
320 345
    local minions="$1"; shift
321 346
    local callback="$1"; shift
322 347
    local permissions="$1"; shift
... ...
@@ -364,9 +389,13 @@ _walk_minions()
364 389
    IFS="${DEFAULT_IFS}"
365 390
 }
366 391
 
367
-
392
+#
393
+# _walk_repositories clones,callback,permissions,reposdir ...
394
+#
368 395
 _walk_repositories()
369 396
 {
397
+   log_debug "_walk_repositories" "$@"
398
+
370 399
    local clones="$1"; shift
371 400
    local callback="$1"; shift
372 401
    local permissions="$1"; shift
... ...
@@ -414,7 +443,7 @@ _walk_repositories()
414 443
 
415 444
 _deep_walk_repos_trampoline()
416 445
 {
417
-   log_debug ":_deep_walk_repos_trampoline:" "$@"
446
+   log_debug "_deep_walk_repos_trampoline" "$@"
418 447
 
419 448
    local reposdir="$1"; shift  # ususally .bootstrap.repos
420 449
    local name="$1"; shift      # name of the clone
... ...
@@ -434,7 +463,6 @@ _deep_walk_repos_trampoline()
434 463
 
435 464
       reposdir="${REPOS_DIR}/.deep/${name}.d"
436 465
 
437
-      # sigh have to use read_setting here
438 466
       embedded_clones="`_get_all_repos_clones "${reposdir}"`"
439 467
 
440 468
       PARENT_REPOSITORY_NAME="${name}"
... ...
@@ -453,7 +481,7 @@ _deep_walk_repos_trampoline()
453 481
 
454 482
 _deep_walk_auto_trampoline()
455 483
 {
456
-   log_debug ":_deep_walk_auto_trampoline:" "$@"
484
+   log_debug "_deep_walk_auto_trampoline" "$@"
457 485
 
458 486
    local reposdir="$1"; shift  # ususally .bootstrap.repos
459 487
    local name="$1"; shift      # name of the clone
... ...
@@ -491,17 +519,10 @@ _deep_walk_auto_trampoline()
491 519
 }
492 520
 
493 521
 
494
-walk_auto_minions()
495
-{
496
-   log_debug "walk_auto_minions" "$@"
497
-
498
-   local minions
499
-
500
-   minions="`read_root_setting "minions"`"
501
-   _walk_minions "${minions}" "$@"
502
-}
503
-
504 522
 
523
+#
524
+# walk_auto_repositories settingname,callback,permissions,reposdir ...
525
+#
505 526
 walk_auto_repositories()
506 527
 {
507 528
    log_debug "walk_auto_repositories" "$@"
... ...
@@ -515,125 +536,124 @@ walk_auto_repositories()
515 536
 }
516 537
 
517 538
 
518
-walk_repos_minions()
539
+#
540
+# walk_repos_repositories unused,callback,permissions,reposdir ...
541
+#
542
+walk_repos_repositories()
519 543
 {
520
-   log_debug "walk_repos_minions" "$@"
544
+   log_debug "walk_repos_repositories" "$@"
521 545
 
522
-   local reposdir="$1";shift
523
-   local callback="$1";shift
524
-   local permissions="$1";shift
546
+   shift
525 547
 
526
-   local minions
548
+   local reposdir="$3"
527 549
 
528
-   minions="`_get_all_repos_minions "${reposdir}"`"
529
-   _walk_minions "${clones}" \
530
-                 "${callback}" \
531
-                 "${permissions}" \
532
-                 "${reposdir}" \
533
-                 "$@"
550
+   local clones
551
+
552
+   clones="`_get_all_repos_clones "${reposdir}"`"
553
+   _walk_repositories "${clones}" "$@"
534 554
 }
535 555
 
536 556
 
537
-walk_repos_repositories()
557
+#
558
+# walk_auto_deep_embedded_repositories callback,permissions,reposdir ...
559
+#
560
+walk_auto_deep_embedded_repositories()
538 561
 {
539
-   log_debug "walk_repos_repositories" "$@"
562
+   log_debug "walk_auto_deep_embedded_repositories" "$@"
540 563
 
541
-   local reposdir="$1";shift
542 564
    local callback="$1";shift
543 565
    local permissions="$1";shift
566
+   local reposdir="$1";shift
544 567
 
545 568
    local clones
546 569
 
547
-   clones="`_get_all_repos_clones "${reposdir}"`"
570
+   clones="`read_root_setting "repositories"`"
548 571
    _walk_repositories "${clones}" \
549
-                      "${callback}" \
572
+                      _deep_walk_auto_trampoline \
550 573
                       "${permissions}" \
551 574
                       "${reposdir}" \
575
+                      "${callback}" \
552 576
                       "$@"
553 577
 }
554 578
 
555
-
556
-walk_deep_embedded_auto_minions()
557
-{
558
-   log_debug "walk_deep_embedded_auto_minions" "$@"
559
-
560
-   local callback="$1";shift
561
-   local permissions="$1";shift
562
-
563
-   local minions
564
-
565
-   minions="`read_root_setting "minions"`"
566
-   _walk_minions "${minions}" \
567
-                 _deep_walk_auto_trampoline \
568
-                 "${permissions}" \
569
-                 "${REPOS_DIR}" \
570
-                 "${callback}" \
571
-                 "${permissions}" \
572
-                 "$@"
573
-}
574
-
575
-
576
-walk_deep_embedded_auto_repositories()
579
+#
580
+# walk_repos_deep_embedded_repositories callback,permissions,reposdir ...
581
+#
582
+walk_repos_deep_embedded_repositories()
577 583
 {
578
-   log_debug "walk_deep_embedded_auto_repositories" "$@"
584
+   log_debug "walk_repos_deep_embedded_repositories" "$@"
579 585
 
580 586
    local callback="$1";shift
581 587
    local permissions="$1";shift
588
+   local reposdir="$1";shift
582 589
 
583 590
    local clones
584 591
 
585
-
586
-   clones="`read_root_setting "repositories"`"
592
+   clones="`_get_all_repos_clones "${reposdir}"`"
587 593
    _walk_repositories "${clones}" \
588
-                      _deep_walk_auto_trampoline \
594
+                      _deep_walk_repos_trampoline \
589 595
                       "${permissions}" \
590
-                      "${REPOS_DIR}" \
596
+                      "${reposdir}" \
591 597
                       "${callback}" \
592
-                      "${permissions}" \
593 598
                       "$@"
594 599
 }
595 600
 
596 601
 
597
-walk_deep_embedded_minion_repositories()
602
+#
603
+# walk_repos_deep_embedded_minion_repositories callback,permissions,reposdir ...
604
+#
605
+walk_repos_deep_embedded_minion_repositories()
598 606
 {
599
-   log_debug "walk_deep_embedded_minion_repositories" "$@"
607
+   log_debug "walk_repos_deep_embedded_minion_repositories" "$@"
600 608
 
601
-   local callback="$1";shift
602
-   local permissions="$1";shift
609
+   local callback="$1"; shift
610
+   local permissions="$1"; shift
611
+   local reposdir="$1"; shift
603 612
 
604 613
    local minions
605 614
 
606
-   minions="`_get_all_repos_minions "${REPOS_DIR}"`"
615
+   minions="`_get_all_repos_minions "${reposdir}"`"
607 616
    _walk_repositories "${minions}" \
608 617
                       _deep_walk_repos_trampoline \
609 618
                       "${permissions}" \
610
-                      "${REPOS_DIR}" \
619
+                      "${reposdir}" \
611 620
                       "${callback}" \
612
-                      "${permissions}" \
613 621
                       "$@"
614 622
 }
615 623
 
616 624
 
617
-walk_deep_embedded_repos_repositories()
625
+#
626
+# walk_auto_minions callback,permissions,reposdir ...
627
+#
628
+walk_auto_minions()
629
+{
630
+   log_debug "walk_auto_minions" "$@"
631
+
632
+   local minions
633
+
634
+   minions="`read_root_setting "minions"`"
635
+   _walk_minions "${minions}" "$@"
636
+}
637
+
638
+
639
+#
640
+# walk_repos_minions callback,permissions,reposdir ...
641
+#
642
+walk_repos_minions()
618 643
 {
619
-   log_debug "walk_deep_embedded_repos_repositories" "$@"
644
+   log_debug "walk_repos_minions" "$@"
620 645
 
621
-   local callback="$1";shift
622
-   local permissions="$1";shift
646
+   local reposdir="$3"
623 647
 
624
-   local clones
648
+   local minions
625 649
 
626
-   clones="`_get_all_repos_clones "${REPOS_DIR}"`"
627
-   _walk_repositories "${clones}" \
628
-                      _deep_walk_repos_trampoline \
629
-                      "${permissions}" \
630
-                      "${REPOS_DIR}" \
631
-                      "${callback}" \
632
-                      "${permissions}" \
633
-                      "$@"
650
+   minions="`_get_all_repos_minions "${reposdir}"`"
651
+   _walk_minions "${minions}" "$@"
634 652
 }
635 653
 
636 654
 
655
+
656
+
637 657
 #
638 658
 # walk over clones just give raw values
639 659
 # no checks
... ...
@@ -1204,6 +1224,8 @@ unique_repository_contents()
1204 1224
 #
1205 1225
 sort_repository_file()
1206 1226
 {
1227
+   log_debug "sort_repository_file" "$@"
1228
+
1207 1229
    local stop
1208 1230
    local match
1209 1231
 
... ...
@@ -1211,9 +1233,6 @@ sort_repository_file()
1211 1233
 
1212 1234
    log_info "Resolving dependencies..."
1213 1235
 
1214
-   log_debug ":sort_repository_file:"
1215
-
1216
-
1217 1236
    #
1218 1237
    # read from .auto
1219 1238
    #
... ...
@@ -1337,7 +1356,7 @@ mulle_repositories_initialize()
1337 1356
 {
1338 1357
    [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
1339 1358
 
1340
-   log_debug ":mulle_repositories_initialize:"
1359
+   log_debug "mulle_repositories_initialize"
1341 1360
 
1342 1361
    [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ] && . mulle-bootstrap-local-environment.sh
1343 1362
    [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ]             && . mulle-bootstrap-array.sh
... ...
@@ -223,7 +223,7 @@ _git_get_mirror_url()
223 223
    [ -z "${REPOS_DIR}" ] && internal_fail "REPOS_DIR undefined"
224 224
 
225 225
    filelistpath="${REPOS_DIR}/.uptodate-mirrors"
226
-   log_debug "Mirror URLS: `cat "${filelistpath}" 2>/dev/null`"
226
+   log_fluff "Mirror URLS: `cat "${filelistpath}" 2>/dev/null`"
227 227
 
228 228
    match="`fgrep -s -x "${mirrordir}" "${filelistpath}" 2>/dev/null`"
229 229
    if [ ! -z "${match}" ]
... ...
@@ -494,10 +494,15 @@ list_build_directories()
494 494
    local filename
495 495
    local name
496 496
 
497
-   log_info "$PWD"
497
+   if [ ! -d "${directory}" ]
498
+   then
499
+      return
500
+   fi
501
+
502
+   log_info "${directory}"
498 503
    IFS="
499 504
 "
500
-   for filename in `ls -1 "${directory}"`
505
+   for filename in `ls -1 "${directory}" 2> /dev/null`
501 506
    do
502 507
       path="${directory}/${filename}"
503 508
       if [ -d "${path}" ]
... ...
@@ -528,7 +533,7 @@ list_dir_settings()
528 533
 
529 534
    IFS="
530 535
 "
531
-   for filename in `ls -1 "${directory}" 2> /dev/null | sed -n "/${sedpattern}/p" `
536
+   for filename in `ls -1 "${directory}" 2> /dev/null  | sed -n "/${sedpattern}/p" `
532 537
    do
533 538
       IFS="${DEFAULT_IFS}"
534 539
 
... ...
@@ -1012,9 +1017,13 @@ _setting_list()
1012 1017
                         sed "s/^/mulle-bootstrap setting -r -g /" | \
1013 1018
                         _unescape_linefeeds
1014 1019
 
1015
-      log_info "Available repository settings:"
1016
-      list_build_directories "${BOOTSTRAP_DIR}.local" ""
1017
-      list_build_directories "${BOOTSTRAP_DIR}" "-g"
1020
+
1021
+      if [ -d "${BOOTSTRAP_DIR}.local" -o -d "${BOOTSTRAP_DIR}" ]
1022
+      then
1023
+         log_info "Available repository settings:"
1024
+         list_build_directories "${BOOTSTRAP_DIR}.local" ""
1025
+         list_build_directories "${BOOTSTRAP_DIR}" "-g"
1026
+      fi
1018 1027
 
1019 1028
       return
1020 1029
    fi
... ...
@@ -300,8 +300,9 @@ show_deep_embedded_repositories()
300 300
 minion"
301 301
    (
302 302
       SHOW_PREFIX="${SHOW_PREFIX}   " \
303
-         walk_deep_embedded_auto_repositories "show_repository" \
304
-                                              "${permissions}"
303
+         walk_auto_deep_embedded_repositories "show_repository" \
304
+                                              "${permissions}" \
305
+                                              "${REPOS_DIR}"
305 306
    )
306 307
 }
307 308
 
... ...
@@ -116,9 +116,9 @@ status_embedded_repositories()
116 116
 
117 117
    permissions="minion"
118 118
    walk_auto_repositories "embedded_repositories"  \
119
-                     "_status_repository" \
120
-                     "${permissions}" \
121
-                     "${EMBEDDED_REPOS_DIR}"
119
+                          "_status_repository" \
120
+                          "${permissions}" \
121
+                          "${EMBEDDED_REPOS_DIR}"
122 122
 }
123 123
 
124 124
 
... ...
@@ -127,8 +127,9 @@ status_deep_embedded_repositories()
127 127
    local permissions
128 128
 
129 129
    permissions="minion"
130
-   walk_deep_embedded_auto_repositories "_status_repository" \
131
-                                   "${permissions}"
130
+   walk_auto_deep_embedded_repositories "_status_repository" \
131
+                                        "${permissions}" \
132
+                                        "${REPOS_DIR}"
132 133
 }
133 134
 
134 135
 
... ...
@@ -78,22 +78,20 @@ list_default_configuration()
78 78
 
79 79
 check_for_mulle_xcode_settings()
80 80
 {
81
-   local installed
82
-
83 81
    #
84 82
    # OK
85 83
    #
86
-   installed=`which mulle-xcode-settings`
87
-   if [ "$installed" = "" ]
84
+   if [ -z "`command -v mulle-xcode-settings`" ]
88 85
    then
89 86
       user_say_yes "Need to install mulle-xcode-settings (via brew)
90
-   Install mulle-xcode-settings now ?"
91
-      [ $? -eq 0 ] || exit 1
87
+Install mulle-xcode-settings now ?"
88
+      [ $? -eq 0 ] || return 1
92 89
 
93 90
       [ -z "${MULLE_BOOTSTRAP_BREW_SH}" ] && . mulle-bootstrap-brew.sh
94 91
 
95 92
       brew_install_brews install "mulle-kybernetik/software/mulle-xcode-settings"
96 93
    fi
94
+   return 0
97 95
 }
98 96
 
99 97
 
... ...
@@ -158,6 +156,11 @@ patch_library_configurations()
158 156
    default="$4"
159 157
    flag="$5"
160 158
 
159
+   if ! check_for_mulle_xcode_settings
160
+   then
161
+      exit 1
162
+   fi
163
+
161 164
    IFS="
162 165
 "
163 166
    for i in ${xcode_configurations}
... ...
@@ -205,7 +208,6 @@ patch_xcode_project()
205 208
 
206 209
    # mod_pbxproj can only do Debug/Release/All...
207 210
 
208
-   check_for_mulle_xcode_settings
209 211
 
210 212
    configurations=`read_root_setting "configurations" "Debug
211 213
 Release"`
... ...
@@ -298,67 +300,72 @@ Release"
298 300
 
299 301
    local query
300 302
 
301
-   if [ "$COMMAND" = "add" ]
303
+   if check_for_mulle_xcode_settings
302 304
    then
303
-      if [ $terse -ne 0 -a "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
305
+      if [ "$COMMAND" = "add" ]
304 306
       then
305
-         local mapped
306
-         local i
307
-
308
-         printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
309
-
310
-         #  make these echos easily grabable by stdout
311
-         #     012345678901234567890123456789012345678901234567890123456789
312
-         printf "${C_RESET_BOLD}Common.xcconfig:${C_RESET}\n"
313
-         printf "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
314
-         echo "ADDICTIONS_DIR=${addictions_dir}"
315
-         if [ "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
307
+         if [ $terse -ne 0 -a "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
316 308
          then
317
-            echo "DEPENDENCIES_DIR=${dependencies_dir}"
318
-         fi
319
-         echo "HEADER_SEARCH_PATHS=${header_search_paths}"
320
-         echo "LIBRARY_SEARCH_PATHS=${library_search_paths}"
321
-         echo "FRAMEWORK_SEARCH_PATHS=${framework_search_paths}"
322
-         printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
309
+            local mapped
310
+            local i
323 311
 
324
-         IFS="
325
-"
326
-         for i in ${xcode_configurations}
327
-         do
328
-            IFS="${DEFAULT_IFS}"
329
-            mapped=`map_configuration "${configurations}" "${i}"`
312
+            printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
330 313
 
314
+            #  make these echos easily grabable by stdout
331 315
             #     012345678901234567890123456789012345678901234567890123456789
332
-            printf "${C_RESET_BOLD}${i}.xcconfig:${C_RESET}\n"
316
+            printf "${C_RESET_BOLD}Common.xcconfig:${C_RESET}\n"
333 317
             printf "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
334
-            echo "#include \"Common.xcconfig\""
335
-            echo ""
336
-            echo "LIBRARY_CONFIGURATION=${mapped}"
318
+            echo "ADDICTIONS_DIR=${addictions_dir}"
319
+            if [ "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
320
+            then
321
+               echo "DEPENDENCIES_DIR=${dependencies_dir}"
322
+            fi
323
+            echo "HEADER_SEARCH_PATHS=${header_search_paths}"
324
+            echo "LIBRARY_SEARCH_PATHS=${library_search_paths}"
325
+            echo "FRAMEWORK_SEARCH_PATHS=${framework_search_paths}"
337 326
             printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
338
-         done
339 327
 
340
-         IFS="${DEFAULT_IFS}"
341
-      fi
328
+            IFS="
329
+   "
330
+            for i in ${xcode_configurations}
331
+            do
332
+               IFS="${DEFAULT_IFS}"
333
+               mapped=`map_configuration "${configurations}" "${i}"`
334
+
335
+               #     012345678901234567890123456789012345678901234567890123456789
336
+               printf "${C_RESET_BOLD}${i}.xcconfig:${C_RESET}\n"
337
+               printf "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
338
+               echo "#include \"Common.xcconfig\""
339
+               echo ""
340
+               echo "LIBRARY_CONFIGURATION=${mapped}"
341
+               printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
342
+            done
342 343
 
343
-      query="Add ${C_CYAN}${ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}${C_MAGENTA} and friends to search paths of ${C_MAGENTA}${projectname}${C_YELLOW} ?"
344
-   else
345
-      query="Remove ${C_CYAN}${ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}${C_MAGENTA} and friends from search paths of ${C_MAGENTA}${projectname}${C_YELLOW} ?"
346
-   fi
344
+            IFS="${DEFAULT_IFS}"
345
+         fi
347 346
 
348
-   user_say_yes "$query"
349
-   [ $? -eq 0 ] || exit 1
347
+         query="Add ${C_CYAN}${ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}${C_MAGENTA} and friends to search paths of ${C_MAGENTA}${projectname}${C_YELLOW} ?"
348
+      else
349
+         query="Remove ${C_CYAN}${ADDICTIONS_DIR}/${LIBRARY_DIR_NAME}${C_MAGENTA} and friends from search paths of ${C_MAGENTA}${projectname}${C_YELLOW} ?"
350
+      fi
350 351
 
351
-   if [ "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
352
-   then
353
-      patch_library_configurations "${xcode_configurations}" "${configurations}" "${project}" "${default}" "${flag}"
354
-   fi
355 352
 
356
-   exekutor mulle-xcode-settings "${flag}" "ADDICTIONS_DIR" "${addictions_dir}" "${project}"  || exit 1
357
-   exekutor mulle-xcode-settings "${flag}" "DEPENDENCIES_DIR" "${dependencies_dir}" "${project}"  || exit 1
358
-   exekutor mulle-xcode-settings "${flag}" "HEADER_SEARCH_PATHS" "${header_search_paths}" "${project}"  || exit 1
359
-   exekutor mulle-xcode-settings "${flag}" "LIBRARY_SEARCH_PATHS" "${library_search_paths}" "${project}"  || exit 1
360
-   exekutor mulle-xcode-settings "${flag}" "FRAMEWORK_SEARCH_PATHS" "${framework_search_paths}" "${project}" || exit 1
353
+      user_say_yes "$query"
354
+      [ $? -eq 0 ] || exit 1
361 355
 
356
+      if [ "${MULLE_EXECUTABLE}" = "mulle-bootstrap" ]
357
+      then
358
+         patch_library_configurations "${xcode_configurations}" "${configurations}" "${project}" "${default}" "${flag}"
359
+      fi
360
+
361
+      exekutor mulle-xcode-settings "${flag}" "ADDICTIONS_DIR" "${addictions_dir}" "${project}"  || exit 1
362
+      exekutor mulle-xcode-settings "${flag}" "DEPENDENCIES_DIR" "${dependencies_dir}" "${project}"  || exit 1
363
+      exekutor mulle-xcode-settings "${flag}" "HEADER_SEARCH_PATHS" "${header_search_paths}" "${project}"  || exit 1
364
+      exekutor mulle-xcode-settings "${flag}" "LIBRARY_SEARCH_PATHS" "${library_search_paths}" "${project}"  || exit 1
365
+      exekutor mulle-xcode-settings "${flag}" "FRAMEWORK_SEARCH_PATHS" "${framework_search_paths}" "${project}" || exit 1
366
+   else
367
+      exit 1
368
+   fi
362 369
 
363 370
    if [ "$COMMAND" = "add" ]
364 371
    then
... ...
@@ -24,10 +24,9 @@ run_test_1()
24 24
    [ "${tag}"      = "tag" ]       || fail "wrong tag \"${tag}\""
25 25
    [ "${scm}"      = "scm" ]       || fail "wrong scm \"${scm}\""
26 26
 
27
-   remember_stash_of_repository "${clone}" \
28
-                                ".bootstrap.repos" \
29
-                                "${name}"  \
30
-                                "${stashdir}"
27
+   remember_repository "${clone}" \
28
+                       ".bootstrap.repos" \
29
+                       "${name}"  
31 30
 
32 31
    local foodir
33 32
 
... ...
@@ -64,10 +63,9 @@ run_test_2()
64 63
    [ "${tag}"      = "tag" ]       || fail "wrong tag \"${tag}\""
65 64
    [ "${scm}"      = "scm" ]       || fail "wrong scm \"${scm}\""
66 65
 
67
-   remember_stash_of_repository "${clone}" \
68
-                                ".bootstrap.repos/.embedded" \
69
-                                "${name}"  \
70
-                                "${stashdir}"
66
+   remember_repository "${clone}" \
67
+                       ".bootstrap.repos/.embedded" \
68
+                       "${name}"  
71 69
 
72 70
    local foodir
73 71
 
... ...
@@ -35,7 +35,7 @@ echo "deb [arch=all] http://{{PUBLISHER_DEBIAN_DISTS_PATH}} `lsb_release -c -s`
35 35
 > "/etc/apt/sources.list.d/{{PUBLISHER}}.{{PUBLISHER_DOMAIN}}.list"
36 36
 
37 37
 apt-get update
38
-apt-get -y --allow-unauthenticated install mulle-bootstrap
38
+apt-get -y install mulle-bootstrap
39 39
 ```
40 40
 
41 41
 ## Windows: How to install
... ...
@@ -68,7 +68,13 @@ update_test_case()
68 68
 
69 69
 move_test_case()
70 70
 {
71
-   echo "b;b2" > a/.bootstrap/repositories
71
+   echo "b;stashes/b2" > a/.bootstrap/repositories
72
+}
73
+
74
+
75
+remove_test_case()
76
+{
77
+   echo "# empty now" > a/.bootstrap/repositories
72 78
 }
73 79
 
74 80
 
... ...
@@ -106,6 +112,33 @@ assert_a_2()
106 112
 }
107 113
 
108 114
 
115
+#
116
+# why do I even support this still ?
117
+#
118
+assert_a_3()
119
+{
120
+   result="`cat .bootstrap.auto/repositories`"
121
+   expected="b;stashes/b2;master;git"
122
+
123
+   [ "${expected}" = "${result}" ] || fail ".bootstrap.auto/repositories, result:${result} != expected:${expected}"
124
+
125
+   [ -f ".bootstrap.repos/b" ] || fail "fail 3.1"
126
+   [ -d "stashes/b2" ]  || fail "fail 3.2"
127
+   [ ! -d "stashes/b" ] || fail "fail 3.3"
128
+
129
+   :
130
+}
131
+
132
+assert_a_4()
133
+{
134
+   [ ! -d "stashes/b2" ]  || fail "fail 4.1"
135
+   [ ! -d "stashes/b" ] || fail "fail 4.2"
136
+   [ ! -f ".bootstrap.repos/b" ] || fail "fail 4.3"
137
+
138
+   :
139
+}
140
+
141
+
109 142
 _test_a_1()
110 143
 {
111 144
    run_mulle_bootstrap "$@" -y -f fetch --no-symlink-creation
... ...
@@ -147,6 +180,20 @@ _test_a_2()
147 180
 }
148 181
 
149 182
 
183
+_test_a_3()
184
+{
185
+   run_mulle_bootstrap "$@" fetch
186
+   assert_a_3
187
+}
188
+
189
+
190
+_test_a_4()
191
+{
192
+   run_mulle_bootstrap "$@" fetch
193
+   assert_a_4
194
+}
195
+
196
+
150 197
 test_a()
151 198
 {
152 199
    (
... ...
@@ -163,6 +210,23 @@ test_a()
163 210
       cd a ;
164 211
       _test_a_2 "$@"
165 212
    ) || fail "setup"
213
+
214
+   #
215
+   # Move 'b' into a different stash dir
216
+   #
217
+   move_test_case
218
+
219
+   (
220
+      cd a ;
221
+      _test_a_3 "$@"
222
+   ) || fail "setup"
223
+
224
+   remove_test_case
225
+
226
+   (
227
+      cd a ;
228
+      _test_a_4 "$@"
229
+   ) || fail "setup"
166 230
 }
167 231
 
168 232