Permalink
Browse files

switch to new github uri scheme for archives

  • Loading branch information...
1 parent fc8d968 commit 025841a5cd3dad39e3ce6225c75f777587bc6549 @mpapis mpapis committed Apr 11, 2013
@@ -67,8 +67,8 @@ fetch_uri()
# DEBUG vcs: Copying from '/root' to '/home/mpapis/tmp/test_uris' failed.
# DEBUG vcs: Unknown SCM type (not found) for url '/root/test'.
# DEBUG vcs: type: github, params: mpapis/mpapis_test /home/mpapis/tmp/test_uris.
-# DEBUG vcs: github -> https://github.com/mpapis/mpapis_test/tarball/master
-# DEBUG vcs: github tarball archive name /home/mpapis/.sm/archives/mpapis_mpapis_test_master.tar.gz.
+# DEBUG vcs: github -> https://github.com/mpapis/mpapis_test/archive/master.tar.gz
+# DEBUG vcs: github tar.gz archive name /home/mpapis/.sm/archives/mpapis_mpapis_test_master.tar.gz.
# DEBUG vcs: master does not match checksum #; removing and downloading.
#
fetch_uris()
@@ -19,17 +19,17 @@ archive_get()
case "${_uri}" in
# fix github archive names
- (*github.com/*/tarball/*)
+ (*github.com/*/archive/*.tar.gz)
_archive="${_uri#*github.com/}"
- _archive="${_archive%/tarball*}"
- _archive="${archives_path}/${_archive//\//_}_${_uri##*/}.tar.gz"
- __sm.log.debug vcs "github tarball archive name ${_archive}."
+ _archive="${_archive%/archive*}"
+ _archive="${archives_path}/${_archive//\//_}_${_uri##*/}"
+ __sm.log.debug vcs "github tar.gz archive name ${_archive}."
;;
- (*github.com/*/zipball/*)
+ (*github.com/*/archive/*.zip)
_archive="${_uri#*github.com/}"
- _archive="${_archive%/zipball*}"
+ _archive="${_archive%/archive*}"
_archive="${archives_path}/${_archive//\//_}_${_uri##*/}.zip"
- __sm.log.debug vcs "github zipball archive name ${_archive}."
+ __sm.log.debug vcs "github zip archive name ${_archive}."
;;
esac
@@ -77,6 +77,15 @@ Please read 'sm man curl' for instructions how to solve this problem.\n"
builtin cd "${_final_target}"
case "${_uri}" in
+ (*github.com/*/archive/*.tar.gz)
+ tar -zxf "${_archive}" 2>&1 | __sm.log.debug vcs -
+ (( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
+ typeset name_pattern="${_uri#*github.com/}"
+ name_pattern="${name_pattern%archive/*}"
+ name_pattern="${name_pattern//\//-}"
+ mv ${name_pattern}*/* .
+ rm -rf ${name_pattern}*
+ ;;
(*.tar) # tar
tar -xf "${_archive}" 2>&1 | __sm.log.debug vcs -
(( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
@@ -85,15 +94,6 @@ Please read 'sm man curl' for instructions how to solve this problem.\n"
tar -zxf "${_archive}" 2>&1 | __sm.log.debug vcs -
(( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
;;
- (*github.com/*/tarball/*)
- tar -zxf "${_archive}" 2>&1 | __sm.log.debug vcs -
- (( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
- typeset name_pattern="${_uri#https://github.com/}"
- name_pattern="${name_pattern%tarball/*}"
- name_pattern="${name_pattern//\//-}"
- mv ${name_pattern}*/* .
- rm -rf ${name_pattern}*
- ;;
(*.tar.bz2|*.tbz2) # bzip
tar -jxf "${_archive}" 2>&1 | __sm.log.debug vcs -
(( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
@@ -102,19 +102,19 @@ Please read 'sm man curl' for instructions how to solve this problem.\n"
xz -dc "${_archive}" | tar -xC "${_final_target}" 2>&1 | __sm.log.debug vcs -
(( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
;;
- (*.zip)
- unzip -q "${_archive}" 2>&1 | __sm.log.debug vcs -
- (( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
- ;;
- (*github.com/*/zipball/*)
+ (*github.com/*/archive/*.zip)
unzip -q "${_archive}" 2>&1 | __sm.log.debug vcs -
(( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
- typeset name_pattern="${_uri#https://github.com/}"
- name_pattern="${name_pattern%zipball/*}"
+ typeset name_pattern="${_uri#*github.com/}"
+ name_pattern="${name_pattern%archive/*}"
name_pattern="${name_pattern//\//-}"
mv ${name_pattern}*/* .
rm -rf ${name_pattern}*
;;
+ (*.zip)
+ unzip -q "${_archive}" 2>&1 | __sm.log.debug vcs -
+ (( ${pipestatus[1]} == 0 )) || fetch_error extracting_archive_failed
+ ;;
(*)
#TODO: add detection based on $( file ${_archive} ) type
fetch_error unknown_archive_format
@@ -29,12 +29,12 @@ github_get()
do
case "${_method}" in
(tgz)
- __sm.log.debug vcs "github -> https://github.com/${_uri}/tarball/${branch}"
- archive_get "https://github.com/${_uri}/tarball/${branch}" "${_target}" "$@"
+ __sm.log.debug vcs "github -> https://github.com/${_uri}/archive/${branch}.tar.gz"
+ archive_get "https://github.com/${_uri}/archive/${branch}.tar.gz" "${_target}" "$@"
;;
(zip)
- __sm.log.debug vcs "github -> https://github.com/${_uri}/zipball/${branch}"
- archive_get "https://github.com/${_uri}/zipball/${branch}" "${_target}" "$@"
+ __sm.log.debug vcs "github -> https://github.com/${_uri}/archive/${branch}.zip"
+ archive_get "https://github.com/${_uri}/archive/${branch}.zip" "${_target}" "$@"
;;
(git)
__sm.log.debug vcs "github -> git://github.com/${_uri}.git"

0 comments on commit 025841a

Please sign in to comment.