forge: add gitea driver

Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Raits 2020-05-23 16:53:03 +02:00
parent 7ca91f59f7
commit 2a236590f5
No known key found for this signature in database
GPG Key ID: 115D5AB89C5C1E1E
2 changed files with 17 additions and 1 deletions

View File

@ -31,6 +31,9 @@ local function checkforgeurl(url, id, silent)
pagure_ns_fork = {
pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+',
description = 'https://pagure.io/fork/owner/namespace/repo'},
["gitea.com"] = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://gitea.com/owner/repo'},
github = {
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
description = 'https://(…[-.])github[-.]…/owner/repo'},
@ -129,6 +132,11 @@ local function meta(suffix, verbose, informative, silent)
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/[^/]+/([^/?#]+)")}',
archivename = "%{owner" .. suffix .. "}-%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
["gitea.com"] = {
archiveext = "tar.gz",
archivename = "%{fileref" .. suffix .. "}",
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}",
topdir = "%{repo}" },
github = {
archiveext = "tar.gz",
archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}",
@ -191,6 +199,11 @@ local function meta(suffix, verbose, informative, silent)
fileref = string.gsub(rpm.expand(fileref), "/", "-")
end
fedora.safeset("fileref" .. suffix, fileref, verbose)
elseif (forge == "gitea.com") then
-- Workaround the way gitea mangles /s in ref names
local fileref = ref
fileref = string.gsub(rpm.expand(fileref), "/", "-")
fedora.safeset("fileref" .. suffix, fileref, verbose)
elseif (forge == "code.googlesource.com") then
if (ref == "%{?version" .. suffix .. "}") then
ref = "v" .. ref

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 154
Version: 155
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -206,6 +206,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
* Sat May 23 2020 Nicolas Mailhot <nim@fedoraproject.org> - 155-1
- forge: add gitea support
* Thu Apr 09 2020 Panu Matilainen <pmatilai@redhat.com> - 154-1
- Optimize kernel module provides by using a parametric generator