Browse code

Fix a few regressions

Nat! authored on 06-06-2017 22:33:19
Showing 12 changed files
... ...
@@ -1,3 +1,8 @@
1
+### 3.6.6
2
+
3
+* fix a few regressions
4
+
5
+
1 6
 ### 3.6.5
2 7
 
3 8
 * remove superflous set_build_needed
... ...
@@ -31,7 +31,7 @@
31 31
 #
32 32
 MULLE_EXECUTABLE_VERSION_MAJOR=3
33 33
 MULLE_EXECUTABLE_VERSION_MINOR=6
34
-MULLE_EXECUTABLE_VERSION_PATCH=5
34
+MULLE_EXECUTABLE_VERSION_PATCH=6
35 35
 
36 36
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
37 37
 
... ...
@@ -133,9 +133,9 @@ array_insert()
133 133
 # DEBUG code
134 134
 #   [ -z "${i}" ] && internal_fail "empty index"
135 135
 #
136
-#   local n
136
+   local n
137 137
 #
138
-#   n="`array_count "${array}"`"
138
+   n="`array_count "${array}"`"
139 139
 #   [ "$i" -gt "$n" ] && internal_fail "index ${i} out of bounds ${n}"
140 140
 
141 141
    head_count="$i"
... ...
@@ -405,6 +405,8 @@ clean_main()
405 405
 {
406 406
    log_debug "::: clean :::"
407 407
 
408
+   local ROOT_DIR="`pwd -P`"
409
+
408 410
    local MINION_NAME
409 411
 
410 412
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]        && . mulle-bootstrap-settings.sh
... ...
@@ -1050,7 +1050,7 @@ get_old_stashdir()
1050 1050
       dstdir="${dstdir#$oldprefix/}"
1051 1051
    fi
1052 1052
 
1053
-   oldstashdir="`computed_stashdir "${url}" "${name}" "${dstdir}"`"
1053
+   oldstashdir="`computed_stashdir "${name}" "${dstdir}"`"
1054 1054
 
1055 1055
    echo "${oldstashdir}"
1056 1056
 }
... ...
@@ -31,6 +31,7 @@
31 31
 #
32 32
 
33 33
 [ ! -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && echo "double inclusion of functions" >&2 && exit 1
34
+
34 35
 MULLE_BOOTSTRAP_FUNCTIONS_SH="included"
35 36
 
36 37
 MULLE_BOOTSTRAP_FUNCTIONS_VERSION_MINOR="5"
... ...
@@ -341,7 +342,6 @@ expand_environment_variables()
341 342
 }
342 343
 
343 344
 
344
-
345 345
 # ####################################################################
346 346
 #                             Path handling
347 347
 # ####################################################################
... ...
@@ -454,17 +454,6 @@ canonicalize_path()
454 454
    fi
455 455
 }
456 456
 
457
-#
458
-# canonicalizes existing paths
459
-# fails for files / directories that do not exist
460
-#
461
-realpath()
462
-{
463
-   [ -e "$1" ] || fail "only use realpath on existing files ($1)"
464
-
465
-   canonicalize_path "`resolve_symlinks "$1"`"
466
-}
467
-
468 457
 
469 458
 # ----
470 459
 # stolen from: https://stackoverflow.com/questions/2564634/convert-absolute-path-into-relative-path-given-a-current-directory-using-bash
... ...
@@ -1087,7 +1076,6 @@ mkdir_if_missing()
1087 1076
 }
1088 1077
 
1089 1078
 
1090
-
1091 1079
 dir_is_empty()
1092 1080
 {
1093 1081
    [ -z "$1" ] && internal_fail "empty path"
... ...
@@ -1188,6 +1176,56 @@ remove_file_if_present()
1188 1176
    fi
1189 1177
 }
1190 1178
 
1179
+# ####################################################################
1180
+#                        Symbolic Links
1181
+# ####################################################################
1182
+#
1183
+
1184
+#
1185
+# stolen from:
1186
+# http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
1187
+# ----
1188
+#
1189
+_prepend_path_if_relative()
1190
+{
1191
+   case "$2" in
1192
+      /*)
1193
+         echo "$2"
1194
+      ;;
1195
+
1196
+      *)
1197
+         echo "$1/$2"
1198
+      ;;
1199
+   esac
1200
+}
1201
+
1202
+
1203
+resolve_symlinks()
1204
+{
1205
+   local dir_context
1206
+   local path
1207
+
1208
+   path="`readlink "$1"`"
1209
+   if [ $? -eq 0 ]
1210
+   then
1211
+      dir_context=`dirname -- "$1"`
1212
+      resolve_symlinks "`_prepend_path_if_relative "$dir_context" "$path"`"
1213
+   else
1214
+      echo "$1"
1215
+   fi
1216
+}
1217
+
1218
+#
1219
+# canonicalizes existing paths
1220
+# fails for files / directories that do not exist
1221
+#
1222
+realpath()
1223
+{
1224
+   [ -e "$1" ] || fail "only use realpath on existing files ($1)"
1225
+
1226
+   canonicalize_path "`resolve_symlinks "$1"`"
1227
+}
1228
+
1191 1229
 #
1192 1230
 # the target of the symlink must exist
1193 1231
 #
... ...
@@ -1208,7 +1246,6 @@ create_symlink()
1208 1246
 
1209 1247
    srcname="`basename -- ${url}`"
1210 1248
    directory="`dirname -- "${stashdir}"`"
1211
-   directory="`realpath "${directory}"`"  # resolve symlinks
1212 1249
 
1213 1250
    mkdir_if_missing "${directory}"
1214 1251
 
... ...
@@ -803,11 +803,9 @@ path_relative_to_root_dir()
803 803
 
804 804
 computed_stashdir()
805 805
 {
806
-   local url="$1"
807
-   local name="$2"
808
-   local dstdir="$3"
806
+   local name="$1"
807
+   local dstdir="$2"
809 808
 
810
-   name="`_canonical_clone_name "${url}"`"
811 809
    if is_minion_bootstrap_project "${name}"
812 810
    then
813 811
       dstdir="${name}"
... ...
@@ -848,6 +846,9 @@ parse_raw_clone()
848 846
 process_raw_clone()
849 847
 {
850 848
    name="`_canonical_clone_name "${url}"`"
849
+
850
+   # memo this is done in .auto already
851
+   # stashdir="`computed_stashdir "${name}" "${dstdir}"`"
851 852
 }
852 853
 
853 854
 
... ...
@@ -874,7 +875,7 @@ parse_clone()
874 875
 
875 876
    local dstdir
876 877
 
877
-   parse_raw_clone "$1"
878
+   parse_raw_clone "${clone}"
878 879
    process_raw_clone
879 880
 
880 881
    stashdir="${dstdir}"
... ...
@@ -889,6 +890,13 @@ parse_clone()
889 890
       log_trace2 "STASHDIR: \"${stashdir}\""
890 891
    fi
891 892
 
893
+   # this is done  during auto already
894
+   # case "${stashdir}" in
895
+   #    ..*|~*|/*)
896
+   #     fail "dstdir \"${dstdir}\" is invalid ($clone)"
897
+   #    ;;
898
+   # esac
899
+
892 900
    [ -z "${url}" ]      && internal_fail "url is empty ($clone)"
893 901
    [ -z "${name}" ]     && internal_fail "name is empty ($clone)"
894 902
    [ -z "${stashdir}" ] && internal_fail "stashdir is empty ($clone)"
... ...
@@ -952,6 +960,8 @@ read_repository_file()
952 960
    local branch
953 961
    local scm
954 962
    local tag
963
+   local name
964
+
955 965
 
956 966
    IFS="
957 967
 "
... ...
@@ -960,6 +970,7 @@ read_repository_file()
960 970
       IFS="${DEFAULT_IFS}"
961 971
 
962 972
       parse_raw_clone "${clone}"
973
+      process_raw_clone
963 974
 
964 975
       case "${url}" in
965 976
          */\.\./*|\.\./*|*/\.\.|\.\.)
... ...
@@ -981,9 +992,14 @@ read_repository_file()
981 992
          dstdir=""
982 993
       fi
983 994
 
984
-      dstdir="`computed_stashdir "${url}" "${name}" "${dstdir}"`"
995
+      dstdir="`computed_stashdir "${name}" "${dstdir}"`"
985 996
       scm="${scm:-git}"
986 997
 
998
+      if [ "${MULLE_FLAG_LOG_MERGE}" = "YES" ]
999
+      then
1000
+         log_trace "${url};${dstdir};${branch};${scm};${tag}"
1001
+      fi
1002
+
987 1003
       echo "${url};${dstdir};${branch};${scm};${tag}"
988 1004
    done
989 1005
 
... ...
@@ -1309,6 +1325,7 @@ mulle_repositories_initialize()
1309 1325
 
1310 1326
    log_debug ":mulle_repositories_initialize:"
1311 1327
 
1328
+   [ -z "${MULLE_BOOTSTRAP_LOCAL_ENVIRONMENT_SH}" ]  && . mulle-bootstrap-local-environment.sh
1312 1329
    [ -z "${MULLE_BOOTSTRAP_ARRAY_SH}" ]           && . mulle-bootstrap-array.sh
1313 1330
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ]        && . mulle-bootstrap-settings.sh
1314 1331
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ]       && . mulle-bootstrap-functions.sh
... ...
@@ -176,7 +176,7 @@ show_raw_repository()
176 176
    local stashdir
177 177
 
178 178
    name="`_canonical_clone_name "${url}"`"
179
-   stashdir="`computed_stashdir "${url}" "${name}" "${dstdir}"`"
179
+   stashdir="`computed_stashdir "${name}" "${dstdir}"`"
180 180
 
181 181
    (
182 182
       printf "%b" "${SHOW_PREFIX}${url}"
... ...
@@ -1,4 +1,7 @@
1
-#! /bin/sh -e
1
+#! /usr/bin/env bash
2
+
3
+set -e 
4
+set -x
2 5
 
3 6
 . mulle-bootstrap-dependency-resolve.sh
4 7
 . mulle-bootstrap-functions.sh
... ...
@@ -1,10 +1,11 @@
1 1
 #! /bin/sh
2 2
 
3
+
3 4
 . mulle-bootstrap-logging.sh
4 5
 . mulle-bootstrap-repositories.sh
5 6
 . mulle-bootstrap-fetch.sh
6 7
 
7
-
8
+set -x
8 9
 
9 10
 run_test_1()
10 11
 {
... ...
@@ -46,8 +47,6 @@ MULLE_FLAG_LOG_VERBOSE="YES"
46 47
 
47 48
 rm -rf deep 2> /dev/null
48 49
 
49
-set -e
50
-set -x
51 50
 run_test_1
52 51
 
53 52
 rm -rf deep 2> /dev/null
... ...
@@ -31,33 +31,21 @@ run_test_2()
31 31
    local tag
32 32
    local stashdir
33 33
 
34
-   parse_clone "url/name;;;;"
34
+   parse_clone "url/name;whatever;;;"
35 35
 
36 36
    [ "${url}"      = "url/name" ]  || fail "wrong name \"${url}\""
37 37
    [ "${name}"     = "name" ]      || fail "wrong name \"${name}\""
38
-   [ "${stashdir}" = "stashes/name" ]  || fail "wrong stashdir \"${stashdir}\""
39
-   [ "${branch}"   = "" ]       || fail "wrong branch \"${branch}\""
40
-   [ "${tag}"      = "" ]       || fail "wrong tag \"${tag}\""
41
-   [ "${scm}"      = "" ]       || fail "wrong scm \"${scm}\""
38
+   [ "${stashdir}" = "whatever" ]  || fail "wrong stashdir \"${stashdir}\""
39
+   [ "${branch}"   = "" ]          || fail "wrong branch \"${branch}\""
40
+   [ "${tag}"      = "" ]          || fail "wrong tag \"${tag}\""
41
+   [ "${scm}"      = "" ]          || fail "wrong scm \"${scm}\""
42 42
 }
43 43
 
44
-run_test_3()
45
-{
46
-   local name
47
-   local url
48
-   local branch
49
-   local scm
50
-   local tag
51
-   local stashdir
52 44
 
53
-   echo "The next test should fail" >&2
54
-   parse_clone "url/name;../foo;;;" || exit 1
55
-   echo "If you see this the test is broken" >&2
56
-}
45
+ROOT_DIR="`pwd`"
57 46
 
58 47
 run_test_1
59 48
 run_test_2
60
-run_test_3
61 49
 
62 50
 echo "test finished" >&2
63 51
 
... ...
@@ -82,6 +82,8 @@ run_test_2()
82 82
    [ "${fclone}" = "${clone}" ] || fail "failed to remember clone"
83 83
 }
84 84
 
85
+ROOT_DIR="`pwd`"
86
+
85 87
 rm -rf .bootstrap.repos
86 88
 run_test_1
87 89
 run_test_2