Browse code

* fix for github tar archives having the same name

Nat! authored on 26-07-2017 14:42:20
Showing 5 changed files
... ...
@@ -1,3 +1,7 @@
1
+### 3.9.2
2
+
3
+* fix for github tar archives having the same name
4
+
1 5
 ### 3.9.1
2 6
 
3 7
 * remove debug -x from release
... ...
@@ -30,6 +30,13 @@ Start a shell with the environment set up, asto execute binaries from
30 30
 `dependencies/bin`.
31 31
 
32 32
 
33
+#### mulle-bootstrap clean dist
34
+
35
+If mulle-bootstrap painted itself in the corner and produces errors, you can't
36
+fix doing `mulle-bootstrap clean dist ; mulle-bootstrap` more often than not
37
+gets you back on track.
38
+
39
+
33 40
 ## Commands for a project maintainer
34 41
 
35 42
 #### mulle-bootstrap init
... ...
@@ -14,25 +14,34 @@ Here is an example, that installs **mulle-bootstrap** into /tmp:
14 14
 ```
15 15
 
16 16
 
17
-## How to install on Windows
17
+## OS X/Linux: How to install with homebrew/linuxbrew
18 18
 
19
-> if you use the new [Windows 10 bash](http://www.omgubuntu.co.uk/2016/08/enable-bash-windows-10-anniversary-update), ignore this
20
-
21
-Get [Git For Windows](https://git-scm.com/download/win).
22
-Checkout this repository then run
19
+If you have brew you can get the latest released version with
23 20
 
24 21
 ```console
25
-./install.sh ~/bin
22
+brew install mulle-kybernetik/software/mulle-bootstrap
26 23
 ```
27 24
 
25
+### Linux/: Install with apt-get
28 26
 
29
-## How to install with homebrew
27
+Run with sudo:
30 28
 
31
-If you have brew you can get the latest released version with
29
+```
30
+curl -sS "https://www.mulle-kybernetik.com/dists/admin-pub.asc" | apt-key add -
31
+echo "deb [arch=all] http://www.mulle-kybernetik.com `lsb_release -c -s` main" \
32
+> "/etc/apt/sources.list.d/mulle-kybernetik.com-main.list"
33
+apt-get -y --allow-unauthenticated install mulle-bootstrap
34
+```
35
+
36
+## Windows: How to install
37
+
38
+> if you use the new [Windows 10 bash](http://www.omgubuntu.co.uk/2016/08/enable-bash-windows-10-anniversary-update), ignore this
39
+
40
+Get [Git For Windows](https://git-scm.com/download/win).
41
+Checkout this repository then run
32 42
 
33 43
 ```console
34
-brew tap mulle-kybernetik/software
35
-brew install mulle-bootstrap
44
+./install.sh ~/bin
36 45
 ```
37 46
 
38 47
 
... ...
@@ -31,7 +31,7 @@
31 31
 #
32 32
 MULLE_EXECUTABLE_VERSION_MAJOR=3
33 33
 MULLE_EXECUTABLE_VERSION_MINOR=9
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
 
... ...
@@ -52,14 +52,12 @@ git_is_bare_repository()
52 52
 
53 53
 git_set_url()
54 54
 {
55
-   local remote
56
-   local url
57
-
58
-   remote="$2"
59
-   url="$3"
55
+   local directory="$1"
56
+   local remote="$2"
57
+   local url="$3"
60 58
 
61 59
    (
62
-      cd "$1" &&
60
+      cd "${directory}" &&
63 61
       git remote set-url "${remote}" "${url}"  >&2 &&
64 62
       git fetch "${remote}"  >&2  # prefetch to get new branches
65 63
    ) || exit 1
... ...
@@ -225,7 +223,7 @@ _git_get_mirror_url()
225 223
    [ -z "${REPOS_DIR}" ] && internal_fail "REPOS_DIR undefined"
226 224
 
227 225
    filelistpath="${REPOS_DIR}/.uptodate-mirrors"
228
-   log_debug "Mirror URLS: `cat "${filelistpath}"  2>/dev/null`"
226
+   log_debug "Mirror URLS: `cat "${filelistpath}" 2>/dev/null`"
229 227
 
230 228
    match="`fgrep -s -x "${mirrordir}" "${filelistpath}" 2>/dev/null`"
231 229
    if [ ! -z "${match}" ]
... ...
@@ -372,7 +370,7 @@ git_fetch()
372 370
       *:*)
373 371
          if [ ! -z "${GIT_MIRROR}" ]
374 372
          then
375
-            url="`_git_get_mirror_url ${url}`" || return 1
373
+            url="`_git_get_mirror_url "${url}"`" || return 1
376 374
          fi
377 375
       ;;
378 376
    esac
... ...
@@ -406,7 +404,7 @@ git_pull()
406 404
       *:*)
407 405
          if [ ! -z "${GIT_MIRROR}" ]
408 406
          then
409
-            url="`_git_get_mirror_url ${url}`" || return 1
407
+            url="`_git_get_mirror_url "${url}"`" || return 1
410 408
          fi
411 409
       ;;
412 410
    esac
... ...
@@ -795,26 +793,44 @@ _move_stuff()
795 793
 _tar_download()
796 794
 {
797 795
    local download="$1"
796
+   local url="$2"
798 797
 
799 798
    local archive_cache
800 799
    local cachable_path
801 800
    local cached_archive
801
+   local filename
802
+   local directory
802 803
 
803 804
    archive_cache="`read_config_setting "archive_cache" "${DEFAULT_ARCHIVE_CACHE}"`"
804 805
 
805 806
    if [ ! -z "${archive_cache}" -a "${archive_cache}" != "NO" ]
806 807
    then
807
-      cachable_path="${archive_cache}/${download}"
808
-      if [ -e "${cachable_path}" ]
808
+      # fix for github
809
+      case "${url}" in
810
+         *github.com*/archive/*)
811
+            directory="`dirname -- "${url}"`" # remove 3.9.2
812
+            directory="`dirname -- "${directory}"`" # remove archives
813
+            filename="`basename -- "${directory}"`-${download}"
814
+         ;;
815
+
816
+         *)
817
+            filename="${download}"
818
+         ;;
819
+      esac
820
+
821
+      cachable_path="${archive_cache}/${filename}"
822
+
823
+      if [ -f "${cachable_path}" ]
809 824
       then
810 825
          cached_archive="${cachable_path}"
811 826
       fi
812 827
    fi
813 828
 
814
-   if [ ! -z "${cached_archive}" ] && [ -f "${cached_archive}" ]
829
+   if [ ! -z "${cached_archive}" ]
815 830
    then
816 831
       log_info "Using cached \"${cached_archive}\" for ${C_MAGENTA}${C_BOLD}${url}${C_INFO} ..."
817
-      exekutor ln -s "${cached_archive}" || fail "failed to symlink \"${cached_archive}\""
832
+      # we are in a tmp dir
833
+      exekutor ln -s "${cached_archive}" "${download}" || fail "failed to symlink \"${cached_archive}\""
818 834
       cachable_path=""
819 835
    else
820 836
       exekutor curl -O -L ${CURLOPTIONS} "${url}" || fail "failed to download \"${url}\""
... ...
@@ -822,11 +838,11 @@ _tar_download()
822 838
 
823 839
    _validate_download "${download}" "${SCM_OPTIONS}" || exit 1
824 840
 
825
-   if [ ! -z "${cachable_path}" ]
841
+   if [ -z "${cached_archive}" -a ! -z "${cachable_path}" ]
826 842
    then
827
-      log_info "Saving \"${download}\" to archive cache \"${archive_cache}\" ..."
828
-      mkdir_if_missing "${archive_cache}" || fail "failed to create archive cacheĀ \"${archive_cache}\""
829
-      exekutor cp "${download}" "${cachable_path}" || fail "failed to copy \"${download}\" to cache \"${archive_cache}\""
843
+      log_verbose "Caching \"${url}\" as \"${cachable_path}\" ..."
844
+      mkdir_if_missing "${archive_cache}" || fail "failed to create archive cache \"${archive_cache}\""
845
+      exekutor cp "${download}" "${cachable_path}" || fail "failed to copy \"${download}\" to \"${cachable_path}\""
830 846
    fi
831 847
 }
832 848
 
... ...
@@ -848,8 +864,10 @@ tar_unpack()
848 864
    local download
849 865
    local options
850 866
    local archivename
867
+   local directory
851 868
 
852
-   download="`basename "${url}"`"
869
+   # fixup github
870
+   download="`basename -- "${url}"`"
853 871
    archive="${download}"
854 872
 
855 873
    # remove .tar (or .zip et friends)
... ...
@@ -865,7 +883,7 @@ tar_unpack()
865 883
    (
866 884
       exekutor cd "${tmpdir}" || return 1
867 885
 
868
-      _tar_download "${download}" || return 1
886
+      _tar_download "${download}" "${url}" || return 1
869 887
 
870 888
       case "${url}" in
871 889
          *.zip)