forge: fix handling of / in refs as showcased by github.com/dnstap/golang-dnstap

This commit is contained in:
Nicolas Mailhot 2018-11-11 17:41:48 +01:00 committed by Igor Gnatenko
parent d6f71146ac
commit 7b6ec4668c
1 changed files with 3 additions and 1 deletions

View File

@ -143,6 +143,8 @@ local function forgemeta(suffix, verbose, informative, silent)
elseif (fileref ~= "%{?commit" .. suffix .. "}") and
string.match(rpm.expand(fileref), "^v[%d]") then
fileref = string.gsub(rpm.expand(fileref), "^v", "")
elseif (string.match(rpm.expand(fileref), "/")) then
fileref = string.gsub(rpm.expand(fileref), "/", "-")
end
fedora.safeset("fileref" .. suffix, fileref, verbose)
elseif (forge == "code.googlesource.com") then
@ -201,7 +203,7 @@ local function forgemeta(suffix, verbose, informative, silent)
distprefix = string.gsub(distprefix, "[%p%s]+", ".")
distprefix = string.gsub(distprefix, "^" .. string.lower(rpm.expand("%{?repo}")) .. "%.?", "")
local v = string.gsub(rpm.expand("%{version}"), "[%p%s]+", ".")
for _, p in ipairs({'','v','v.','version','version.'}) do
for _, p in ipairs({'','v','v.','version','version.','tags.v', 'tags.v.'}) do
distprefix = getversionsuffix(distprefix, p .. v)
end
distprefix = string.gsub(distprefix, "^%.", "")