Browse code

Redo IFS handling to avoid some funny errors and make things easier to read. Redid usage to be somewhat more clear and helpful.

Nat! authored on 09-10-2016 21:36:13
Showing 15 changed files
... ...
@@ -1,3 +1,10 @@
1
+2.1.1
2
+===
3
+
4
+* Improve usage to show more available commands
5
+* redid the IFS setting/resetting chores
6
+
7
+
1 8
 2.1
2 9
 ===
3 10
 
... ...
@@ -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
-MULLE_BOOTSTRAP_VERSION="2.1"
32
+MULLE_BOOTSTRAP_VERSION="2.1.1"
33 33
 
34 34
 #
35 35
 # This is the main user interface to mulle-bootstrap
... ...
@@ -45,20 +45,25 @@ trap_fail()
45 45
 usage()
46 46
 {
47 47
    cat <<EOF
48
-usage: mulle-bootstrap [options] [command] [--help]
49
- Common Options:
48
+usage: mulle-bootstrap [options] [command] ...
49
+ Options:
50 50
    -a -y     : default answer to questions (scripts wont be checked)
51 51
                -a (clone preferred) -y (local copy/symlink preferred)
52 52
    -n        : do nothing creative or destructive
53 53
    -v        : -v to be more verbose (-vv or -vvv for more verbosity)
54 54
    -V        : show build commands
55 55
 
56
- Common user commands:
56
+ Commands:
57 57
    bootstrap : does fetch and build recursively [default]
58
+   build     : builds fetched repositories
58 59
    clean     : cleans mulle-bootstrap produced files.
59
-
60
- Common maintainer commands:
60
+   fetch     : fetches required repositories recursively. Use it after updating
61
+               the repositories and embedded_repositories files.
61 62
    init      : initializes a bootstrap project
63
+   install   : install dependencies as system headers
64
+   git       : run git commands on fetched repositories
65
+   tag       : tag fetched repositories
66
+   update    : updates repositories (pull).
62 67
 EOF
63 68
 
64 69
    if [ "${UNAME}" = 'darwin' ]
... ...
@@ -69,14 +74,6 @@ EOF
69 74
    fi
70 75
 
71 76
 cat <<EOF
72
-   tag       : tag this project and fetched repositories
73
-
74
- Specialized commands:
75
-   build     : builds fetched repositories
76
-   fetch     : fetches required repositories recursively. Use it after updating
77
-               the repositories and embedded_repositories files.
78
-   update    : updates repositories (pull).
79
-   install   : install dependencies as system headers
80 77
 EOF
81 78
    exit 1
82 79
 }
... ...
@@ -56,16 +56,15 @@ find_library_in_directories()
56 56
    filename="$1"
57 57
    directories="$2"
58 58
 
59
-   local old
60
-
61
-   old="${IFS}"
62
-   IFS="
63
-"
64 59
    local directory
65 60
    local path
66 61
 
62
+   IFS="
63
+"
67 64
    for directory in ${directories}
68 65
    do
66
+      IFS="${DEFAULT_IFS}"
67
+
69 68
       path="${directory}/${filename}"
70 69
 
71 70
       if [ -f "${path}" ]
... ...
@@ -75,7 +74,7 @@ find_library_in_directories()
75 74
       fi
76 75
    done
77 76
 
78
-   IFS="${old}"
77
+   IFS="${DEFAULT_IFS}"
79 78
 }
80 79
 
81 80
 
... ...
@@ -48,15 +48,13 @@ bootstrap_auto_update_merge()
48 48
    local tmpfile
49 49
    local settingname
50 50
    local match
51
-   local old
52 51
    local i
53 52
 
54
-   old="${IFS:-' '}"
55 53
    IFS="
56 54
 "
57 55
    for i in `ls -1 "${directory}/.bootstrap"`
58 56
    do
59
-      IFS="${old}"
57
+      IFS="${DEFAULT_IFS}"
60 58
 
61 59
       settingname="`basename -- "${i}"`"
62 60
       srcfile="${directory}/.bootstrap/${settingname}"
... ...
@@ -98,7 +96,7 @@ bootstrap_auto_update_merge()
98 96
       fi
99 97
    done
100 98
 
101
-   IFS="${old}"
99
+   IFS="${DEFAULT_IFS}"
102 100
 }
103 101
 
104 102
 
... ...
@@ -227,15 +225,14 @@ bootstrap_auto_create()
227 225
    # don't copy config if exists (it could be malicious)
228 226
    # don't copy settings (must be duplicated by inheritor)
229 227
    #
230
-   local old
231 228
    local file
232 229
    local name
233 230
 
234
-   old="${IFS}"
235 231
    IFS="
236 232
 "
237 233
    for file in `ls -1 "${BOOTSTRAP_SUBDIR}"`
238 234
    do
235
+      IFS="${DEFAULT_IFS}"
239 236
       name="`basename -- "${file}"`"
240 237
 
241 238
       case "$name" in
... ...
@@ -253,7 +250,7 @@ bootstrap_auto_create()
253 250
       esac
254 251
    done
255 252
 
256
-   IFS="${old}"
253
+   IFS="${DEFAULT_IFS}"
257 254
 }
258 255
 
259 256
 
... ...
@@ -880,36 +880,40 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
880 880
 
881 881
       # assemble -I /I and -L /LIBPATH:
882 882
 
883
-      local memo
884
-
885
-      memo="${IFS}"
886 883
 
887 884
       # cmake separator
888 885
       IFS=";"
889 886
       for path in ${native_includelines}
890 887
       do
888
+         IFS="${DEFAULT_IFS}"
891 889
          other_cflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
892 890
          other_cxxflags="`concat "${other_cxxflags}" "${includeprefix}${path}"`"
893 891
       done
894 892
 
893
+      IFS=";"
895 894
       for path in ${native_librarylines}
896 895
       do
896
+         IFS="${DEFAULT_IFS}"
897 897
          other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
898 898
       done
899 899
 
900
+      IFS=";"
900 901
       for path in ${native_frameworklines}
901 902
       do
903
+         IFS="${DEFAULT_IFS}"
902 904
          other_cflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
903 905
          other_cxxflags="`concat "${other_cxxflags}" "${frameworkprefix}${path}"`"
904 906
          other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
905 907
       done
906 908
 
909
+      IFS=";"
907 910
       if [ MULLE_BOOTSTRAP_VERBOSE_BUILD = "YES" ]
908 911
       then
912
+         IFS="${DEFAULT_IFS}"
909 913
          local_make_flags="${local_make_flags} VERBOSE=1"
910 914
       fi
911 915
 
912
-      IFS="${memo}"
916
+      IFS="${DEFAULT_IFS}"
913 917
 
914 918
       local oldpath
915 919
       local rval
... ...
@@ -1128,28 +1132,30 @@ ${C_MAGENTA}${C_BOLD}${sdk}${C_INFO} in \"${builddir}\" ..."
1128 1132
 
1129 1133
       # assemble -I /I and -L /LIBPATH:
1130 1134
 
1131
-      local memo
1132
-
1133
-      memo="${IFS}"
1134 1135
 
1135 1136
       IFS="${PATH_SEPARATOR}"
1136 1137
       for path in ${includelines}
1137 1138
       do
1139
+         IFS="${DEFAULT_IFS}"
1138 1140
          other_cflags="`concat "${other_cflags}" "${includeprefix}${path}"`"
1139 1141
       done
1140 1142
 
1143
+      IFS="${PATH_SEPARATOR}"
1141 1144
       for path in ${librarylines}
1142 1145
       do
1146
+         IFS="${DEFAULT_IFS}"
1143 1147
          other_ldflags="`concat "${other_ldflags}" "${libraryprefix}${path}"`"
1144 1148
       done
1145 1149
 
1150
+      IFS="${PATH_SEPARATOR}"
1146 1151
       for path in ${frameworklines}
1147 1152
       do
1153
+         IFS="${DEFAULT_IFS}"
1148 1154
          other_cflags="`concat "${other_cflags}" "${frameworkprefix}${path}"`"
1149 1155
          other_ldflags="`concat "${other_ldflags}" "${frameworkprefix}${path}"`"
1150 1156
       done
1151 1157
 
1152
-      IFS="${memo}"
1158
+      IFS="${DEFAULT_IFS}"
1153 1159
 
1154 1160
       local oldpath
1155 1161
       local rval
... ...
@@ -1660,34 +1666,30 @@ build_xcodebuild_schemes_or_target()
1660 1666
 
1661 1667
    schemes=`read_repo_setting "${name}" "xcode_schemes"`
1662 1668
 
1663
-   local old
1664
-
1665
-   old="${IFS:-" "}"
1666 1669
    IFS="
1667 1670
 "
1668 1671
    for scheme in $schemes
1669 1672
    do
1670
-      IFS="$old"
1673
+      IFS="${DEFAULT_IFS}"
1671 1674
       log_fluff "Building scheme \"${scheme}\" of \"${project}\" ..."
1672 1675
       build_xcodebuild "$@" "${scheme}" ""
1673 1676
    done
1674
-   IFS="${old}"
1677
+   IFS="${DEFAULT_IFS}"
1675 1678
 
1676 1679
    local target
1677 1680
    local targets
1678 1681
 
1679 1682
    targets=`read_repo_setting "${name}" "xcode_targets"`
1680 1683
 
1681
-   old="$IFS"
1682 1684
    IFS="
1683 1685
 "
1684 1686
    for target in $targets
1685 1687
    do
1686
-      IFS="${old}"
1688
+      IFS="${DEFAULT_IFS}"
1687 1689
       log_fluff "Building target \"${target}\" of \"${project}\" ..."
1688 1690
       build_xcodebuild "$@" "" "${target}"
1689 1691
    done
1690
-   IFS="${old}"
1692
+   IFS="${DEFAULT_IFS}"
1691 1693
 
1692 1694
    if [ "${targets}" = "" -a "${schemes}" = "" ]
1693 1695
    then
... ...
@@ -1920,7 +1922,7 @@ build_with_configuration_sdk_preferences()
1920 1922
          ;;
1921 1923
 
1922 1924
          *)
1923
-            fail "unknown build preference $1"
1925
+            fail "Unknown build preference \"$1\""
1924 1926
          ;;
1925 1927
       esac
1926 1928
    done
... ...
@@ -2112,17 +2114,18 @@ get_source_dir()
2112 2114
 build_clones()
2113 2115
 {
2114 2116
    local clone
2115
-   local old
2116
-
2117
-   old="${IFS:-" "}"
2118 2117
 
2119
-   for clone in ${CLONES_SUBDIR}/*.failed
2118
+   IFS="
2119
+"
2120
+   for clone in `ls -1d ${CLONES_SUBDIR}/*.failed 2> /dev/null`
2120 2121
    do
2122
+      IFS="${DEFAULT_IFS}"
2121 2123
       if [ -d "${clone}" ]
2122 2124
       then
2123 2125
          fail "failed checkout $clone detected, can't continue"
2124 2126
       fi
2125 2127
    done
2128
+   IFS="${DEFAULT_IFS}"
2126 2129
 
2127 2130
    run_build_root_settings_script "pre-build" "$@"
2128 2131
 
... ...
@@ -2150,7 +2153,7 @@ build_clones()
2150 2153
 "
2151 2154
          for clone in ${clones}
2152 2155
          do
2153
-            IFS="$old"
2156
+            IFS="${DEFAULT_IFS}"
2154 2157
 
2155 2158
             __parse_clone "${clone}"
2156 2159
 
... ...
@@ -2188,7 +2191,7 @@ build_clones()
2188 2191
       done
2189 2192
    fi
2190 2193
 
2191
-   IFS="$old"
2194
+   IFS="${DEFAULT_IFS}"
2192 2195
 
2193 2196
    run_build_root_settings_script "post-build" "$@"
2194 2197
 }
... ...
@@ -2212,13 +2215,12 @@ install_tars()
2212 2215
       return 0
2213 2216
    fi
2214 2217
 
2215
-   local old
2216
-
2217
-   old="${IFS:-" "}"
2218 2218
    IFS="
2219 2219
 "
2220 2220
    for tar in ${tarballs}
2221 2221
    do
2222
+      IFS="${DEFAULT_IFS}"
2223
+
2222 2224
       if [ ! -f "$tar" ]
2223 2225
       then
2224 2226
          fail "tarball \"$tar\" not found"
... ...
@@ -2228,7 +2230,7 @@ install_tars()
2228 2230
          exekutor tar -xz -C "${DEPENDENCY_SUBDIR}" -f "${tar}" || fail "failed to extract ${tar}"
2229 2231
       fi
2230 2232
    done
2231
-   IFS="${old}"
2233
+   IFS="${DEFAULT_IFS}"
2232 2234
 }
2233 2235
 
2234 2236
 
... ...
@@ -172,20 +172,17 @@ clean_files()
172 172
    files="$1"
173 173
 
174 174
    local file
175
-   local old
176
-
177
-   old="${IFS:-" "}"
178 175
 
179 176
    IFS="
180 177
 "
181 178
    for file in ${files}
182 179
    do
183
-      IFS="${old}"
180
+      IFS="${DEFAULT_IFS}"
184 181
 
185 182
       clean_asserted_file "${file}"
186 183
    done
187 184
 
188
-   IFS="${old}"
185
+   IFS="${DEFAULT_IFS}"
189 186
 }
190 187
 
191 188
 
... ...
@@ -198,22 +195,20 @@ clean_directories()
198 195
    flag="$2"
199 196
 
200 197
    local directory
201
-   local old
202 198
 
203
-   old="${IFS:-" "}"
204 199
    IFS="
205 200
 "
206 201
    for directory in ${directories}
207 202
    do
208
-      IFS="${old}"
203
+      IFS="${DEFAULT_IFS}"
204
+
209 205
       clean_asserted_folder "${directory}"
210 206
       clean_parent_folders_if_empty "${directory}" "${PWD}"
211 207
       flag="YES"
212 208
    done
209
+   IFS="${DEFAULT_IFS}"
213 210
 
214 211
    echo "$flag"
215
-
216
-   IFS="${old}"
217 212
 }
218 213
 
219 214
 
... ...
@@ -55,18 +55,15 @@ _dependency_resolve()
55 55
    UNRESOLVED_DEPENDENCIES="`array_add "${UNRESOLVED_DEPENDENCIES}" "${name}"`"
56 56
 
57 57
    local sub_name
58
-   local old
59 58
    #local insert
60 59
 
61 60
    #insert="`array_count "${RESOLVED_DEPENDENCIES}"`"
62 61
 
63
-
64
-   old="${IFS}"
65 62
    IFS="
66 63
 "
67 64
    for sub_name in ${dependencies}
68 65
    do
69
-      IFS="${old}"
66
+      IFS="${DEFAULT_IFS}"
70 67
 
71 68
       if array_contains "${RESOLVED_DEPENDENCIES}" "${sub_name}"
72 69
       then
... ...
@@ -80,7 +77,8 @@ _dependency_resolve()
80 77
 
81 78
       _dependency_resolve "${map}" "${sub_name}"
82 79
    done
83
-   IFS="${old}"
80
+
81
+   IFS="${DEFAULT_IFS}"
84 82
 
85 83
    UNRESOLVED_DEPENDENCIES="`array_remove "${UNRESOLVED_DEPENDENCIES}" "${name}"`"
86 84
    RESOLVED_DEPENDENCIES="`array_add "${RESOLVED_DEPENDENCIES}" "${name}"`"
... ...
@@ -129,20 +127,18 @@ dependency_add_array()
129 127
    name="$2"
130 128
    array="$3"
131 129
 
132
-   local old
130
+   local sub_name
133 131
 
134
-   old="${IFS}"
135 132
    IFS="
136 133
 "
137
-   local sub_name
138
-
139 134
    for sub_name in ${array}
140 135
    do
141
-      IFS="${old}"
136
+      IFS="${DEFAULT_IFS}"
137
+
142 138
       map="`dependency_add "${map}" "${name}" "${sub_name}"`"
143 139
    done
144 140
 
145
-   IFS="${old}"
141
+   IFS="${DEFAULT_IFS}"
146 142
 
147 143
    echo "${map}"
148 144
 }
... ...
@@ -78,17 +78,14 @@ install_taps()
78 78
    then
79 79
       fetch_brew_if_needed
80 80
 
81
-      local old
82
-
83
-      old="${IFS:-" "}"
84 81
       IFS="
85 82
 "
86 83
       for tap in ${taps}
87 84
       do
88
-         IFS="${old}"
85
+         IFS="${DEFAULT_IFS}"
89 86
          exekutor "${BREW}" tap "${tap}" > /dev/null || exit 1
90 87
       done
91
-      IFS="${old}"
88
+      IFS="${DEFAULT_IFS}"
92 89
    else
93 90
       log_fluff "No taps found"
94 91
    fi
... ...
@@ -157,15 +154,13 @@ install_brews()
157 154
       exekutor chmod -R u+w "${ADDICTION_SUBDIR}"
158 155
    fi
159 156
 
160
-   local old
161 157
    local flag
162 158
 
163
-   old="${IFS:-" "}"
164 159
    IFS="
165 160
 "
166 161
    for formula in ${brews}
167 162
    do
168
-      IFS="${old}"
163
+      IFS="${DEFAULT_IFS}"
169 164
 
170 165
       if [ ! -x "${BREW}" ]
171 166
       then
... ...
@@ -204,13 +199,12 @@ install_brews()
204 199
          fi
205 200
       fi
206 201
    done
202
+   IFS="${DEFAULT_IFS}"
207 203
 
208 204
    if [ "${flag}" = "YES" ]
209 205
    then
210 206
       write_protect_directory "${ADDICTION_SUBDIR}"
211 207
    fi
212
-
213
-   IFS="${old}"
214 208
 }
215 209
 
216 210
 
... ...
@@ -228,21 +222,20 @@ check_tars()
228 222
    tarballs="`read_fetch_setting "tarballs" | sort | sort -u`"
229 223
    if [ "${tarballs}" != "" ]
230 224
    then
231
-      local old
232
-
233
-      old="${IFS:-" "}"
234 225
       IFS="
235 226
 "
236 227
       for tar in ${tarballs}
237 228
       do
238
-         IFS="${old}"
229
+         IFS="${DEFAULT_IFS}"
230
+
239 231
          if [ ! -f "$tar" ]
240 232
          then
241 233
             fail "tarball \"$tar\" not found"
242 234
          fi
243 235
          log_fluff "tarball \"$tar\" found"
244 236
       done
245
-      IFS="${old}"
237
+      IFS="${DEFAULT_IFS}"
238
+
246 239
    else
247 240
       log_fluff "No tarballs found"
248 241
    fi
... ...
@@ -722,11 +715,9 @@ clone_repositories()
722 715
    local clones
723 716
    local fetched
724 717
    local match
725
-   local old
726 718
    local rval
727 719
    local stop
728 720
 
729
-   old="${IFS:-" "}"
730 721
    fetched=""
731 722
 
732 723
    # __parse_expanded_clone variables
... ...
@@ -750,7 +741,7 @@ clone_repositories()
750 741
 "
751 742
          for clone in ${clones}
752 743
          do
753
-            IFS="${old}"
744
+            IFS="${DEFAULT_IFS}"
754 745
 
755 746
             clone="`expanded_setting "${clone}"`"
756 747
 
... ...
@@ -772,6 +763,8 @@ ${clone}"
772 763
                fi
773 764
             fi
774 765
          done
766
+         IFS="${DEFAULT_IFS}"
767
+
775 768
       fi
776 769
    done
777 770
 
... ...
@@ -779,14 +772,14 @@ ${clone}"
779 772
 "
780 773
    for clone in ${fetched}
781 774
    do
782
-      IFS="${old}"
775
+      IFS="${DEFAULT_IFS}"
783 776
 
784 777
       __parse_clone "${clone}"
785 778
 
786 779
       did_clone_repository "${name}" "${url}" "${branch}"
787 780
    done
788 781
 
789
-   IFS="${old}"
782
+   IFS="${DEFAULT_IFS}"
790 783
 }
791 784
 
792 785
 
... ...
@@ -955,9 +948,6 @@ update_repositories()
955 948
    local clone
956 949
    local name
957 950
    local i
958
-   local old
959
-
960
-   old="${IFS:-" "}"
961 951
 
962 952
    if [ $# -ne 0 ]
963 953
    then
... ...
@@ -965,7 +955,7 @@ update_repositories()
965 955
 "
966 956
       for name in "$@"
967 957
       do
968
-         IFS="${old}"
958
+         IFS="${DEFAULT_IFS}"
969 959
          create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
970 960
             update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
971 961
          remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
... ...
@@ -975,12 +965,13 @@ update_repositories()
975 965
 "
976 966
       for name in "$@"
977 967
       do
978
-         IFS="${old}"
968
+         IFS="${DEFAULT_IFS}"
979 969
          create_file_if_missing "${CLONESFETCH_SUBDIR}/.fetch_update_started"
980 970
             did_update_repository "${name}" "${CLONESFETCH_SUBDIR}/${name}"
981 971
          remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
982
-         done
983
-      IFS="${old}"
972
+      done
973
+
974
+      IFS="${DEFAULT_IFS}"
984 975
       return
985 976
    fi
986 977
 
... ...
@@ -1012,7 +1003,7 @@ update_repositories()
1012 1003
 "
1013 1004
          for clone in ${clones}
1014 1005
          do
1015
-            IFS="${old}"
1006
+            IFS="${DEFAULT_IFS}"
1016 1007
 
1017 1008
             clone="`expanded_setting "${clone}"`"
1018 1009
 
... ...
@@ -1050,10 +1041,9 @@ ${clone}"
1050 1041
                break
1051 1042
             fi
1052 1043
          done
1044
+         IFS="${DEFAULT_IFS}"
1053 1045
       fi
1054 1046
    done
1055
-
1056
-   IFS="${old}"
1057 1047
 }
1058 1048
 
1059 1049
 
... ...
@@ -1240,26 +1230,23 @@ clone_embedded_repositories()
1240 1230
 
1241 1231
    local clones
1242 1232
    local clone
1243
-   local old
1244 1233
 
1245 1234
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES"
1246 1235
 
1247 1236
    clones="`read_fetch_setting "embedded_repositories"`"
1248 1237
    if [ ! -z "${clones}" ]
1249 1238
    then
1250
-      old="${IFS:-" "}"
1251 1239
       IFS="
1252 1240
 "
1253 1241
       for clone in ${clones}
1254 1242
       do
1255
-         IFS="${old}"
1243
+         IFS="${DEFAULT_IFS}"
1256 1244
 
1257 1245
          clone_embedded_repository "${dstprefix}" "${clone}"
1258 1246
       done
1247
+      IFS="${DEFAULT_IFS}"
1259 1248
 
1260 1249
       remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1261
-
1262
-      IFS="${old}"
1263 1250
    fi
1264 1251
 
1265 1252
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=
... ...
@@ -1274,7 +1261,6 @@ update_embedded_repositories()
1274 1261
 
1275 1262
    local clones
1276 1263
    local clone
1277
-   local old
1278 1264
 
1279 1265
    # __parse_embedded_clone
1280 1266
    local name
... ...
@@ -1293,12 +1279,11 @@ update_embedded_repositories()
1293 1279
 
1294 1280
    if [ ! -z "${clones}" ]
1295 1281
    then
1296
-      old="${IFS:-" "}"
1297 1282
       IFS="
1298 1283
 "
1299 1284
       for clone in ${clones}
1300 1285
       do
1301
-         IFS="${old}"
1286
+         IFS="${DEFAULT_IFS}"
1302 1287
 
1303 1288
          __parse_embedded_clone "${clone}"
1304 1289
 
... ...
@@ -1317,7 +1302,7 @@ update_embedded_repositories()
1317 1302
          remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1318 1303
       done
1319 1304
 
1320
-      IFS="${old}"
1305
+      IFS="${DEFAULT_IFS}"
1321 1306
    fi
1322 1307
 
1323 1308
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=
... ...
@@ -1349,8 +1334,8 @@ _common_main()
1349 1334
             MULLE_BOOTSTRAP_UPDATE_SYMLINKS="YES"
1350 1335
          ;;
1351 1336
 
1352
-         # build options
1353
-         -K|--clean|-k|--no-clean|-j|--cores|-c|--configuration)
1337
+         # build options with no parameters
1338
+         -K|--clean|-k|--no-clean)
1354 1339
             if [ -z "${MULLE_BOOTSTRAP_WILL_BUILD}" ]
1355 1340
             then
1356 1341
                log_error "unknown option $1"
... ...
@@ -1358,6 +1343,22 @@ _common_main()
1358 1343
             fi
1359 1344
          ;;
1360 1345
 
1346
+         # build options with no parameters
1347
+         -j|--cores|-c|--configuration)
1348
+            if [ -z "${MULLE_BOOTSTRAP_WILL_BUILD}" ]
1349
+            then
1350
+               log_error "unknown option $1"
1351
+               ${USAGE}
1352
+            fi
1353
+
1354
+            if [ $# -eq 1 ]
1355
+            then
1356
+               log_error "missing parameter to option $1"
1357
+               ${USAGE}
1358
+            fi
1359
+            shift
1360
+         ;;
1361
+
1361 1362
          -*)
1362 1363
             log_error "unknown option $1"
1363 1364
             ${USAGE}
... ...
@@ -1401,7 +1402,7 @@ _common_main()
1401 1402
    then
1402 1403
       if [ $# -ne 0 ]
1403 1404
       then
1404
-         log_error  "Additional parameters not allowed for install"
1405
+         log_error "Additional parameters not allowed for install"
1405 1406
          ${USAGE}
1406 1407
       fi
1407 1408
    fi
... ...
@@ -694,17 +694,13 @@ combined_escaped_search_path()
694 694
 _simplify_components()
695 695
 {
696 696
    local i
697
-   local old
698
-
699
-
700 697
    local components
701 698
 
702
-   old="${IFS}"
703 699
    IFS="
704 700
 "
705 701
    for i in $*
706 702
    do
707
-      IFS="${old}"
703
+      IFS="${DEFAULT_IFS}"
708 704
 
709 705
       case "${i}" in
710 706
          # ./foo -> foo
... ...
@@ -740,7 +736,7 @@ _simplify_components()
740 736
       esac
741 737
    done
742 738
 
743
-   IFS="${old}"
739
+   IFS="${DEFAULT_IFS}"
744 740
 
745 741
    echo "${components}"
746 742
 }
... ...
@@ -753,20 +749,16 @@ _path_from_components()
753 749
    components="$1"
754 750
 
755 751
    local i
756
-   local old
757 752
    local path
758 753
 
759
-   old="${IFS}"
760 754
    IFS="
761 755
 "
762
-
763 756
    for i in $components
764 757
    do
765 758
       path="${path}${i}"
766 759
    done
767 760
 
768
-
769
-   IFS="${old}"
761
+   IFS="${DEFAULT_IFS}"
770 762
 
771 763
    if [ -z "${path}" ]
772 764
    then
... ...
@@ -1108,6 +1100,8 @@ write_protect_directory()
1108 1100
 # ####################################################################
1109 1101
 functions_initialize()
1110 1102
 {
1103
+   DEFAULT_IFS="${IFS}"
1104
+
1111 1105
    [ -z "${MULLE_BOOTSTRAP_LOGGING_SH}" ] && . mulle-bootstrap-logging.sh
1112 1106
    [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ] && . mulle-bootstrap-array.sh
1113 1107
 
... ...
@@ -41,14 +41,13 @@ find_msvc_executable()
41 41
    name="${2:-compiler}"
42 42
 
43 43
    local path
44
-   local old
45 44
    local compiler
46 45
 
47
-   old="${IFS}"
48 46
    IFS=":"
49
-
50 47
    for path in $PATH
51 48
    do
49
+      IFS="${DEFAULT_IFS}"
50
+
52 51
       case "${path}" in
53 52
          /usr/*|/bin)
54 53
             continue;
... ...
@@ -66,7 +65,7 @@ find_msvc_executable()
66 65
       esac
67 66
    done
68 67
 
69
-   IFS="${old}"
68
+   IFS="${DEFAULT_IFS}"
70 69
 }
71 70
 
72 71
 
... ...
@@ -130,16 +129,16 @@ setup_mingw_buildenvironment()
130 129
 #
131 130
 mingw_buildpath()
132 131
 {
133
-   local old
134 132
    local i
135 133
    local fetchpath
136 134
    local match
137 135
 
138
-   old="${IFS}"
139 136
 
140 137
    IFS=":"
141 138
    for i in $PATH
142 139
    do
140
+      IFS="${DEFAULT_IFS}"
141
+
143 142
       if [ -x "${i}/sh.exe" ]
144 143
       then
145 144
          log_fluff "Remove \"$i\" from build PATH because it contains sh"
... ...
@@ -154,7 +153,7 @@ mingw_buildpath()
154 153
       fi
155 154
    done
156 155
 
157
-   IFS="${old}"
156
+   IFS="${DEFAULT_IFS}"
158 157
 
159 158
    echo "${fetchpath}"
160 159
 }
... ...
@@ -55,13 +55,11 @@ refresh_repositories_settings()
55 55
    local stop
56 56
    local clones
57 57
    local clone
58
-   local old
59 58
    local stop
60 59
    local refreshed
61 60
    local match
62 61
    local dependency_map
63 62
 
64
-   old="${IFS:-" "}"
65 63
 
66 64
    refreshed=""
67 65
    dependency_map=""
... ...
@@ -78,7 +76,7 @@ refresh_repositories_settings()
78 76
 "
79 77
          for clone in ${clones}
80 78
          do
81
-            IFS="${old}"
79
+            IFS="${DEFAULT_IFS}"
82 80
 
83 81
             clone="`expanded_setting "${clone}"`"
84 82
             # avoid superflous updates
... ...
@@ -141,7 +139,7 @@ ${clone}"
141 139
       fi
142 140
    done
143 141
 
144
-   IFS="${old}"
142
+   IFS="${DEFAULT_IFS}"
145 143
 
146 144
    #
147 145
    # output true repository dependencies
... ...
@@ -183,14 +181,19 @@ mark_all_repositories_zombies()
183 181
 
184 182
       mkdir_if_missing "${CLONESFETCH_SUBDIR}/.zombies"
185 183
 
184
+      IFS="
185
+"
186 186
       for i in `ls -1d "${CLONESFETCH_SUBDIR}/"*`
187 187
       do
188
+         IFS="${DEFAULT_IFS}"
189
+
188 190
          if [ -d "${i}" -o -L "${i}" ]
189 191
          then
190 192
             name="`basename -- "${i}"`"
191 193
             exekutor touch "${CLONESFETCH_SUBDIR}/.zombies/${name}"
192 194
          fi
193 195
       done
196
+      IFS="${DEFAULT_IFS}"
194 197
    fi
195 198
 }
196 199
 
... ...
@@ -267,29 +270,36 @@ bury_zombies()
267 270
       gravepath="${CLONESFETCH_SUBDIR}/.graveyard"
268 271
       mkdir_if_missing "${gravepath}"
269 272
 
273
+      IFS="
274
+"
270 275
       for i in `ls -1 "${zombiepath}/"* 2> /dev/null`
271 276
       do
272
-         if [ -e "${i}" ]
277
+         IFS="${DEFAULT_IFS}"
278
+
279
+         if [ ! -e "${i}" ]
273 280
          then
274
-            name="`basename -- "${i}"`"
275
-            dstdir="${CLONESFETCH_SUBDIR}/${name}"
276
-            if [ -d "${dstdir}" ]
277
-            then
278
-               log_info "Removing unused repository ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"`pwd`/${dstdir}\""
281
+            continue
282
+         fi
279 283
 
280
-               if [ -e "${gravepath}/${name}" ]
281
-               then
282
-                  exekutor rm -rf "${gravepath}/${name}"
283
-                  log_fluff "Made room for a new grave at \"${gravepath}/${name}\""
284
-               fi
284
+         name="`basename -- "${i}"`"
285
+         dstdir="${CLONESFETCH_SUBDIR}/${name}"
286
+         if [ -d "${dstdir}" ]
287
+         then
288
+            log_info "Removing unused repository ${C_MAGENTA}${C_BOLD}${name}${C_INFO} from \"`pwd`/${dstdir}\""
285 289
 
286
-               exekutor mv "${dstdir}" "${gravepath}"
287
-               exekutor rm "${i}"
288
-            else
289
-               log_fluff "\"${dstdir}\" zombie vanished or never existed"
290
+            if [ -e "${gravepath}/${name}" ]
291
+            then
292
+               exekutor rm -rf "${gravepath}/${name}"
293
+               log_fluff "Made room for a new grave at \"${gravepath}/${name}\""
290 294
             fi
295
+
296
+            exekutor mv "${dstdir}" "${gravepath}"
297
+            exekutor rm "${i}"
298
+         else
299
+            log_fluff "\"${dstdir}\" zombie vanished or never existed"
291 300
          fi
292 301
       done
302
+      IFS="${DEFAULT_IFS}"
293 303
    fi
294 304
 
295 305
    if [ -d "${zombiepath}" ]
... ...
@@ -312,19 +322,24 @@ mark_all_embedded_repositories_zombies()
312 322
 
313 323
    # first mark all repos as stale
314 324
    path="${CLONESFETCH_SUBDIR}/.embedded"
315
-   if dir_has_files "${CLONESFETCH_SUBDIR}/.embedded"
325
+   if dir_has_files "${path}"
316 326
    then
317 327
       log_fluff "Marking all embedded repositories as zombies for now"
318 328
 
319
-      zombiepath="${CLONESFETCH_SUBDIR}/.embedded/.zombies"
329
+      zombiepath="${path}/.zombies"
320 330
       mkdir_if_missing "${zombiepath}"
321 331
 
332
+      IFS="
333
+"
322 334
       for symlink in `ls -1d "${path}/"*`
323 335
       do
324
-         i="`head -1 "$symlink" 2>/dev/null`" || fail "Old style mulle-bootstrap files detected, \`mulle-bootstrap dist clean\` it ($PWD/$symlink)"
336
+         IFS="${DEFAULT_IFS}"
337
+
338
+         i="`head -1 "$symlink" 2>/dev/null`" || fail "Old style mulle-bootstrap files (\"${symlink}\") detected, \`mulle-bootstrap dist clean\` it ($PWD)"
325 339
          name="`basename -- "${i}"`"
326 340
          exekutor cp "${symlink}" "${zombiepath}/${name}"
327 341
       done
342
+      IFS="${DEFAULT_IFS}"
328 343
    fi
329 344
 }
330 345
 
... ...
@@ -418,7 +433,6 @@ refresh_repositories()
418 433
    local clone
419 434
    local clones
420 435
    local dstdir
421
-   local old
422 436
 
423 437
    mark_all_repositories_zombies
424 438
 
... ...
@@ -430,8 +444,6 @@ refresh_repositories()
430 444
    local tag
431 445
    local subdir
432 446
 
433
-   old="${IFS:-" "}"
434
-
435 447
    clones="`read_fetch_setting "repositories"`"
436 448
    if [ "${clones}" != "" ]
437 449
    then
... ...
@@ -441,7 +453,7 @@ refresh_repositories()
441 453
 "
442 454
       for clone in ${clones}
443 455
       do
444
-         IFS="${old}"
456
+         IFS="${DEFAULT_IFS}"
445 457
 
446 458
          __parse_clone "${clone}"
447 459
 
... ...
@@ -450,10 +462,9 @@ refresh_repositories()
450 462
          # if it's not there it's not fetched yet, that's OK
451 463
          mark_repository_alive "${name}" "${dstdir}"
452 464
       done
465
+      IFS="${DEFAULT_IFS}"
453 466
    fi
454 467
 
455
-   IFS="${old}"
456
-
457 468
    bury_zombies
458 469
 }
459 470
 
... ...
@@ -472,12 +483,6 @@ _refresh_embedded_repositories()
472 483
    clones="`read_fetch_setting "embedded_repositories"`"
473 484
    if [ ! -z "${clones}" ]
474 485
    then
475
-
476
-      local old
477
-
478
-      old="${IFS:-" "}"
479
-      IFS="
480
-"
481 486
       # local variables for __parse_embedded_clone
482 487
       local name
483 488
       local url
... ...
@@ -489,9 +494,11 @@ _refresh_embedded_repositories()
489 494
       local dstdir
490 495
       local olddir
491 496
 
497
+      IFS="
498
+"
492 499
       for clone in ${clones}
493 500
       do
494
-         IFS="${old}"
501
+         IFS="${DEFAULT_IFS}"
495 502
 
496 503
          ensure_clones_directory
497 504
 
... ...
@@ -511,9 +518,9 @@ _refresh_embedded_repositories()
511 518
             fi
512 519
          fi
513 520
       done
514
-   fi
521
+      IFS="${DEFAULT_IFS}"
515 522
 
516
-   IFS="${old}"
523
+   fi
517 524
 
518 525
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=
519 526
 }
... ...
@@ -534,14 +541,11 @@ refresh_deeply_embedded_repositories()
534 541
    local clone
535 542
    local clones
536 543
    local dstprefix
537
-   local old
538 544
    local previous_bootstrap
539 545
    local previous_clones
540 546
 
541 547
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES"
542 548
 
543
-   old="${IFS:-" "}"
544
-
545 549
    # __parse_embedded_clone
546 550
    local name
547 551
    local url
... ...
@@ -557,7 +561,7 @@ refresh_deeply_embedded_repositories()
557 561
 "
558 562
       for clone in ${clones}
559 563
       do
560
-         IFS="${old}"
564
+         IFS="${DEFAULT_IFS}"
561 565
 
562 566
          __parse_embedded_clone "${clone}"
563 567
 
... ...
@@ -578,10 +582,9 @@ refresh_deeply_embedded_repositories()
578 582
             log_warn  "Don't refresh embedded repositories of symlinked \"${name}\""
579 583
          fi
580 584
       done
585
+      IFS="${DEFAULT_IFS}"
581 586
    fi
582 587
 
583
-   IFS="${old}"
584
-
585 588
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=
586 589
 }
587 590
 
... ...
@@ -197,15 +197,12 @@ find_embedded_repository_subdir_in_repos()
197 197
    url="$1"
198 198
 
199 199
    local filename
200
-   local old
201 200
 
202
-   old="${IFS}"
203 201
    IFS="
204 202
 "
205
-
206 203
    for i in `fgrep -l -x "${url}" "${CLONESFETCH_SUBDIR}/.embedded/"* 2> /dev/null`
207 204
    do
208
-      IFS="${old}"
205
+      IFS="${DEFAULT_IFS}"
209 206
 
210 207
       #
211 208
       # ensure that it's the URL that matched
... ...
@@ -218,7 +215,7 @@ find_embedded_repository_subdir_in_repos()
218 215
       fi
219 216
    done
220 217
 
221
-   IFS="${old}"
218
+   IFS="${DEFAULT_IFS}"
222 219
 }
223 220
 
224 221
 
... ...
@@ -234,16 +231,13 @@ embedded_repository_directories_from_repos()
234 231
    dstprefix="$1"
235 232
 
236 233
    local filename
237
-   local old
238 234
    local embedded
239 235
 
240
-
241
-   old="${IFS}"
242 236
    IFS="
243 237
 "
244 238
    for filename in `ls -1 "${CLONESFETCH_SUBDIR}/.embedded/" 2> /dev/null`
245 239
    do
246
-      IFS="${old}"
240
+      IFS="${DEFAULT_IFS}"
247 241
 
248 242
       embedded="`embedded_repository_subdir_in_repos "${filename}"`"
249 243
       if [ ! -z "${embedded}" ]
... ...
@@ -256,25 +250,22 @@ embedded_repository_directories_from_repos()
256 250
       fi
257 251
    done
258 252
 
259
-   IFS="${old}"
253
+   IFS="${DEFAULT_IFS}"
260 254
 }
261 255
 
262 256
 
263 257
 repository_directories_from_repos()
264 258
 {
265 259
    local filename
266
-   local old
267 260
 
268
-   old="${IFS}"
269 261
    IFS="
270 262
 "
271
-
272 263
    for filename in `ls -1 "${CLONESFETCH_SUBDIR}" 2> /dev/null`
273 264
    do
274 265
       echo "${CLONESFETCH_SUBDIR}/$filename"
275 266
    done
276 267
 
277
-   IFS="${old}"
268
+   IFS="${DEFAULT_IFS}"
278 269
 }
279 270
 
280 271
 
... ...
@@ -577,12 +577,10 @@ merge_settings_in_front()
577 577
 
578 578
    result="${settings2}"
579 579
 
580
-   local old
581 580
    local line1
582 581
 
583 582
    # https://stackoverflow.com/questions/742466/how-can-i-reverse-the-order-of-lines-in-a-file/744093#744093
584 583
 
585
-   old="${IFS:-" "}"
586 584
    IFS="
587 585
 "
588 586
    for line in `echo "${settings1}" | sed -n '1!G;h;$p'`
... ...
@@ -592,7 +590,7 @@ merge_settings_in_front()
592 590
 ${result}"
593 591
    done
594 592
 
595
-   IFS="${old}"
593
+   IFS="${DEFAULT_IFS}"
596 594
 
597 595
    if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" -o "$MULLE_BOOTSTRAP_TRACE_MERGE" = "YES"  ]
598 596
    then
... ...
@@ -44,7 +44,6 @@ warn_scripts()
44 44
    local phases
45 45
    local ack
46 46
    local i
47
-   local old
48 47
 
49 48
    # log_info "warn_scripts $1:$2:${DONT_ASK_AFTER_WARNING}:${MULLE_BOOTSTRAP_ANSWER}"
50 49
 
... ...
@@ -54,10 +53,10 @@ warn_scripts()
54 53
       if [ ! -z "${scripts}" ]
55 54
       then
56 55
          log_warning "this .bootstrap contains shell scripts:"
57
-         old="${IFS:-" "}"
56
+         echo "${C_BOLD}--------------------------------------------------------${C_RESET}" >&2
57
+
58 58
          IFS="
59 59
 "
60
-         echo "${C_BOLD}--------------------------------------------------------${C_RESET}" >&2
61 60
          for i in $scripts
62 61
          do
63 62
             echo "${C_BOLD}$i:${C_RESET}" >&2
... ...
@@ -65,8 +64,9 @@ warn_scripts()
65 64
             cat "$i" >&2
66 65
             echo "${C_BOLD}--------------------------------------------------------${C_RESET}" >&2
67 66
          done
67
+         IFS="${DEFAULT_IFS}"
68
+
68 69
          echo "" >&2
69
-         IFS="${old}"
70 70
       fi
71 71
    fi
72 72
 
... ...
@@ -110,11 +110,9 @@ map_configuration()
110 110
 
111 111
    local mapped
112 112
    local i
113
-   local old
114 113
 
115 114
    mapped=""
116 115
 
117
-   old="${IFS:-" "}"
118 116
    IFS="
119 117
 "
120 118
    for i in ${configurations}
... ...
@@ -124,7 +122,7 @@ map_configuration()
124 122
          mapped="${xcode_configuration}"
125 123
       fi
126 124
    done
127
-   IFS="${old}"
125
+   IFS="${DEFAULT_IFS}"
128 126
 
129 127
    if [ "$mapped" = "" ]
130 128
    then
... ...
@@ -161,17 +159,15 @@ patch_library_configurations()
161 159
    default="$4"
162 160
    flag="$5"
163 161
 
164
-   local old
165
-
166
-   old="${IFS:-" "}"
167 162
    IFS="
168 163
 "
169 164
    for i in ${xcode_configurations}
170 165
    do
166
+      IFS="${DEFAULT_IFS}"
171 167
       mapped=`map_configuration "${configurations}" "${i}" "${default}"`
172 168
       exekutor mulle-xcode-settings -configuration "${i}" "${flag}" "LIBRARY_CONFIGURATION" "${mapped}" "${project}" || exit 1
173 169
    done
174
-   IFS="${old}"
170
+   IFS="${DEFAULT_IFS}"
175 171
 }
176 172
 
177 173
 
... ...
@@ -316,13 +312,11 @@ Release"
316 312
          echo "FRAMEWORK_SEARCH_PATHS=${framework_search_paths}"
317 313
          printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
318 314
 
319
-         local old
320
-
321
-         old="${IFS:-" "}"
322 315
          IFS="
323 316
 "
324 317
          for i in ${xcode_configurations}
325 318
          do
319
+            IFS="${DEFAULT_IFS}"
326 320
             mapped=`map_configuration "${configurations}" "${i}"`
327 321
 
328 322
             #     012345678901234567890123456789012345678901234567890123456789
... ...
@@ -334,7 +328,7 @@ Release"
334 328
             printf  "${C_RESET_BOLD}-----------------------------------------------------------\n${C_RESET}" >&2
335 329
          done
336 330
 
337
-         IFS="${old}"
331
+         IFS="${DEFAULT_IFS}"
338 332
       fi
339 333
 
340 334
       query="Add ${C_CYAN}${DEPENDENCY_SUBDIR}/${LIBRARY_DIR_NAME}${C_MAGENTA} and friends to search paths of ${C_MAGENTA}${projectname}${C_YELLOW} ?"