newapkbuild: detect github archives

This commit is contained in:
Natanael Copa 2013-11-21 09:21:50 +00:00
parent b4fb3c6a81
commit 60dda6785f
1 changed files with 16 additions and 1 deletions

View File

@ -23,6 +23,13 @@ is_url() {
return 1
}
is_github_url() {
case $1 in
https://github.com/*/*/archive/*.tar.gz) return 0;;
esac
return 1
}
# Build sections
build_make() {
cat >>APKBUILD<<__EOF__
@ -91,7 +98,15 @@ newaport() {
local source=
is_url "$1" && source="$1"
if [ "$pn" != "$newname" ]; then
if is_github_url $source; then
if [ -z "$pkgname" ]; then
pkgname=${source%/archive/*}
pkgname=${pkgname##*/}
fi
pv=${newname%.t*} #strip .tar.gz .tgz .tar.bz2 etc
pv=${pv#*[a-z]}
source="$pkgname-$pv.tar.gz::$source"
elif [ "$pn" != "$newname" ]; then
pv=${newname#$pn-}
pv=${pv%.t*} #strip .tar.gz .tgz .tar.bz2 etc
fi