Skip to content

Commit

Permalink
bee-download: support more tag formats when downloading git repositories
Browse files Browse the repository at this point in the history
fix issue #50 and add support for even more exotic formated git tags
  • Loading branch information
mariux committed May 20, 2012
1 parent 3765aec commit de36242
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/bee-download.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,27 @@ function download_git() {
eval $(@BINDIR@/beeversion ${tag} 2>/dev/null)
if [ -z "${PKGNAME}" ] ; then
PKGNAME=${reponame}
PKGFULLVERSION=${tag##${reponame}}
PKGFULLVERSION=${PKGFULLVERSION//-/}
PKGFULLVERSION=${PKGFULLVERSION//[^0-9.]/}
# how tag2version conversion works:
# 1) remove traling 'v' in potential version numbers
# ^[vV]([0-9][-_.].*)$ -> $1
# 2) remove trailing 'v' after trailing package name (.*)
# ^.*[-_][vV]([0-9][-_.].*)$ -> $1
# 3) remove trailing package name (globally, recursive)
# (where '-v[0-9]' won't indicate version start)
# ^[A-Za-z]+[0-0]*[-_] -> ''
# 4) handle special case
# ^[vV]([0-9]+)$ -> $1
# 5) cleanup result: convert all '-' to '_'
# 6) cleanup result: _([0-9]) -> .$1
# 7) cleanup result: lowercase [A-Z]+
PKGFULLVERSION=$( sed \
-e 's,^[vV]\([0-9]\+[-_\.]\),\1,' \
-e 's,.*[-_][vV]\([0-9]\+[-_\.]\),\1,' \
-e 's,^\(\([A-Za-z]\+[0-9]*\)\+[-_]\)\+,,' \
-e 's,^[vV]\([0-9]\+\)$,\1,' \
-e 's,-,_,g' \
-e 's,_\([0-9]\),.\1,g' \
-e 's,\([A-Z]\+\),\L\1,g' <<< "${tag}" )
fi

if [ "$ahead" != "$gd" ] ; then
Expand Down

0 comments on commit de36242

Please sign in to comment.