diff options
-rwxr-xr-x | newapkbuild.in | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/newapkbuild.in b/newapkbuild.in index 66f634b..952980f 100755 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -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 |