newapkbuild: fix generating wrong URL with new github urls

When giving GitHub URLs like

https://github.com/USER/REPO/archive/refs/tags/TAG.tar.gz

Strip away the /refs/tags part so a valid URL is generated.
Fixes #10034.
This commit is contained in:
Rodrigo Lourenço 2023-06-22 04:10:54 +00:00 committed by psykose
parent c26043748e
commit 1679651370
1 changed files with 5 additions and 1 deletions

View File

@ -230,7 +230,7 @@ __EOF__
newaport() {
local newname="${1##*/}"
local pn=${newname%[-_][0-9]*}
local pv
local prearchive postarchive pv
local source=
is_url "$1" && source="$1"
@ -241,6 +241,10 @@ newaport() {
fi
pv=${newname%.t*} #strip .tar.gz .tgz .tar.bz2 etc
pv=${pv#*[a-z]}
prearchive=${source%/archive/*}
postarchive=${source#*/archive/}
postarchive=${postarchive#refs/tags/}
source="${prearchive}/archive/${postarchive}"
source="${source%.t*}/$pkgname-$pv.tar.gz"
elif [ "$pn" != "$newname" ]; then
pv=${newname#$pn[-_]}