Browse code

Fix scripts stuff. Fix superflous lines being emitted by trap. Add -V option.

Nat! authored on 07-10-2015 20:58:47
Showing 15 changed files
... ...
@@ -51,7 +51,7 @@ Release" > .bootstrap/settings/configurations # RIGHT
51 51
 ```
52 52
 
53 53
 
54
-### mulle-bootstrap does not do what  I want  ?
54
+### mulle-bootstrap does not do what I want  ?
55 55
 
56 56
 Check out the SETTINGS.md file for help  about tweaking  mulle-bootstrap.
57 57
 
... ...
@@ -64,6 +64,9 @@ mkdir -p  ".bootstrap/settings/Finch" 2> /dev/null
64 64
 echo "Finch Demo" > .bootstrap/Finch/targets
65 65
 ```
66 66
 
67
+Use `mulle-bootstrap -V` to get an extensive trace.
68
+
69
+
67 70
 ### Can I change the build folder from build/.repos to something else  ?
68 71
 
69 72
 Better not. You can set it with "build_foldername".
... ...
@@ -111,11 +114,6 @@ mkdir -p  ".bootstrap/settings" 2> /dev/null
111 114
 cp myconfig.xcconfig > .bootstrap/settings/xcconfig
112 115
 ```
113 116
 
114
-### Should I put build settings into .bootstrap/{reponame} or into .bootstrap ?
115
-
116
-It's better to specify build settings on a per repository basis. Repository
117
-settings can be inherited over recursive fetches. Build settings in `.bootstrap`
118
-do not.
119 117
 
120 118
 ### My Xcode project's headers do not show up ?
121 119
 
... ...
@@ -148,10 +146,9 @@ set to **YES** to work.
148 146
 
149 147
 Environment Variable                  | Description
150 148
 --------------------------------------+-------------------------------------
151
-MULLE_BOOTSTRAP_VERBOSE               | turn on a little more output. If you set it to VERBOSE instead of YES, it produces quite a bit more output. Set it to FULL for exhausting detail.  Set it to -x for shell tracing.
149
+MULLE_BOOTSTRAP_VERBOSE               | turn on a little more output. If you set it to VERBOSE instead of YES, it produces quite a bit more output. Set it to FULL for exhausting detail.  Set it to 1848 for shell tracing.
152 150
 MULLE_BOOTSTRAP_TRACE                 | traces shell commands as they are executed
153
-MULLE_BOOTSTRAP_TRACE_SETTINGS        | traces resolved settings
154
-MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS | traces each file access in search for a setting
151
+MULLE_BOOTSTRAP_TRACE_SETTINGS        | traces settings accesses
155 152
 
156 153
 
157 154
 
... ...
@@ -8,6 +8,7 @@ mulle-bootstrap-gcc.sh \
8 8
 mulle-bootstrap-init.sh \
9 9
 mulle-bootstrap-local-environment.sh \
10 10
 mulle-bootstrap-settings.sh \
11
+mulle-bootstrap-scripts.sh \
11 12
 mulle-bootstrap-tag.sh \
12 13
 mulle-bootstrap-warn-scripts.sh \
13 14
 mulle-bootstrap-xcode.sh
14 15
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+0.6
2
+===
3
+	Improve scripts handling and add a some new phases to
4
+	the proceedings. Actually the whole script stuff didn't work before...
5
+   Scripts in general aren't documented yet, because it's still very much
6
+   in fluctuation.
7
+
8
+	More output during setting inheritance. Fix proper inheritance of
9
+	build_order and build_ignore.
10
+
11
+   Lots of en-passant bug fixes. Should be in general better than 0.5
12
+
... ...
@@ -14,7 +14,7 @@ C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
14 14
 #
15 15
 # restore colors if stuff gets wonky
16 16
 #
17
-trap 'echo "${C_RESET}"' TERM EXIT
17
+trap 'printf "${C_RESET}"' TERM EXIT
18 18
 
19 19
 #
20 20
 # https://github.com/hoelzro/useful-scripts/blob/master/decolorize.pl
... ...
@@ -35,7 +35,7 @@ then
35 35
    exit 1
36 36
 fi
37 37
 
38
-echo "${C_WHITE}"
38
+printf "${C_WHITE}"
39 39
 
40 40
 for i in mulle*bootstrap
41 41
 do
... ...
@@ -53,37 +53,48 @@ if [ "$1" = "-v" ]
53 53
 then
54 54
    if [ -z "${MULLE_BOOTSTRAP_TRACE}" ]
55 55
    then
56
-       MULLE_BOOTSTRAP_TRACE=VERBOSE
56
+      MULLE_BOOTSTRAP_TRACE=VERBOSE
57 57
       export MULLE_BOOTSTRAP_TRACE
58 58
    fi
59 59
    GITFLAGS="-v"
60 60
    export GITFLAGS
61 61
    shift
62 62
 else
63
-   if [ "$1" = "-s" ] # silent
63
+   if [ "$1" = "-V" ]
64 64
    then
65
-      MULLE_BOOTSTRAP_TRACE=
66
-      MULLE_BOOTSTRAP_TERSE=YES
67
-      export MULLE_BOOTSTRAP_TERSE
68
-      GITFLAGS="-q"
65
+      if [ -z "${MULLE_BOOTSTRAP_TRACE}" ]
66
+      then
67
+         MULLE_BOOTSTRAP_TRACE=ALL
68
+         export MULLE_BOOTSTRAP_TRACE
69
+      fi
70
+      GITFLAGS="-v"
69 71
       export GITFLAGS
70 72
       shift
73
+   else
74
+      if [ "$1" = "-s" ] # silent
75
+      then
76
+         MULLE_BOOTSTRAP_TRACE=
77
+         MULLE_BOOTSTRAP_TERSE=YES
78
+         export MULLE_BOOTSTRAP_TERSE
79
+         GITFLAGS="-q"
80
+         export GITFLAGS
81
+         shift
82
+      fi
71 83
    fi
72 84
 fi
73 85
 
74 86
 
75
-
76 87
 usage()
77 88
 {
78 89
    cat <<EOF
79 90
 usage: mulle-bootstrap [-n][-v|-s] [command] [--help]
80
-       version 0.5
91
+       version 0.6
81 92
 
82 93
  Specify the -h or --help option after each command to get more help.
83 94
 
84 95
  Flags (-n must be first, if present)
85 96
    -n        : do nothing creative or destructive
86
-   -v        : be more verbose
97
+   -v        : be more verbose (-V even more verbose)
87 98
    -s        : be more terse
88 99
 
89 100
  Common user commands:
... ...
@@ -29,8 +29,9 @@
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-local-environment.sh
33
-.  mulle-bootstrap-gcc.sh
32
+. mulle-bootstrap-local-environment.sh
33
+. mulle-bootstrap-gcc.sh
34
+. mulle-bootstrap-scripts.sh
34 35
 
35 36
 
36 37
 check_and_usage_and_help()
... ...
@@ -52,6 +53,7 @@ then
52 53
 fi
53 54
 
54 55
 
56
+
55 57
 CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build" "YES"`
56 58
 
57 59
 #
... ...
@@ -90,7 +92,11 @@ dispense_headers()
90 92
             exekutor xargs -0 -J % mv -v -n % "${dst}"
91 93
          [ $? -eq 0 ]  || exit 1
92 94
          rmdir_safer "${src}"
95
+      else
96
+         log_fluff "But threre are none"
93 97
       fi
98
+   else
99
+      log_fluff "But it doesn't exist"
94 100
    fi
95 101
 }
96 102
 
... ...
@@ -130,8 +136,12 @@ dispense_binaries()
130 136
          exekutor find -x "${src}" ! -path "${src}" \( -type "${findtype}" -o -type "${findtype2}" \) -depth 1 -print0 | \
131 137
             exekutor xargs -0 -J % mv -v -n % "${dst}"
132 138
          [ $? -eq 0 ]  || exit 1
139
+      else
140
+         log_fluff "But threre are none"
133 141
       fi
134 142
       rmdir_safer "${src}"
143
+   else
144
+      log_fluff "But it doesn't exist"
135 145
    fi
136 146
 }
137 147
 
... ...
@@ -299,7 +309,6 @@ cmake_sdk_parameter()
299 309
 }
300 310
 
301 311
 
302
-
303 312
 create_dummy_dirs_against_warnings()
304 313
 {
305 314
    local relative
... ...
@@ -966,7 +975,6 @@ build_xcodebuild_schemes_or_target()
966 975
 }
967 976
 
968 977
 
969
-
970 978
 build()
971 979
 {
972 980
    local srcdir
... ...
@@ -1011,7 +1019,7 @@ Release"`"
1011 1019
 
1012 1020
    local builddir
1013 1021
    local relative
1014
-   local built
1022
+   local hasbuilt
1015 1023
    local configuration
1016 1024
    local preference
1017 1025
 
... ...
@@ -1032,14 +1040,20 @@ Release"`"
1032 1040
          builddir="${CLONESBUILD_SUBDIR}/${configuration}/${name}"
1033 1041
          relative="${CLONESBUILD_RELATIVE}/../.."
1034 1042
 
1035
-         built=no
1043
+         hasbuilt=no
1036 1044
          for preference in ${preferences}
1037 1045
          do
1038
-            if [ -x "${SCRIPT}" -a "${preference}" = "script" ]
1046
+            if [ "${preference}" = "script" ]
1039 1047
             then
1040
-               "${SCRIPT}" "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" || exit 1
1041
-               built=yes
1042
-               break
1048
+               local script
1049
+
1050
+               script="`find_build_setting_file "${name}" "bin/build.sh"`"
1051
+               if [ -x "${script}" ]
1052
+               then
1053
+                  run_script "${script}" "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" || exit 1
1054
+                  hasbuilt=yes
1055
+                  break
1056
+               fi
1043 1057
             fi
1044 1058
 
1045 1059
             if [ "${preference}" = "xcodebuild" -a -x "${xcodebuild}" ]
... ...
@@ -1049,7 +1063,7 @@ Release"`"
1049 1063
                if [ "$project" != "" ]
1050 1064
                then
1051 1065
                   build_xcodebuild_schemes_or_target "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}" "${project}"  || exit 1
1052
-                  built=yes
1066
+                  hasbuilt=yes
1053 1067
                   break
1054 1068
                fi
1055 1069
             fi
... ...
@@ -1064,7 +1078,7 @@ Release"`"
1064 1078
                if [ -x "${srcdir}/configure" ]
1065 1079
                then
1066 1080
                   build_configure "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}"  || exit 1
1067
-                  built=yes
1081
+                  hasbuilt=yes
1068 1082
                   break
1069 1083
                fi
1070 1084
             fi
... ...
@@ -1074,13 +1088,13 @@ Release"`"
1074 1088
                if [ -f "${srcdir}/CMakeLists.txt" ]
1075 1089
                then
1076 1090
                   build_cmake "${configuration}" "${srcdir}" "${builddir}" "${relative}" "${name}" "${sdk}"  || exit 1
1077
-                  built=yes
1091
+                  hasbuilt=yes
1078 1092
                   break
1079 1093
                fi
1080 1094
             fi
1081 1095
          done
1082 1096
 
1083
-         if [ "$built" != "yes" ]
1097
+         if [ "$hasbuilt" != "yes" ]
1084 1098
          then
1085 1099
             fail "Don't know how to build ${name}"
1086 1100
          fi
... ...
@@ -1099,15 +1113,20 @@ Release"`"
1099 1113
 #
1100 1114
 build_wrapper()
1101 1115
 {
1102
-   local clone
1116
+   local dstdir
1117
+   local name
1118
+
1119
+   dstdir="$1"
1120
+   name="$2"
1103 1121
 
1104
-   clone="$1"
1105 1122
 
1106 1123
    REFERENCE_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}"
1107 1124
    BUILD_DEPENDENCY_SUBDIR="${DEPENDENCY_SUBDIR}/tmp"
1108 1125
 
1109 1126
    DEPENDENCY_SUBDIR="WRONG_DONT_USE_DEPENDENCY_SUBDIR_DURING_BUILD"
1110 1127
 
1128
+   log_fluff "Setting up BUILD_DEPENDENCY_SUBDIR as \"${BUILD_DEPENDENCY_SUBDIR}\""
1129
+
1111 1130
    if [ -d "${BUILD_DEPENDENCY_SUBDIR}" ]
1112 1131
    then
1113 1132
       log_info "Cleaning up orphaned \"${BUILD_DEPENDENCY_SUBDIR}\""
... ...
@@ -1118,9 +1137,12 @@ build_wrapper()
1118 1137
    # move dependencies we have so far away into safety,
1119 1138
    # need that path for includes though
1120 1139
    #
1121
-   log_fluff "Setting up \"${BUILD_DEPENDENCY_SUBDIR}\""
1122 1140
 
1123
-   build "${clone}"
1141
+   run_repo_settings_script "${dstdir}" "${name}" "pre-build" "$@" || exit 1
1142
+
1143
+   build "${dstdir}" || exit 1
1144
+
1145
+   run_repo_settings_script "${dstdir}" "${name}" "post-build" "$@" || exit 1
1124 1146
 
1125 1147
    log_fluff "Remove \"${BUILD_DEPENDENCY_SUBDIR}\""
1126 1148
 
... ...
@@ -1135,24 +1157,25 @@ build_wrapper()
1135 1157
 
1136 1158
 build_if_readable()
1137 1159
 {
1138
-   local clone
1160
+   local dstdir
1139 1161
    local name
1140
-   local xdone
1141 1162
 
1142
-   clone="$1"
1163
+   dstdir="$1"
1143 1164
    name="$2"
1144
-   built="$3"
1145 1165
 
1146
-   if [ ! -r "${clone}" ]
1166
+   local xdone
1167
+   if [ ! -r "${dstdir}" ]
1147 1168
    then
1148
-      echo "ignoring orphaned repo ${name}" >&2
1169
+      echo "Ignoring orphaned repo ${name}" >&2
1149 1170
    else
1150
-      xdone="`/bin/echo "${built}" | grep -x "${name}"`"
1171
+      xdone="`/bin/echo "${BUILT}" | grep -x "${name}"`"
1151 1172
       if [ "$xdone" = "" ]
1152 1173
       then
1153
-         build_wrapper "${clone}"
1154
-         echo "${name}
1155
-${built}"
1174
+         build_wrapper "${dstdir}" "${name}"
1175
+         BUILT="${name}
1176
+${BUILT}"
1177
+      else
1178
+         log_fluff "Ignoring \"${name}\". (Either in \"build_ignore\" or already built)"
1156 1179
       fi
1157 1180
    fi
1158 1181
 }
... ...
@@ -1161,10 +1184,9 @@ ${built}"
1161 1184
 build_clones()
1162 1185
 {
1163 1186
    local clone
1164
-   local built
1165 1187
    local xdone
1166 1188
    local name
1167
-   local clonedir
1189
+   local dstdir
1168 1190
 
1169 1191
    for clone in ${CLONES_SUBDIR}/*.failed
1170 1192
    do
... ...
@@ -1174,24 +1196,29 @@ build_clones()
1174 1196
       fi
1175 1197
    done
1176 1198
 
1199
+   run_build_root_settings_script "pre-build" "$@"
1200
+
1177 1201
    #
1178 1202
    # build order is there, because we want to have gits
1179 1203
    # and maybe later hgs
1180 1204
    #
1205
+   BUILT=
1206
+   export BUILT
1207
+
1181 1208
    if [ "$#" -eq 0 ]
1182 1209
    then
1183
-      built=`read_build_root_setting "build_ignore"`
1210
+      BUILT="`read_build_root_setting "build_ignore"`"
1184 1211
 
1185 1212
       for clone in `read_build_root_setting "build_order"`
1186 1213
       do
1187 1214
          name="`canonical_clone_name "${clone}"`"
1188
-         clonedir="${CLONES_SUBDIR}/${name}"
1215
+         dstdir="${CLONES_SUBDIR}/${name}"
1189 1216
 
1190
-         if [ -d "${clonedir}" ]
1217
+         if [ -d "${dstdir}" ]
1191 1218
          then
1192
-            built="`build_if_readable "${clonedir}" "${name}" "${built}"`" || exit 1
1219
+            build_if_readable "${dstdir}" "${name}"  || exit 1
1193 1220
          else
1194
-            fail "build_order contains unknown repo \"${clone}\" (\"${clonedir}\")"
1221
+            fail "build_order contains unknown repo \"${clone}\" (\"${dstdir}\")"
1195 1222
          fi
1196 1223
       done
1197 1224
 
... ...
@@ -1204,29 +1231,31 @@ build_clones()
1204 1231
          for clone in ${clones}
1205 1232
          do
1206 1233
             name="`canonical_clone_name "${clone}"`"
1207
-            clonedir="${CLONES_SUBDIR}/${name}"
1234
+            dstdir="${CLONES_SUBDIR}/${name}"
1208 1235
 
1209
-            if [ -d "${clonedir}" ]
1236
+            if [ -d "${dstdir}" ]
1210 1237
             then
1211
-               built="`build_if_readable "${clonedir}" "${name}" "${built}"`" || exit 1
1238
+               build_if_readable "${dstdir}" "${name}" || exit  1
1212 1239
             else
1213
-               fail "repo for \"${clone}\" not found (\"${clonedir}\")"
1240
+               fail "repo for \"${clone}\" not found (\"${dstdir}\") ($PWD)"
1214 1241
             fi
1215 1242
          done
1216 1243
       fi
1217 1244
    else
1218 1245
       for name in "$@"
1219 1246
       do
1220
-         clonedir="${CLONES_SUBDIR}/${name}"
1247
+         dstdir="${CLONES_SUBDIR}/${name}"
1221 1248
 
1222
-         if [ -d "${clonedir}" ]
1249
+         if [ -d "${dstdir}" ]
1223 1250
          then
1224
-            built="`build_if_readable "${clone}" "${name}" "${built}"`" || exit 1
1251
+            build_if_readable "${clone}" "${name}" || exit 1
1225 1252
          else
1226 1253
             fail "unknown repo ${name}"
1227 1254
          fi
1228 1255
       done
1229 1256
    fi
1257
+
1258
+   run_build_root_settings_script "post-build" "$@"
1230 1259
 }
1231 1260
 
1232 1261
 
... ...
@@ -1276,7 +1305,7 @@ main()
1276 1305
 
1277 1306
    if [ $# -eq 0 ]
1278 1307
    then
1279
-      log_fluff "Setting up ${DEPENDENCY_SUBDIR}"
1308
+      log_fluff "Setting up dependencies directory as \"${DEPENDENCY_SUBDIR}\""
1280 1309
       clean="`read_config_setting "clean_dependencies_before_build" "YES"`"
1281 1310
       if [ "${clean}" = "YES" ]
1282 1311
       then
... ...
@@ -1,7 +1,34 @@
1 1
 #! /bin/sh
2 2
 #
3
-# (c) 2015, coded by Nat!, Mulle KybernetiK
3
+#   Copyright (c) 2015 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
4 5
 #
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#   POSSIBILITY OF SUCH DAMAGE.
31
+
5 32
 . mulle-bootstrap-local-environment.sh
6 33
 
7 34
 
... ...
@@ -19,13 +46,19 @@ usage()
19 46
 clean [build|output|dist]
20 47
 
21 48
    build   : is the default, it cleans
49
+---
22 50
 ${BUILD_CLEANABLE_SUBDIRS}
51
+---
23 52
 
24 53
    output  : cleans additionaly
54
+---
25 55
 ${OUTPUT_CLEANABLE_SUBDIRS}
56
+---
26 57
 
27 58
    dist    : cleans additionaly
59
+---
28 60
 ${DIST_CLEANABLE_SUBDIRS}
61
+---
29 62
 EOF
30 63
 }
31 64
 
... ...
@@ -122,7 +155,7 @@ clean()
122 155
          for dir in ${BUILD_CLEANABLE_SUBDIRS}
123 156
          do
124 157
             clean_asserted_folder "${dir}"
125
-            clean_parent_folders_if_empty "${dir}" "${pwd}"
158
+            clean_parent_folders_if_empty "${dir}" "${PWD}"
126 159
             flag="YES"
127 160
          done
128 161
       fi
... ...
@@ -136,7 +169,7 @@ clean()
136 169
          for dir in ${OUTPUT_CLEANABLE_SUBDIRS}
137 170
          do
138 171
             clean_asserted_folder "${dir}"
139
-            clean_parent_folders_if_empty "${dir}" "${pwd}"
172
+            clean_parent_folders_if_empty "${dir}" "${PWD}"
140 173
             flag="YES"
141 174
          done
142 175
       fi
... ...
@@ -150,7 +183,7 @@ clean()
150 183
          for dir in ${DIST_CLEANABLE_SUBDIRS}
151 184
          do
152 185
             clean_asserted_folder "${dir}"
153
-            clean_parent_folders_if_empty "${dir}" "${pwd}"
186
+            clean_parent_folders_if_empty "${dir}" "${PWD}"
154 187
             flag="YES"
155 188
          done
156 189
       fi
... ...
@@ -38,6 +38,7 @@
38 38
 . mulle-bootstrap-warn-scripts.sh
39 39
 . mulle-bootstrap-local-environment.sh
40 40
 . mulle-bootstrap-brew.sh
41
+. mulle-bootstrap-scripts.sh
41 42
 
42 43
 
43 44
 usage()
... ...
@@ -173,48 +174,30 @@ ask_symlink_it()
173 174
 }
174 175
 
175 176
 
176
-run_fetch_settings_script()
177
-{
178
-   local  name
179
-
180
-   name="$1"
181
-   shift
182
-
183
-   [ -z "$name" ] && internal_fail "name is empty"
184
-
185
-   local script
186
-
187
-   script="`read_fetch_setting "bin/${name}.sh"`"
188
-   if [ ! -z "${script}" ]
189
-   then
190
-      run_script "${script}" "$@"
191
-   fi
192
-}
193
-
194 177
 
195 178
 checkout()
196 179
 {
197 180
    local clone
198 181
    local name1
199
-   local name2
200 182
    local tag
201 183
    local dstname
202 184
 
203 185
    clone="$1"
204 186
    name1="$2"
205
-   name2="$3"
206
-   dstname="$4"
207
-   tag="$5"
187
+   dstname="$3"
188
+   tag="$4"
208 189
 
209 190
    [ -z "$clone" ]    && internal_fail "clone is empty"
210 191
    [ -z "$name1" ]    && internal_fail "name1 is empty"
211
-   [ -z "$name2" ]    && internal_fail "name2 is empty"
212 192
    [ -z "$dstname" ]  && internal_fail "dstname is empty"
213 193
 
214 194
    local srcname
215 195
    local operation
216 196
    local flag
217 197
    local found
198
+   local name2
199
+
200
+   name2="`basename "${clone}"`"
218 201
 
219 202
    #
220 203
    # this implicitly ensures, that these folders are
... ...
@@ -230,7 +213,7 @@ checkout()
230 213
    fi
231 214
 
232 215
    srcname="${clone}"
233
-   script="`read_repo_setting "${name1}" "bin/${COMMAND}.sh"`"
216
+   script="`find_repo_setting_file "${name1}" "bin/${COMMAND}.sh"`"
234 217
    operation="git_clone"
235 218
 
236 219
    # simplify this crap copy/paste code
... ...
@@ -297,8 +280,6 @@ Use it ?"
297 280
       "${operation}" "${srcname}" "${dstname}" "${tag}"
298 281
        warn_scripts "${dstname}/.bootstrap" "${dstname}" || exit 1 # sic
299 282
    fi
300
-
301
-   run_fetch_settings_script "post-install"
302 283
 }
303 284
 
304 285
 
... ...
@@ -369,7 +350,7 @@ git_pull()
369 350
 }
370 351
 
371 352
 
372
-INHERIT_SETTINGS="taps brews gits pips gems build_order build_ignore"
353
+INHERIT_SETTINGS="taps brews gits pips gems settings/build_order settings/build_ignore"
373 354
 
374 355
 
375 356
 bootstrap_recurse()
... ...
@@ -417,17 +398,30 @@ bootstrap_recurse()
417 398
    # prepend new contents to old contents
418 399
    # of a few select and known files
419 400
    #
401
+   local srcfile
402
+   local dstfile
403
+   local i
404
+
420 405
    for i in $INHERIT_SETTINGS
421 406
    do
422
-      if [ -f "${dst}/.bootstrap/${i}" ]
407
+      srcfile="${dst}/.bootstrap/${i}"
408
+      dstfile="${BOOTSTRAP_SUBDIR}.auto/${i}"
409
+      if [ -f "${srcfile}" ]
423 410
       then
411
+         log_fluff "Inheriting \"`basename ${i}`\" from \"${srcfile}\""
412
+
413
+         mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/`dirname "${i}"`"
424 414
          if [ -f "${BOOTSTRAP_SUBDIR}.auto/${i}" ]
425 415
          then
426
-            exekutor mv "${BOOTSTRAP_SUBDIR}.auto/${i}" "${BOOTSTRAP_SUBDIR}.auto/${i}.tmp" || exit 1
427
-            exekutor cat "${dst}/.bootstrap/${i}" "${BOOTSTRAP_SUBDIR}.auto/${i}.tmp" > "${BOOTSTRAP_SUBDIR}.auto/${i}"  || exit 1
428
-            exekutor rm "${BOOTSTRAP_SUBDIR}.auto/${i}.tmp" || exit 1
416
+            local tmpfile
417
+
418
+            tmpfile="${BOOTSTRAP_SUBDIR}.auto/${i}.tmp"
419
+
420
+            exekutor mv "${dstfile}" "${tmpfile}" || exit 1
421
+            exekutor cat "${srcfile}" "${tmpfile}" > "${dstfile}"  || exit 1
422
+            exekutor rm "${tmpfile}" || exit 1
429 423
          else
430
-            exekutor cp "${dst}/.bootstrap/${i}" "${BOOTSTRAP_SUBDIR}.auto/${i}" || exit 1
424
+            exekutor cp "${srcfile}" "${dstfile}" || exit 1
431 425
          fi
432 426
       fi
433 427
    done
... ...
@@ -439,14 +433,22 @@ bootstrap_recurse()
439 433
    then
440 434
       local relative
441 435
 
436
+      log_fluff "Link up build settings of \"${name}\" to \"${BOOTSTRAP_SUBDIR}.auto/settings/${name}\""
437
+
442 438
       mkdir_if_missing "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
443 439
       relative="`compute_relative "${BOOTSTRAP_SUBDIR}"`"
444 440
       exekutor find "${dst}/.bootstrap/settings" -type f -depth 1 -print0 | \
445 441
          exekutor xargs -0 -I % ln -s -f "${relative}/../../"% "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
446 442
 
447
-      # flatten folders into our own settings
448
-      exekutor find "${dst}/.bootstrap/settings" -type d -depth 1 -print0 | \
449
-         exekutor xargs -0 -I % ln -s -f "${relative}/../"% "${BOOTSTRAP_SUBDIR}.auto/settings"
443
+      if [ -e "${dst}/.bootstrap/settings/bin"  ]
444
+      then
445
+         exekutor ln -s -f "${relative}/../../${dst}/.bootstrap/settings/bin" "${BOOTSTRAP_SUBDIR}.auto/settings/${name}"
446
+      fi
447
+
448
+      # flatten other folders into our own settings
449
+      # don't force though, keep first
450
+      exekutor find "${dst}/.bootstrap/settings" ! -name bin -type d -depth 1 -print0 | \
451
+         exekutor xargs -0 -I % ln -s "${relative}/../"% "${BOOTSTRAP_SUBDIR}.auto/settings"
450 452
    fi
451 453
 
452 454
 
... ...
@@ -519,12 +521,12 @@ log_fetch_action()
519 521
 
520 522
    if [ -L "${clone}" ]
521 523
    then
522
-      info="symlinked"
524
+      info=" symlinked "
523 525
    else
524 526
       info=" "
525 527
    fi
526 528
 
527
-   log_fluff "$COMMAND ${info}${clone} in ${dstname} ..."
529
+   log_fluff "Perform ${COMMAND}${info}${clone} in ${dstname} ..."
528 530
 }
529 531
 
530 532
 #
... ...
@@ -538,12 +540,15 @@ log_fetch_action()
538 540
 checkout_repository()
539 541
 {
540 542
    local dstname
543
+   local name
541 544
 
542
-   dstname="$4"
545
+   name="$2"
546
+   dstname="$3"
543 547
 
544 548
    if [ ! -e "${dstname}" ]
545 549
    then
546 550
       checkout "$@"
551
+
547 552
       if [ "${COMMAND}" = "install" -a "${DONT_RECURSE}" = "" ]
548 553
       then
549 554
          bootstrap_recurse "${dstname}"
... ...
@@ -552,6 +557,8 @@ checkout_repository()
552 557
             return 1
553 558
          fi
554 559
       fi
560
+
561
+      run_repo_settings_script "${dstname}" "${name}" "post-${COMMAND}" "$@"
555 562
    else
556 563
       log_fluff "Repository \"${dstname}\" already exists"
557 564
    fi
... ...
@@ -565,21 +572,19 @@ clone_repository()
565 572
 
566 573
    clone="$1"
567 574
 
568
-   local name1
569
-   local name2
575
+   local name
570 576
    local tag
571 577
    local dstname
572 578
 
573
-   name1="`basename "${clone}" .git`"
574
-   name2="`basename "${clone}"`"
575
-   tag="`read_repo_setting "${name1}" "tag"`" #repo (sic)
579
+   name="`basename "${clone}" .git`"
580
+   tag="`read_repo_setting "${name}" "tag"`" #repo (sic)
576 581
 
577
-   dstname="${CLONES_FETCH_SUBDIR}/${name1}"
582
+   dstname="${CLONES_FETCH_SUBDIR}/${name}"
578 583
 
579 584
    mark_alive "${dstname}"
580
-   log_fetch_action "${clone}" "${dstname}"
585
+   log_fetch_action "${name}" "${dstname}"
581 586
 
582
-   checkout_repository "${clone}" "${name1}" "${name2}" "${dstname}" "${tag}"
587
+   checkout_repository "${clone}" "${name}" "${dstname}" "${tag}"
583 588
 }
584 589
 
585 590
 
... ...
@@ -624,26 +629,28 @@ clone_repositories()
624 629
 
625 630
 update()
626 631
 {
627
-   local clone
632
+   local clonedir
628 633
    local name
629 634
    local tag
630 635
    local dstname
631 636
 
632
-   clone="$1"
637
+   clonedir="$1"
633 638
    name="$2"
634 639
    dstname="$3"
635 640
    tag="$4"
636 641
 
637
-   [ -z "$clone" ]    && internal_fail "clone is empty"
638
-   [ -z "$name" ]     && internal_fail "name is empty"
639
-   [ -z "$dstname" ]  && internal_fail "dstname is empty"
642
+   [ -d "$clonedir" ]   || internal_fail "clonedir \"${clonedir}\" is wrong ($PWD)"
643
+   [ ! -z "$name" ]     || internal_fail "name is empty"
644
+   [ ! -z "$dstname" ]  ||internal_fail "dstname is empty"
640 645
 
641 646
    local script
642 647
 
643 648
    log_info "Updating \"${dstname}\""
644 649
    if [ ! -L "${dstname}"  ]
645 650
    then
646
-      script="`read_repo_setting "${name}" "bin/update.sh"`"
651
+      run_repo_settings_script "${clonedir}" "${name}" "pre-update" "%@"
652
+
653
+      script="`find_repo_setting_file "${name}" "bin/update.sh"`"
647 654
       if [ ! -z "${script}" ]
648 655
       then
649 656
          run_script "${script}" "$@"
... ...
@@ -651,35 +658,31 @@ update()
651 658
          exekutor git_pull "${dstname}" "${tag}"
652 659
       fi
653 660
 
654
-      script="`read_repo_setting "${name}" "bin/post-update.sh"`"
655
-      if [ ! -z "${script}" ]
656
-      then
657
-         run_script "${script}" "$@"
658
-      fi
661
+      run_repo_settings_script "${clonedir}"  "${name}" "post-update" "%@"
659 662
    fi
660 663
 }
661 664
 
662 665
 
663 666
 update_repository()
664 667
 {
665
-   local clone
668
+   local clonedir
666 669
 
667
-   clone="$1"
670
+   clonedir="$1"
668 671
 
669 672
    local name
670 673
    local tag
671 674
    local dstname
672 675
 
673
-   name="`basename "${clone}" .git`"
676
+   name="`basename "${clonedir}" .git`"
674 677
    tag="`read_repo_setting "${name}" "tag"`" #repo (sic)
675 678
 
676 679
    dstname="${CLONES_FETCH_SUBDIR}/${name}"
677 680
    exekutor [ -e "${dstname}" ] || fail "You need to install first, before updating"
678 681
    exekutor [ -x "${dstname}" ] || fail "${name} is not anymore in \"gits\""
679 682
 
680
-   log_fetch_action "${clone}" "${dstname}"
683
+   log_fetch_action "${clonedir}" "${dstname}"
681 684
 
682
-   update "${clone}" "${name}" "${dstname}" "${tag}"
685
+   update "${clonedir}" "${name}" "${dstname}" "${tag}"
683 686
 }
684 687
 
685 688
 
... ...
@@ -716,8 +719,6 @@ update_repositories()
716 719
 }
717 720
 
718 721
 
719
-
720
-
721 722
 #
722 723
 # Use brews for stuff we don't tag
723 724
 #
... ...
@@ -885,12 +886,10 @@ install_pips()
885 886
 main()
886 887
 {
887 888
    log_fluff "::: fetch :::"
889
+
888 890
    #
889 891
    # Run prepare scripts if present
890 892
    #
891
-   run_fetch_settings_script "pre-${COMMAND}"
892
-
893
-
894 893
    if [ "${COMMAND}" = "install" ]
895 894
    then
896 895
       clone_repositories "$@"
... ...
@@ -906,7 +905,7 @@ main()
906 905
    #
907 906
    # Run prepare scripts if present
908 907
    #
909
-   run_fetch_settings_script "post-${COMMAND}"
908
+   run_fetch_settings_script "post-${COMMAND}" "%@"
910 909
 }
911 910
 
912 911
 main "$@"
... ...
@@ -39,7 +39,9 @@ then
39 39
    C_YELLOW="\033[0;33m"  C_BLUE="\033[0;34m"   C_MAGENTA="\033[0;35m"
40 40
    C_CYAN="\033[0;36m"    C_WHITE="\033[0;37m"  C_BR_BLACK="\033[0;90m"
41 41
 
42
-   trap 'echo "${C_RESET}"' TERM EXIT
42
+   C_BR_RED="\033[0;91m"
43
+
44
+   trap 'printf "${C_RESET}"' TERM EXIT
43 45
 fi
44 46
 
45 47
 
... ...
@@ -106,8 +108,7 @@ fail()
106 108
 
107 109
 internal_fail()
108 110
 {
109
-   fail "**** mulle-bootstrap internal error ****
110
-$*"
111
+   fail "${C_BR_RED}*** internal error: ${C_RED}$*"
111 112
 }
112 113
 
113 114
 
... ...
@@ -478,7 +479,7 @@ run_script()
478 479
    script="$1"
479 480
    shift
480 481
 
481
-   [ -z "$script" ] && internal_fail "script is empty"
482
+   [ ! -z "$script" ] || internal_fail "script is empty"
482 483
 
483 484
    if [ -x "${script}" ]
484 485
    then
... ...
@@ -487,7 +488,7 @@ run_script()
487 488
    else
488 489
       if [ ! -e "${script}" ]
489 490
       then
490
-         fail "script \"${script}\" not found"
491
+         fail "script \"${script}\" not found ($PWD)"
491 492
       else
492 493
          fail "script \"${script}\" not executable"
493 494
       fi
... ...
@@ -74,6 +74,7 @@ CLONES_SUBDIR=`read_sane_config_path_setting "repos_foldername" ".repos"`
74 74
 CLONESBUILD_SUBDIR=`read_sane_config_path_setting "build_foldername" "build/.repos"`
75 75
 DEPENDENCY_SUBDIR=`read_sane_config_path_setting "output_foldername" "dependencies"`
76 76
 
77
+
77 78
 if [ "${CLONES_FETCH_SUBDIR}" = "" ]
78 79
 then
79 80
    CLONES_FETCH_SUBDIR="${CLONES_SUBDIR}"
... ...
@@ -109,3 +110,14 @@ HEADER_DIR_NAME="`read_config_setting "header_dir_name" "include"`"
109 110
 LIBRARY_DIR_NAME="`read_config_setting "library_dir_name" "lib"`"
110 111
 FRAMEWORK_DIR_NAME="`read_config_setting "framework_dir_name" "Frameworks"`"
111 112
 
113
+
114
+#
115
+# export stuff for scripts
116
+#
117
+export CLONES_SUBDIR
118
+export CLONES_FETCH_SUBDIR
119
+export CLONESBUILD_SUBDIR
120
+export DEPENDENCY_SUBDIR
121
+export HEADER_DIR_NAME
122
+export LIBRARY_DIR_NAME
123
+export FRAMEWORK_DIR_NAME
112 124
new file mode 100644
... ...
@@ -0,0 +1,195 @@
1
+#! /bin/sh
2
+#
3
+#   Copyright (c) 2015 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#
31
+
32
+find_fetch_setting_file()
33
+{
34
+   local value
35
+   local flag
36
+
37
+   READ_SETTING_RETURNS_PATH="YES"
38
+   export READ_SETTING_RETURNS_PATH
39
+
40
+   value="`read_fetch_setting "$@"`"
41
+   flag=$?
42
+
43
+   READ_SETTING_RETURNS_PATH="NO"
44
+
45
+   echo "$value"
46
+   return $flag
47
+}
48
+
49
+
50
+find_repo_setting_file()
51
+{
52
+   local value
53
+   local flag
54
+
55
+   READ_SETTING_RETURNS_PATH="YES"
56
+   export READ_SETTING_RETURNS_PATH
57
+
58
+   value="`read_repo_setting "$@"`"
59
+   flag=$?
60
+
61
+   READ_SETTING_RETURNS_PATH="NO"
62
+
63
+   echo "$value"
64
+   return $flag
65
+}
66
+
67
+
68
+find_build_root_setting_file()
69
+{
70
+   local value
71
+   local flag
72
+
73
+   READ_SETTING_RETURNS_PATH="YES"
74
+   export READ_SETTING_RETURNS_PATH
75
+
76
+   value="`read_build_root_setting "$@"`"
77
+   flag=$?
78
+
79
+   READ_SETTING_RETURNS_PATH="NO"
80
+
81
+   echo "$value"
82
+   return $flag
83
+}
84
+
85
+
86
+find_build_setting_file()
87
+{
88
+   local value
89
+   local flag
90
+
91
+   READ_SETTING_RETURNS_PATH="YES"
92
+   export READ_SETTING_RETURNS_PATH
93
+
94
+   value="`read_build_setting "$@"`"
95
+   flag=$?
96
+
97
+   READ_SETTING_RETURNS_PATH="NO"
98
+
99
+   echo "$value"
100
+   return $flag
101
+}
102
+
103
+
104
+is_inherited_setting_file()
105
+{
106
+   echo "$1" | egrep -q -s "^${BOOTSTRAP_SUBDIR}.auto"
107
+}
108
+
109
+
110
+
111
+run_build_root_settings_script()
112
+{
113
+   local  name
114
+
115
+   scriptname="$1"
116
+   shift
117
+
118
+   [ -z "$scriptname" ] && internal_fail "scriptname is empty"
119
+
120
+   local script
121
+
122
+   script="`find_build_root_setting_file "bin/${scriptname}.sh"`"
123
+   if [ ! -z "${script}" ]
124
+   then
125
+      run_script "${script}" "%@"
126
+   fi
127
+}
128
+
129
+
130
+# run in subshell
131
+run_fake_environment_script()
132
+{
133
+   local clonedir
134
+   local script
135
+
136
+   clonedir="$1"
137
+   shift
138
+   script="$1"
139
+   shift
140
+
141
+   ( owd="`pwd -P`"; cd "${clonedir}" ;
142
+   CLONES_SUBDIR="${owd}/${CLONES_SUBDIR}" \
143
+   CLONESBUILD_SUBDIR="${owd}/${CLONESBUILD_SUBDIR}" \
144
+   DEPENDENCY_SUBDIR="${owd}/${DEPENDENCY_SUBDIR}" \
145
+   run_script "${owd}/${script}" "$@" ) || exit 1
146
+}
147
+
148
+
149
+# repo setting scripts are treated as if inherrited
150
+run_repo_settings_script()
151
+{
152
+   local name
153
+   local scriptname
154
+   local clonedir
155
+
156
+   clonedir="$1"
157
+   shift
158
+   name="$1"
159
+   shift
160
+   scriptname="$1"
161
+   shift
162
+
163
+   [ -d "$clonedir" ]     || internal_fail "clonedir \"${clonedir}\" is wrong ($PWD)"
164
+   [ ! -z "$name" ]       || internal_fail "name is empty"
165
+   [ ! -z "$scriptname" ] || internal_fail "scriptname is empty"
166
+
167
+   local script
168
+
169
+   script="`find_repo_setting_file "${name}" "bin/${scriptname}.sh"`"
170
+   if [ ! -z "${script}" ]
171
+   then
172
+      run_fake_environment_script "${clonedir}" "${script}" "$@" || exit 1
173
+   fi
174
+}
175
+
176
+
177
+run_fetch_settings_script()
178
+{
179
+   local  scriptname
180
+
181
+   scriptname="$1"
182
+   shift
183
+
184
+   [ -z "$scriptname" ] && internal_fail "scriptname is empty"
185
+
186
+   local script
187
+
188
+   script="`find_fetch_setting_file "bin/${scriptname}.sh"`"
189
+   if [ ! -z "${script}" ]
190
+   then
191
+      run_script "${script}" "$@"
192
+      return $?
193
+   fi
194
+   return 0
195
+}
... ...
@@ -86,12 +86,13 @@ _read_setting()
86 86
    if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
87 87
    then
88 88
       local  yesno
89
+
89 90
       yesno="not found"
90 91
       if [ $flag -eq 0 ]
91 92
       then
92 93
          yesno="found"
93 94
       fi
94
-      log_trace2 "Looking for setting: ${file} (pwd=$PWD) :  $yesno"
95
+      log_trace2 "Looking for setting: ${file} (pwd=$PWD) : $yesno"
95 96
    fi
96 97
 
97 98
    if [ $flag -eq 1 ]
... ...
@@ -99,10 +100,19 @@ _read_setting()
99 100
       return 2
100 101
    fi
101 102
 
102
-   value=`egrep -v '^#|^[ ]*$' "${file}"`
103
-   if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
103
+   if [ "${READ_SETTING_RETURNS_PATH}" = "YES" ]
104 104
    then
105
-      log_fluff "Setting ${C_MAGENTA}`basename "${file}"`${C_FLUFF} found in ${C_WHITE}\"${file}\"${C_FLUFF} to ${C_MAGENTA}\"${value}\"${C_FLUFF}"
105
+      value="${file}"
106
+      if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
107
+      then
108
+         log_fluff "${C_MAGENTA}`basename "${file}"`${C_FLUFF} found as ${C_WHITE}\"${file}\"${C_FLUFF}${C_FLUFF}"
109
+      fi
110
+   else
111
+      value=`egrep -v '^#|^[ ]*$' "${file}"`
112
+      if [ "$MULLE_BOOTSTRAP_VERBOSE" = "YES"  ]
113
+      then
114
+         log_fluff "Setting ${C_MAGENTA}`basename "${file}"`${C_FLUFF} found in ${C_WHITE}\"${file}\"${C_FLUFF} as ${C_MAGENTA}\"${value}\"${C_FLUFF}"
115
+      fi
106 116
    fi
107 117
 
108 118
    case "${file}" in
... ...
@@ -133,7 +143,7 @@ _read_environment_setting()
133 143
 
134 144
    envname="MULLE_BOOTSTRAP_`echo "${name}" | tr '[:lower:]' '[:upper:]'`"
135 145
 
136
-   if [ "$MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS" = "YES" ]
146
+   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
137 147
    then
138 148
       log_trace2 "Looking for setting ${name} as environment variable ${envname}"
139 149
    fi
... ...
@@ -144,7 +154,7 @@ _read_environment_setting()
144 154
       return 2
145 155
    fi
146 156
 
147
-   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
157
+   if [ "${MULLE_BOOTSTRAP_VERBOSE}" = "YES" ]
148 158
    then
149 159
       log_trace "setting ${name} found in environment variable ${envname} as \"${value}\""
150 160
    fi
... ...
@@ -168,7 +178,7 @@ _read_local_setting()
168 178
 
169 179
    [ "$name" = "" ] && internal_fail "missing parameters in _read_local_setting"
170 180
 
171
-   if [ "$MULLE_BOOTSTRAP_TRACE_ACCESS_SETTINGS" = "YES" ]
181
+   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
172 182
    then
173 183
       log_trace2 "Looking for setting ${name} in ~/.mulle-bootstrap"
174 184
    fi
... ...
@@ -179,7 +189,7 @@ _read_local_setting()
179 189
       return 2
180 190
    fi
181 191
 
182
-   if [ "$MULLE_BOOTSTRAP_TRACE_SETTINGS" = "YES" ]
192
+   if [ "${MULLE_BOOTSTRAP_VERBOSE}" = "YES" ]
183 193
    then
184 194
       log_trace "setting ${name} found in ~/.mulle-bootstrap as \"${value}\""
185 195
    fi
... ...
@@ -234,7 +244,8 @@ _read_repo_setting()
234 244
    package="$1"
235 245
    name="$2"
236 246
 
237
-   [ "$name" = "" -o "$package" = "" ] && internal_fail "missing parameters in read_repo_setting"
247
+   [ ! -z "$name" ]    || internal_fail "empty name in _read_repo_setting( $*)"
248
+   [ ! -z "$package" ] || internal_fail "empty package in _read_repo_setting( $*)"
238 249
 
239 250
    # need to conserve return value 2 if empty
240 251
    _read_bootstrap_setting  "settings/${package}/${name}" ".local" "" ".auto"
... ...
@@ -253,7 +264,7 @@ _read_build_setting()
253 264
 #
254 265
 read_config_setting()
255 266
 {
256
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
267
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
257 268
    then
258 269
       set +x
259 270
    fi
... ...
@@ -284,7 +295,7 @@ read_config_setting()
284 295
 
285 296
    echo "$value"
286 297
 
287
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
298
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
288 299
    then
289 300
       set -x
290 301
    fi
... ...
@@ -296,7 +307,7 @@ read_config_setting()
296 307
 
297 308
 read_build_setting()
298 309
 {
299
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
310
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
300 311
    then
301 312
       set +x
302 313
    fi
... ...
@@ -324,7 +335,7 @@ read_build_setting()
324 335
    fi
325 336
    echo "$value"
326 337
 
327
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
338
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
328 339
    then
329 340
       set -x
330 341
    fi
... ...
@@ -336,7 +347,7 @@ read_build_setting()
336 347
 
337 348
 read_repo_setting()
338 349
 {
339
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
350
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
340 351
    then
341 352
       set +x
342 353
    fi
... ...
@@ -361,7 +372,7 @@ read_repo_setting()
361 372
 
362 373
    echo "$value"
363 374
 
364
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
375
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
365 376
    then
366 377
       set -x
367 378
    fi
... ...
@@ -373,7 +384,7 @@ read_repo_setting()
373 384
 
374 385
 read_build_root_setting()
375 386
 {
376
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
387
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
377 388
    then
378 389
       set +x
379 390
    fi
... ...
@@ -395,7 +406,7 @@ read_build_root_setting()
395 406
 
396 407
    echo "$value"
397 408
 
398
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
409
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
399 410
    then
400 411
       set -x
401 412
    fi
... ...
@@ -407,7 +418,7 @@ read_build_root_setting()
407 418
 
408 419
 read_fetch_setting()
409 420
 {
410
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
421
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
411 422
    then
412 423
       set +x
413 424
    fi
... ...
@@ -427,7 +438,7 @@ read_fetch_setting()
427 438
 
428 439
    echo "$value"
429 440
 
430
-   if [ "{MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
441
+   if [ "${MULLE_BOOTSTRAP_SETTINGS_FLIP_X}" = "YES" ]
431 442
    then
432 443
       set -x
433 444
    fi
... ...
@@ -477,6 +488,11 @@ read_sane_config_path_setting()
477 488
 }
478 489
 
479 490
 
491
+
492
+###
493
+#
494
+#
495
+
480 496
 all_build_flag_keys()
481 497
 {
482 498
    local keys1
... ...
@@ -36,7 +36,7 @@
36 36
 #
37 37
 
38 38
 . mulle-bootstrap-local-environment.sh
39
-
39
+. mulle-bootstrap-scripts.sh
40 40
 
41 41
 usage()
42 42
 {
... ...
@@ -144,28 +144,17 @@ ensure_repos_clean()
144 144
 }
145 145
 
146 146
 
147
-pretag_script()
148
-{
149
-   #
150
-   # Run pre-tag scripts if present
151
-   #
152
-   script=`read_fetch_setting "bin/pre-tag.sh"`
153
-   if [ -x "${script}" ]
154
-   then
155
-      exekutor "${script}" || exit 1
156
-   fi
157
-}
158
-
159
-
160 147
 tag()
161 148
 {
162 149
    local i
163 150
    local script
164 151
 
165
-   script=`read_fetch_setting "bin/tag.sh"`
152
+   run_fetch_settings_script "pre-tag"
153
+
154
+   script=`find_fetch_setting_file "bin/tag.sh"`
166 155
    if [ -x "$script" ]
167 156
    then
168
-      exekutor "$script" "${TAG}" "${REPO}" || exit 1
157
+      run_script "$script" "${TAG}" "${REPO}" || exit 1
169 158
    else
170 159
       log_info "Tagging \"`basename "${REPO}"`\" with \"${TAG}\""
171 160
       ( cd "${REPO}" ; exekutor git tag "${TAG}" ) || exit 1
... ...
@@ -185,19 +174,8 @@ tag()
185 174
          done
186 175
       fi
187 176
    fi
188
-}
189 177
 
190
-
191
-posttag_script()
192
-{
193
-   #
194
-   # Run post-tag scripts if present
195
-   #
196
-   script=`read_fetch_setting "bin/post-tag.sh"`
197
-   if [ -x "${script}" ]
198
-   then
199
-      exekutor "${script}" || exit 1
200
-   fi
178
+   run_fetch_settings_script "pre-tag"
201 179
 }
202 180
 
203 181
 
... ...
@@ -216,9 +194,7 @@ main()
216 194
    user_say_yes "Is this OK ?"
217 195
    if [ $? -eq 0 ]
218 196
    then
219
-      pretag_script
220 197
       tag
221
-      posttag_script
222 198
    fi
223 199
 }
224 200
 
... ...
@@ -75,10 +75,10 @@ warn_scripts()
75 75
    if [ -d "$1" ]
76 76
    then
77 77
       scripts=`find "$1" -name "*.sh" \( -perm +u+x -o -perm +g+x -o -perm +o+x \) -type f -print`
78
-      if [ "$scripts" != "" ]
78
+      if [ ! -z "${scripts}" ]
79 79
       then
80 80
          echo "this .bootstrap contains shell scripts:" >&2
81
-         for i in `$scripts`
81
+         echo $scripts | while read i
82 82
          do
83 83
             echo "$i:" >&2
84 84
             echo "--------------------------------------------------------" >&2
... ...
@@ -96,11 +96,12 @@ warn_scripts()
96 96
       if private_dir_has_files "$2"
97 97
       then
98 98
          phases=`(find "$2"/* -name "project.pbxproj" -exec grep -q 'PBXShellScriptBuildPhase' '{}'  \; -print)`
99
-         if [ "$phases" != "" ]
99
+         if [ ! -z "${phases}" ]
100 100
          then
101 101
             echo "this repository contains xcode projects with shellscript phases" >&2
102
+
102 103
             ack=`which ack`
103
-            if [ "$ack" = "" ]
104
+            if [ -z "${ack}" ]
104 105
             then
105 106
                echo "brew install ack ; ack -A1 \"shellPath|shellScript\"" >&2
106 107
                echo "$phases" >&2
... ...
@@ -1,7 +1,33 @@
1 1
 #! /bin/sh
2
+#   Copyright (c) 2015 Nat! - Mulle kybernetiK
3
+#   All rights reserved.
2 4
 #
3
-# (c) 2015, coded by Nat!, Mulle KybernetiK
5
+#   Redistribution and use in source and binary forms, with or without
6
+#   modification, are permitted provided that the following conditions are met:
4 7
 #
8
+#   Redistributions of source code must retain the above copyright notice, this
9
+#   list of conditions and the following disclaimer.
10
+#
11
+#   Redistributions in binary form must reproduce the above copyright notice,
12
+#   this list of conditions and the following disclaimer in the documentation
13
+#   and/or other materials provided with the distribution.
14
+#
15
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
16
+#   may be used to endorse or promote products derived from this software
17
+#   without specific prior written permission.
18
+#
19
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+#
30
+
5 31
 # this script patches the xcodeproj so that the headers and
6 32
 # lib files can be added in a sensible order
7 33
 #