Browse code

Fix bug when repository entry is a full path and it gets symlinked. Improve cmake example.

Nat! authored on 12-01-2017 15:59:12
Showing 4 changed files
... ...
@@ -1,10 +1,14 @@
1
+### 2.6.1
2
+
3
+* fix bug with absolute paths
4
+
5
+
1 6
 ## 2.6.0
2 7
 
3 8
 * mulle-bootstrap announces itself to cmake with -DMULLE_BOOTSTRAP_VERSION
4 9
 
5 10
 ### 2.5.2
6 11
 
7
-
8 12
 * -v -h gives more help
9 13
 * renamed -tt  to -tit and -tp to -tip, because it's more logical
10 14
 
... ...
@@ -13,32 +13,31 @@ project (Foo)
13 13
 ## mulle-bootstrap environment
14 14
 ##
15 15
 
16
-# check if compiling with mulle-bootstrap (works since 2.6)
16
+if( NOT DEPENDENCIES_DIR)
17
+  set( DEPENDENCIES_DIR dependencies)
18
+endif()
19
+
20
+if( NOT ADDICTIONS_DIR)
21
+  set( ADDICTIONS_DIR addictions)
22
+endif()
17 23
 
18
-if( NOT MULLE_BOOTSTRAP_VERSION)
19 24
   include_directories( BEFORE SYSTEM
20
-dependencies/include
21
-addictions/include
25
+"${DEPENDENCIES_DIR}/include"
26
+"${ADDICTIONS_DIR}/include"
22 27
 )
23 28
 
24 29
   set( CMAKE_FRAMEWORK_PATH
25
-dependencies/Frameworks
26
-addictions/Frameworks
30
+"${DEPENDENCIES_DIR}/Frameworks"
31
+"${ADDICTIONS_DIR}/Frameworks"
27 32
 ${CMAKE_FRAMEWORK_PATH}
28 33
 )
29 34
 
30 35
   set( CMAKE_LIBRARY_PATH
31
-dependencies/lib
32
-addictions/lib
36
+"${DEPENDENCIES_DIR}/lib"
37
+"${ADDICTIONS_DIR}/lib"
33 38
 ${CMAKE_LIBRARY_PATH}
34 39
 )
35 40
 
36
-set( DEPENDENCIES_DIR dependencies)
37
-set( ADDICTIONS_DIR addictions)
38
-
39
-endif()
40
-
41
-
42 41
 
43 42
 ##
44 43
 ## Foo framework
... ...
@@ -30,7 +30,7 @@
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_BOOTSTRAP_VERSION_MAJOR=2
32 32
 MULLE_BOOTSTRAP_VERSION_MINOR=6
33
-MULLE_BOOTSTRAP_VERSION_PATCH=0
33
+MULLE_BOOTSTRAP_VERSION_PATCH=1
34 34
 
35 35
 MULLE_BOOTSTRAP_VERSION="${MULLE_BOOTSTRAP_VERSION_MAJOR}.${MULLE_BOOTSTRAP_VERSION_MINOR}.${MULLE_BOOTSTRAP_VERSION_PATCH}"
36 36
 MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap"
... ...
@@ -255,18 +255,43 @@ link_command()
255 255
 {
256 256
    local src
257 257
    local dst
258
+   local branch
258 259
    local tag
259 260
 
260 261
    src="$1"
261 262
    dst="$2"
262
-   tag="$3"
263
+   branch="$3"
264
+   tag="$4"
265
+
266
+   local branchlabel
267
+
268
+   branchlabel="branch"
269
+   if [ -z "${branch}" -a ! -z "${tag}" ]
270
+   then
271
+      branchlabel="tag"
272
+      branch="${tag}"
273
+   fi
263 274
 
264 275
    local dstdir
276
+   local linkname
277
+   local srcname
278
+
279
+   srcname="`basename -- ${src}`"
280
+   linkname="`basename -- ${dst}`"
265 281
    dstdir="`dirname -- "${dst}"`"
266 282
 
267
-   if [ ! -e "${dstdir}/${src}" -a "${MULLE_EXECUTOR_DRY_RUN}" != "YES" ]
283
+
284
+   if [ "${MULLE_EXECUTOR_DRY_RUN}" != "YES" ]
268 285
    then
269
-      fail "${C_RESET}${C_BOLD}${dstdir}/${src}${C_ERROR} does not exist ($PWD)"
286
+      local owd
287
+
288
+      owd="`pwd -P`"
289
+      cd "${dstdir}"
290
+      if [ ! -e "${src}" ]
291
+      then
292
+         fail "${C_RESET}${C_BOLD}${src}${C_ERROR} does not exist ($PWD)"
293
+      fi
294
+      cd "${owd}"
270 295
    fi
271 296
 
272 297
    if [ "${COMMAND}" = "fetch" ]
... ...
@@ -285,22 +310,17 @@ link_command()
285 310
          src="${real}"
286 311
       fi
287 312
 
288
-      log_info "Symlinking ${C_MAGENTA}${C_BOLD}`basename -- ${src}`${C_INFO} ..."
289
-      exekutor ln -s -f "$src" "$dst" || fail "failed to setup symlink \"$dst\" (to \"$src\")"
313
+      log_info "Symlinking ${C_MAGENTA}${C_BOLD}${srcname}${C_INFO} ..."
314
+      exekutor ln -s -f "${src}" "${dst}" || fail "failed to setup symlink \"${dst}\" (to \"${src}\")"
290 315
 
291
-      if [ "$tag" != "" ]
316
+      if [ -z "${branch}" ]
292 317
       then
293
-         local name
294
-
295
-         name="`basename -- "${dst}"`"
296
-         log_warning "The intended tag ${C_RESET_BOLD}${tag}${C_WARNING} will be ignored, because"
318
+         log_warning "The intended ${branchlabel} ${C_RESET_BOLD}${branch}${C_WARNING} will be ignored, because"
297 319
          log_warning "the repository is symlinked."
298
-         log_warning "If you want to checkout this tag do:"
299
-         log_warning "${C_RESET_BOLD}(cd .repos/${name}; git checkout ${GITOPTIONS} \"${tag}\" )${C_WARNING}"
320
+         log_warning "If you want to checkout this ${branchlabel} do:"
321
+         log_warning "${C_RESET_BOLD}(cd .repos/${linkname}; git checkout ${GITOPTIONS} \"${branch}\" )${C_WARNING}"
300 322
       fi
301 323
    fi
302
-
303
-   # when we link, we assume that dependencies are there
304 324
 }
305 325
 
306 326