Browse code

add -c flag Always remember embedded repositories, even if already present. Fix a regresstion in graveyard restore.

Nat! authored on 25-09-2016 11:40:14
Showing 4 changed files
... ...
@@ -1,25 +1,26 @@
1 1
 2.1
2 2
 ===
3 3
 
4
-This version has some additions, that enable a more flexible use of
5
-embedded repositories to "compose" source trees. It also now contains
6
-better fecth and build code, so that dependencies, that are installed in
7
-/usr/local already need not be fetched again. This can be helpful, when used
8
-to build brew packages (for example).
4
+**The changes should be harmless, but to be safe
5
+`mulle-bootstrap dist clean` your projects**
6
+
9 7
 
8
+This version has some additions, that enable a more flexible use of
9
+embedded repositories to "compose" source trees. Up till 2.1 embedded
10
+repositories were always placed into the project root. Now you can
11
+specify the subdirectory like "src/embedded/foo" (relative to project root).
10 12
 
11
-**The changes should be transparent, but to be safe `mulle-bootstrap dist clean`
12
-your projects**
13
+Better fetch and build code checks, that dependencies, that are
14
+installed in /usr/local already need not be fetched again. This can
15
+be helpful, when building brew packages (for example).
13 16
 
14 17
 * fixed a problem in the parsing of the repositories file
15
-* embedded repositories can now be placed at an arbitrary position within your
16
-project tree
18
+* embedded repositories can now be placed at an arbitrary position within your project tree
17 19
 * changes in deeply embedded repositories are now better tracked
18 20
 * fixed some as of yet unknown bugs, by improving some path functions
19
-* new -c switch to enable checking /usr/local/include for dependency libraries
20
-conveniently from the command line. Fix build to add /usr/local/include to
21
-build, if check_usr_local_include is YES.
21
+* new -c switch to enable checking `/usr/local/include for dependency libraries conveniently from the command line. Fix build to add /usr/local/include to build, if check_usr_local_include is YES.
22 22
 * allow build and fetch options to be passed to `bootstrap`
23
+* improved comments in repositories and embedded_repositories templates
23 24
 
24 25
 
25 26
 2.0.1
... ...
@@ -187,6 +187,10 @@ bootstrap_main()
187 187
             MULLE_BOOTSTRAP_ANSWER="NO"
188 188
           ;;
189 189
 
190
+         -c|--check-usr-local-include)
191
+            MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="YES"
192
+         ;;
193
+
190 194
          -y|--prefer-local)
191 195
             MULLE_BOOTSTRAP_ANSWER="YES"
192 196
          ;;
... ...
@@ -199,10 +203,6 @@ bootstrap_main()
199 203
             MULLE_EXECUTOR_DRY_RUN="YES"
200 204
          ;;
201 205
 
202
-         -is|--ignore-system)
203
-            MULLE_BOOTSTRAP_CHECK_USR_LOCAL_INCLUDE="NO"
204
-         ;;
205
-
206 206
          -ig|--ignore-graveyard)
207 207
             MULLE_BOOTSTRAP_IGNORE_GRAVEYARD="YES"
208 208
          ;;
... ...
@@ -701,7 +701,7 @@ checkout_repository()
701 701
       if [ "${MULLE_BOOTSTRAP_IGNORE_GRAVEYARD}" != "YES" -a -d "${CLONESFETCH_SUBDIR}/.graveyard/${name}" ]
702 702
       then
703 703
          log_info "Restoring ${name} from graveyard"
704
-         exekutor mv "${CLONESFETCH_SUBDIR}/.graveyard/${name}" "${CLONESFETCH_SUBDIR}" || fail "move failed"         ensure_clone_branch_is_correct "${dstdir}" "${branch}"
704
+         exekutor mv "${CLONESFETCH_SUBDIR}/.graveyard/${name}" "${CLONESFETCH_SUBDIR}" || fail "move failed"
705 705
          ensure_clone_branch_is_correct "${dstdir}" "${branch}"
706 706
       else
707 707
          checkout "$@"
... ...
@@ -1167,6 +1167,39 @@ append_dir_to_gitignore_if_needed()
1167 1167
 }
1168 1168
 
1169 1169
 
1170
+#
1171
+# memorize how we embedded the repository, need URL to identify
1172
+# and the subdir, where it was stored
1173
+#
1174
+# store it inside the possibly recursed dstprefix dependency
1175
+#
1176
+remember_embedded_repository()
1177
+{
1178
+   local dstprefix
1179
+   local name
1180
+   local url
1181
+   local subdir
1182
+
1183
+   dstprefix="$1"
1184
+   name="$2"
1185
+   url="$3"
1186
+   subdir="$4"
1187
+
1188
+   local content
1189
+   local embeddeddir
1190
+   local content
1191
+
1192
+   embeddeddir="${dstprefix}${CLONESFETCH_SUBDIR}/.embedded"
1193
+   mkdir_if_missing "${embeddeddir}"
1194
+   content="${subdir}
1195
+${url}"
1196
+
1197
+   # dont't use symlinks anymore
1198
+   log_fluff "Remember embedded repository \"${name}\" via \"${embeddeddir}/${name}\""
1199
+   exekutor echo "${content}" > "${embeddeddir}/${name}"
1200
+}
1201
+
1202
+
1170 1203
 clone_embedded_repository()
1171 1204
 {
1172 1205
    local dstprefix
... ...
@@ -1233,29 +1266,17 @@ clone_embedded_repository()
1233 1266
          fetch__run_build_settings_script "${name}" "${url}" "${dstdir}" "post-${COMMAND}" "$@"
1234 1267
       fi
1235 1268
 
1236
-      #
1237
-      # memorize how we embedded the repository, need URL to identify
1238
-      # and the subdir, where it was stored
1239
-      #
1240
-      # store it inside the possibly recursed dstprefix dependency
1241
-      #
1242
-      local content
1243
-      local embeddeddir
1244
-
1245
-      embeddeddir="${dstprefix}${CLONESFETCH_SUBDIR}/.embedded"
1246
-      mkdir_if_missing "${embeddeddir}"
1247
-      content="${subdir}
1248
-${url}"
1249
-
1250
-      # dont't use symlinks anymore
1251
-      log_fluff "Remember embedded repository \"${name}\" via \"${embeddeddir}/${name}\""
1252
-      exekutor echo "${content}" > "${embeddeddir}/${name}"
1253 1269
    else
1254 1270
       ensure_clone_branch_is_correct "${dstdir}" "${branch}"
1255 1271
 
1256 1272
       log_fluff "Repository \"${dstdir}\" already exists"
1257 1273
    fi
1258 1274
 
1275
+   #
1276
+   # always memorize, even if existed, which could be a clean gone wrong
1277
+   #
1278
+   remember_embedded_repository "${dstprefix}" "${name}" "${url}" "${subdir}"
1279
+
1259 1280
    remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1260 1281
 }
1261 1282
 
... ...
@@ -1270,13 +1291,12 @@ clone_embedded_repositories()
1270 1291
    local clone
1271 1292
    local old
1272 1293
 
1273
-   old="${IFS:-" "}"
1274
-
1275 1294
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES"
1276 1295
 
1277 1296
    clones="`read_fetch_setting "embedded_repositories"`"
1278
-   if [ "${clones}" != "" ]
1297
+   if [ ! -z "${clones}" ]
1279 1298
    then
1299
+      old="${IFS:-" "}"
1280 1300
       IFS="
1281 1301
 "
1282 1302
       for clone in ${clones}
... ...
@@ -1288,10 +1308,9 @@ clone_embedded_repositories()
1288 1308
 
1289 1309
       remove_file_if_present "${CLONESFETCH_SUBDIR}/.fetch_update_started"
1290 1310
 
1311
+      IFS="${old}"
1291 1312
    fi
1292 1313
 
1293
-   IFS="${old}"
1294
-
1295 1314
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO=
1296 1315
 }
1297 1316
 
... ...
@@ -1318,7 +1337,6 @@ update_embedded_repositories()
1318 1337
 
1319 1338
    MULLE_BOOTSTRAP_SETTINGS_NO_AUTO="YES"
1320 1339
 
1321
-   set -x
1322 1340
    clones="`read_fetch_setting "embedded_repositories"`"
1323 1341
    clones="`echo "${clones}" | sed '1!G;h;$!d'`"  # reverse lines
1324 1342
 
... ...
@@ -133,19 +133,22 @@ init_main()
133 133
 # mulle-bootstrap [build] will then build them into "${DEPENDENCY_SUBDIR}"
134 134
 #
135 135
 # Each line consists of four fields, only the URL is necessary.
136
-#
137
-# URL;NAME;TAG;SCM
138
-# ================
139
-# ex. foo.com/bla.git;mybla;master;git
140
-# ex. foo.com/bla.svn;;;svn
141
-#
142
-# Possible URLS for repositories:
136
+# Possible URL forms for repositories:
143 137
 #
144 138
 # https://www.mulle-kybernetik.com/repositories/MulleScion
145 139
 # git@github.com:mulle-nat/MulleScion.git
146 140
 # ../MulleScion
147 141
 # /Volumes/Source/srcM/MulleScion
148 142
 #
143
+# The NAME should only be used, if you have an actual name conflict
144
+# in your dependencies. TAG can be a git branch or a tag. SCM can
145
+# be git or svn.
146
+#
147
+# URL;NAME;TAG;SCM
148
+# ================
149
+# ex. foo.com/bla.git;bla2;release;git
150
+# ex. foo.com/bla.svn;;;svn
151
+#
149 152
 EOF
150 153
 
151 154
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/embedded_repositories"
... ...
@@ -156,19 +159,23 @@ EOF
156 159
 # mulle-bootstrap [build] will NOT build them
157 160
 #
158 161
 # Each line consists of four fields, only the URL is necessary.
159
-#
160
-# URL;NAME;TAG;SCM
161
-# ================
162
-# ex. foo.com/bla.git;mybla;master;git
163
-# ex. foo.com/bla.svn;;;svn
164
-#
165
-# Possible URLS for repositories:
162
+# Possible URL forms for repositories:
166 163
 #
167 164
 # https://www.mulle-kybernetik.com/repositories/MulleScion
168 165
 # git@github.com:mulle-nat/MulleScion.git
169 166
 # ../MulleScion
170 167
 # /Volumes/Source/srcM/MulleScion
171 168
 #
169
+# With SUBDIR you can place the embedded repository somewhere in your
170
+# project directory structure. TAG can be a git branch or a tag. SCM can
171
+# be git or svn.
172
+#
173
+# URL;SUBDIR;TAG;SCM
174
+# ================
175
+# ex. foo.com/bla.git;src/mybla;release;git
176
+# ex. foo.com/bla.svn;;;svn
177
+#
178
+#
172 179
 EOF
173 180
       exekutor cat <<EOF > "${BOOTSTRAP_SUBDIR}/brews"
174 181
 #