Browse code

Version check in functions

Nat! authored on 24-04-2017 17:25:08
Showing 3 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 
2
-### 3.5.0
2
+### 3.5.2
3 3
 
4 4
 #### `caches_path`renamed to more sensible `search_path`
5 5
 
... ...
@@ -11,7 +11,8 @@ create demo files any more. Inverted meaning of -d flag.
11 11
 * The paths default is now to output an unquoted one-liner. This is less
12 12
 correct but simpler.
13 13
 * Added `mulle-bootstrap run`. See mulle-brew for more details.
14
-
14
+* Add proper version check in mulle-functions, so that mulle-brew doesn't
15
+run with wrong libraries
15 16
 
16 17
 ### 3.4.0
17 18
 
... ...
@@ -31,7 +31,7 @@
31 31
 #
32 32
 MULLE_EXECUTABLE_VERSION_MAJOR=3
33 33
 MULLE_EXECUTABLE_VERSION_MINOR=5
34
-MULLE_EXECUTABLE_VERSION_PATCH=1
34
+MULLE_EXECUTABLE_VERSION_PATCH=2
35 35
 
36 36
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
37 37
 
... ...
@@ -628,6 +628,9 @@ MULLE_EXECUTABLE_FAIL_PREFIX="${MULLE_EXECUTABLE}"
628 628
 MULLE_EXECUTABLE_PID="$$"
629 629
 export MULLE_EXECUTABLE_PID
630 630
 
631
+MULLE_EXECUTABLE_FUNCTIONS_MIN="3.5"
632
+MULLE_EXECUTABLE_FUNCTIONS_MAX="4"
633
+
631 634
 
632 635
 bootstrap_init "$@" # needs params
633 636
 
... ...
@@ -33,7 +33,10 @@
33 33
 [ ! -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && echo "double inclusion of functions" >&2 && exit 1
34 34
 MULLE_BOOTSTRAP_FUNCTIONS_SH="included"
35 35
 
36
-MULLE_BOOTSTRAP_FUNCTIONS_VERSION="3.0"
36
+MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MINOR="5"
37
+MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MAJOR="3"
38
+
39
+MULLE_BOOTSTRAP_FUNCTIONS_VERSION="${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MAJOR}.${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MINOR}"
37 40
 
38 41
 #
39 42
 # WARNING! THIS FILE IS A LIBRARY USE BY OTHER PROJECTS
... ...
@@ -1317,7 +1320,33 @@ functions_initialize()
1317 1320
 
1318 1321
    log_debug ":functions_initialize:"
1319 1322
 
1320
-   :
1323
+   if [ ! -z "${MULLE_EXECUTABLE_FUNCTIONS_MIN}" ]
1324
+   then
1325
+
1326
+      major="`cut -d. -f1 <<< "${MULLE_EXECUTABLE_FUNCTIONS_MIN}"`"
1327
+      minor="`cut -d. -f2 <<< "${MULLE_EXECUTABLE_FUNCTIONS_MIN}"`"
1328
+
1329
+      if [ "${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MAJOR}" -lt "${major}" ]
1330
+      then
1331
+         fail "Installed mulle-bootstrap library is too old. (installed is ${MULLE_BOOTSTRAP_FUNCTIONS_VERSION}, but ${MULLE_EXECUTABLE_FUNCTIONS_MIN} is required)"
1332
+      fi
1333
+
1334
+      if [ "${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MAJOR}" -eq "${major}" ] &&
1335
+         [ "${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MINOR}" -lt "${minor}" ]
1336
+      then
1337
+         fail "Installed mulle-bootstrap library is too old. (installed is ${MULLE_BOOTSTRAP_FUNCTIONS_VERSION}, but ${MULLE_EXECUTABLE_FUNCTIONS_MIN} is required)"
1338
+      fi
1339
+   fi
1340
+
1341
+   if [ ! -z "${MULLE_EXECUTABLE_FUNCTIONS_MAX}" ]
1342
+   then
1343
+      major="`cut -d. -f1 <<< "${MULLE_EXECUTABLE_FUNCTIONS_MAX}"`"
1344
+
1345
+      if [ "${MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MAJOR}" -ge "${major}" ]
1346
+      then
1347
+         fail "Installed mulle-bootstrap library is too new. (${MULLE_BOOTSTRAP_FUNCTIONS_VERSION})"
1348
+      fi
1349
+   fi
1321 1350
 }
1322 1351
 
1323 1352