diff --git a/0001-modify-for-anolis.patch b/0001-modify-for-anolis.patch new file mode 100644 index 0000000000000000000000000000000000000000..0076da035b8d89030e8cdeba823feaaeca2f1586 --- /dev/null +++ b/0001-modify-for-anolis.patch @@ -0,0 +1,563 @@ +From 9b04a965e11a845f2839b58069c17fe1264a3da3 Mon Sep 17 00:00:00 2001 +From: Chunmei Xu +Date: Thu, 10 Mar 2022 19:19:56 +0800 +Subject: [PATCH] modify for anolis + +Signed-off-by: Chunmei Xu +--- + rpm/lua/rpm/go.lua | 46 +++++++-------- + rpm/lua/srpm/go.lua | 110 ++++++++++++++++++------------------ + rpm/macros.d/macros.go-rpm | 22 ++++---- + rpm/macros.d/macros.go-srpm | 16 +++--- + 4 files changed, 97 insertions(+), 97 deletions(-) + +diff --git a/rpm/lua/rpm/go.lua b/rpm/lua/rpm/go.lua +index cb5f958..28dae58 100644 +--- a/rpm/lua/rpm/go.lua ++++ b/rpm/lua/rpm/go.lua +@@ -24,13 +24,13 @@ + -- The goenv macro main processing function + -- See the documentation in the macros.go-rpm file for argument description + local function env(suffix, goipath, verbose, usermetadata) +- local fedora = require "fedora.common" +- local go = require "fedora.srpm.go" ++ local anolis = require "anolis.common" ++ local go = require "anolis.srpm.go" + local suffix = suffix + local goipath = goipath + local ismain = (suffix == "") or (suffix == "0") + if (goipath ~= "") and (suffix == "") then +- local bettersuffix = fedora.getbestsuffix("goipath",goipath) ++ local bettersuffix = anolis.getbestsuffix("goipath",goipath) + if (bettersuffix ~= nil) then + suffix = bettersuffix + end +@@ -38,24 +38,24 @@ local function env(suffix, goipath, verbose, usermetadata) + if (goipath == "") then + goipath = "%{goipath" .. suffix .. "}" + end +- suffixes = fedora.getsuffixes("goipath") +- fedora.safeset( "goworkdir", "%{_builddir}/%{extractdir" .. suffixes[#suffixes] .. "}", verbose) +- fedora.safeset( "gobuilddir", "%{goworkdir}/_build", verbose) ++ suffixes = anolis.getsuffixes("goipath") ++ anolis.safeset( "goworkdir", "%{_builddir}/%{extractdir" .. suffixes[#suffixes] .. "}", verbose) ++ anolis.safeset( "gobuilddir", "%{goworkdir}/_build", verbose) + if ismain then +- fedora.zalias({"gosourcedir", "gofilelist", "gocid"}, verbose) ++ anolis.zalias({"gosourcedir", "gofilelist", "gocid"}, verbose) + else +- fedora.safeset("gofilelist" .. suffix, go.rpmname("%{goipath" .. suffix .. "}", "%{?gocid" .. suffix .. "}") .. ++ anolis.safeset("gofilelist" .. suffix, go.rpmname("%{goipath" .. suffix .. "}", "%{?gocid" .. suffix .. "}") .. + "-%{gofilelist}", verbose) + end + if rpm.expand("%{goipath" .. suffix .. "}") ~= rpm.expand(goipath) then +- fedora.explicitset("thisgofilelist", go.rpmname(goipath, "%{?gocid" .. suffix .. "}") .. "-%{gofilelist}", verbose) ++ anolis.explicitset("thisgofilelist", go.rpmname(goipath, "%{?gocid" .. suffix .. "}") .. "-%{gofilelist}", verbose) + else +- fedora.explicitset("thisgofilelist", "%{gofilelist" .. suffix .. "}", verbose) ++ anolis.explicitset("thisgofilelist", "%{gofilelist" .. suffix .. "}", verbose) + end +- fedora.safeset( "gosourcedir" .. suffix, "%{?extractdir" .. suffix .. ":%{_builddir}/%{extractdir" .. suffix .. "}}" .. ++ anolis.safeset( "gosourcedir" .. suffix, "%{?extractdir" .. suffix .. ":%{_builddir}/%{extractdir" .. suffix .. "}}" .. + "%{!?extractdir" .. suffix .. ":%{goworkdir}}", verbose) + if ismain then +- fedora.zalias({"gosourcedir"}, verbose) ++ anolis.zalias({"gosourcedir"}, verbose) + end + local ldflags = "" + local metadata = { version = { id = "version" }, tag = {}, commit = {}, branch = {}, } +@@ -67,14 +67,14 @@ local function env(suffix, goipath, verbose, usermetadata) + ldflags = ldflags .. " -X " .. goipath .. "/" .. metadata[m]["id"] .. "=" .. metadata[m]["value"] + end + end +- fedora.setcurrent({"goipath", "gosourcedir", "gofilelist", ++ anolis.setcurrent({"goipath", "gosourcedir", "gofilelist", + "version", "tag", "commit", "branch"}, suffix, verbose) +- fedora.explicitset( "currentgoldflags", ldflags, verbose) ++ anolis.explicitset( "currentgoldflags", ldflags, verbose) + end + + -- Create a single set of %install tasks for a known kind of Go subpackage + local function singleinstall(kind, suffix, verbose) +- local go = require "fedora.srpm.go" ++ local go = require "anolis.srpm.go" + if (kind == "devel") then + go.develenv(suffix, verbose) + for goipath in string.gmatch(rpm.expand("%{currentgoipaths}"), "[^%s]+") do +@@ -84,21 +84,21 @@ local function singleinstall(kind, suffix, verbose) + end + print(rpm.expand("%__godevelinstalldoc\n")) + elseif (kind == "alt") then +- local fedora = require "fedora.common" ++ local anolis = require "anolis.common" + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose) ++ anolis.zalias({"goaltipaths","gocid","goaltcid"}, verbose) + end +- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) ++ anolis.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) + if ismain then +- fedora.zalias({"goaltcid"}, verbose) ++ anolis.zalias({"goaltcid"}, verbose) + end + for rpmname, goaltipaths in pairs(go.indexedgoipaths("%{goaltipaths" .. suffix .. "}", + "%{goaltcid" .. suffix .. "}")) do + go.altenv(suffix, rpmname, goaltipaths, verbose) + gocanonipath = rpm.expand("%{currentgocanonipath}") + for _, goaltipath in ipairs(goaltipaths) do +- fedora.explicitset("currentgoaltipath", goaltipath) ++ anolis.explicitset("currentgoaltipath", goaltipath) + print(rpm.expand("%__goaltinstall\n")) + goaltipath = string.gsub(goaltipath, "/?[^/]+/?$", "") + while (not string.match(gocanonipath, "^" .. goaltipath)) do +@@ -114,13 +114,13 @@ end + + -- Create one or all %install tasks for a known kind of go subpackage + local function install(kind, suffix, processall, verbose) +- local fedora = require "fedora.common" +- local go = require "fedora.srpm.go" ++ local anolis = require "anolis.common" ++ local go = require "anolis.srpm.go" + if (kind == "devel") then + go.develenvinit() + end + if processall then +- for _, suffix in pairs(fedora.getsuffixes(go.pivot[kind])) do ++ for _, suffix in pairs(anolis.getsuffixes(go.pivot[kind])) do + singleinstall(kind, suffix, verbose) + end + else +diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua +index 00ffcde..00aa701 100644 +--- a/rpm/lua/srpm/go.lua ++++ b/rpm/lua/srpm/go.lua +@@ -75,15 +75,15 @@ end + -- The gometa macro main processing function + -- See the documentation in the macros.go-srpm file for argument description + local function meta(suffix, verbose, informative, silent) +- local fedora = require "fedora.common" +- local forge = require "fedora.srpm.forge" ++ local anolis = require "anolis.common" ++ local forge = require "anolis.srpm.forge" + local zsuffix = "" + if (suffix ~= "") then + zsuffix = " -z " .. suffix + end + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias({"forgeurl", "goipath", "gocid", "goname", "gourl", "gosource"}, verbose) ++ anolis.zalias({"forgeurl", "goipath", "gocid", "goname", "gourl", "gosource"}, verbose) + end + local spec = {} + for _, v in ipairs({'goipath', 'forgeurl'}) do +@@ -96,26 +96,26 @@ local function meta(suffix, verbose, informative, silent) + local cleangoipath = string.gsub(spec["goipath"], "^http(s?)://", "") + cleangoipath = string.gsub(cleangoipath, "/+$", "") + if (cleangoipath ~= spec["goipath"]) then +- fedora.explicitset(goipath .. suffix, cleangoipath) ++ anolis.explicitset(goipath .. suffix, cleangoipath) + end + if (spec["forgeurl"] ~= "") then +- fedora.safeset("gourl" .. suffix, "%{forgeurl" .. suffix .. "}",verbose) ++ anolis.safeset("gourl" .. suffix, "%{forgeurl" .. suffix .. "}",verbose) + else +- fedora.safeset("gourl" .. suffix, "https://%{goipath" .. suffix .. "}",verbose) +- fedora.safeset("forgeurl" .. suffix, "%{gourl" .. suffix .. "}",verbose) ++ anolis.safeset("gourl" .. suffix, "https://%{goipath" .. suffix .. "}",verbose) ++ anolis.safeset("forgeurl" .. suffix, "%{gourl" .. suffix .. "}",verbose) + end + forge.meta(suffix, verbose, informative, silent) + if (rpm.expand("%{?forgesource" .. suffix .. "}") ~= "") then +- fedora.safeset("gosource" .. suffix, "%{forgesource" .. suffix .. "}",verbose) ++ anolis.safeset("gosource" .. suffix, "%{forgesource" .. suffix .. "}",verbose) + else +- fedora.safeset("gosource" .. suffix, "%{gourl" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}",verbose) ++ anolis.safeset("gosource" .. suffix, "%{gourl" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}",verbose) + end +- fedora.safeset( "goname" .. suffix, rpmname("%{goipath" .. suffix .. "}", "%{?gocid" .. suffix .. "}") ,verbose) +- fedora.zalias({"forgeurl","goname","gourl","gosource"},verbose) ++ anolis.safeset( "goname" .. suffix, rpmname("%{goipath" .. suffix .. "}", "%{?gocid" .. suffix .. "}") ,verbose) ++ anolis.zalias({"forgeurl","goname","gourl","gosource"},verbose) + -- Final spec variable summary if the macro was called with -i + if informative then + rpm.expand("%{echo:Packaging variables read or set by %%gometa}") +- fedora.echovars({"goipath","goname","gourl","gosource"}, suffix) ++ anolis.echovars({"goipath","goname","gourl","gosource"}, suffix) + end + end + +@@ -128,7 +128,7 @@ local listflags = {goipaths = "-i", goipathsex = "-t", goextensions = "-e"} + -- Convert a space-separated list of import paths to a table indexed by their + -- rpmname version, to handle upstreams that play naming games + local function indexedgoipaths(goipaths, gocid) +- local go = require "fedora.srpm.go" ++ local go = require "anolis.srpm.go" + local giptable = {} + for goipath in string.gmatch(rpm.expand(goipaths), "[^%s,]+") do + local key = go.rpmname(goipath, gocid) +@@ -145,21 +145,21 @@ end + + -- Create fallbacks to goipath variables if godevelipath variables are missing + local function develenvinit() +- local fedora = require "fedora.common" +- if (next(fedora.getsuffixes("goipaths")) == nil) then +- for _, suffix in pairs(fedora.getsuffixes("goipath")) do +- fedora.safeset("goipaths" .. suffix, "%{goipath" .. suffix .. "}") ++ local anolis = require "anolis.common" ++ if (next(anolis.getsuffixes("goipaths")) == nil) then ++ for _, suffix in pairs(anolis.getsuffixes("goipath")) do ++ anolis.safeset("goipaths" .. suffix, "%{goipath" .. suffix .. "}") + end + end + end + + -- Set rpm variables related to the processing of a golang-*-devel subpackage + local function develenv(suffix, verbose) +- local fedora = require "fedora.common" +- local go = require "fedora.srpm.go" ++ local anolis = require "anolis.common" ++ local go = require "anolis.srpm.go" + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias( {"goipath", "gocid", "gofilelist", ++ anolis.zalias( {"goipath", "gocid", "gofilelist", + "godevelname", "godevelcid", "godevelfilelist", "godevelsummary", "godeveldescription", + "godevelheader", "goextensions", "gosupfiles", "gosupfilesex", + "goipaths", "goipathsex", "golicenses", "golicensesex", "godocs", "godocsex"}, verbose) +@@ -174,43 +174,43 @@ local function develenv(suffix, verbose) + if (list ~= "goipaths") then + l = string.gsub(l, "([^%s]+)", flag .. " %1") + end +- fedora.explicitset(list .. suffix, l) ++ anolis.explicitset(list .. suffix, l) + end + end + local goipaths = rpm.expand("%{?goipaths" .. suffix .. "}") + local goipath = string.match(goipaths, "[^%s]+") +- fedora.safeset("godevelcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) ++ anolis.safeset("godevelcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) + local rpmname = go.rpmname(goipath, "%{?godevelcid" .. suffix .. "}") +- fedora.safeset("godevelname" .. suffix, rpmname .. "-devel", verbose) +- fedora.safeset("godevelfilelist" .. suffix, rpmname .. "-%{gofilelist}", verbose) +- fedora.safeset("godevelsummary" .. suffix, "%{summary}", verbose) +- fedora.safeset("godeveldescription" .. suffix, "%{?common_description}", verbose) ++ anolis.safeset("godevelname" .. suffix, rpmname .. "-devel", verbose) ++ anolis.safeset("godevelfilelist" .. suffix, rpmname .. "-%{gofilelist}", verbose) ++ anolis.safeset("godevelsummary" .. suffix, "%{summary}", verbose) ++ anolis.safeset("godeveldescription" .. suffix, "%{?common_description}", verbose) + local postdescr = "\n\nThis package contains the source code needed for building packages that reference " .. + "the following Go import paths:" + postdescr = postdescr .. string.gsub(goipaths, "([^%s]+)", "\n – %1") +- fedora.explicitset("currentgodeveldescription", "%{expand:%{godeveldescription" .. suffix .. "}" .. ++ anolis.explicitset("currentgodeveldescription", "%{expand:%{godeveldescription" .. suffix .. "}" .. + postdescr .. "}", verbose) +- fedora.setcurrent({"godevelname", "godevelcid", "godevelfilelist", "godevelsummary", ++ anolis.setcurrent({"godevelname", "godevelcid", "godevelfilelist", "godevelsummary", + "godevelheader", "goextensions", "gosupfiles", "gosupfilesex", + "goipaths", "goipathsex", "golicenses", "golicensesex", "godocs", "godocsex"}, suffix, verbose) + if ismain then +- fedora.zalias( {"godevelname", "godevelcid", "godevelfilelist", "godevelsummary", "godeveldescription"}, verbose) ++ anolis.zalias( {"godevelname", "godevelcid", "godevelfilelist", "godevelsummary", "godeveldescription"}, verbose) + end + end + + -- Set rpm variables related to the processing of a compat-golang-*-devel subpackage + local function altenv(suffix, rpmname, goaltipaths, verbose) +- local fedora = require "fedora.common" +- local go = require "fedora.srpm.go" ++ local anolis = require "anolis.common" ++ local go = require "anolis.srpm.go" + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias( {"goipath", "gocanonipath", ++ anolis.zalias( {"goipath", "gocanonipath", + "goaltdescription", "goaltsummary", "goaltheader"}, verbose) + end +- fedora.safeset("gocanonipath" .. suffix, "%{goipath" .. suffix .. "}", verbose) +- fedora.safeset("goaltsummary" .. suffix, "%{summary}", verbose) +- fedora.safeset("goaltdescription" .. suffix, "%{?common_description}", verbose) +- fedora.setcurrent( {"gocanonipath", "goaltcid", "goaltsummary"}, suffix, verbose) ++ anolis.safeset("gocanonipath" .. suffix, "%{goipath" .. suffix .. "}", verbose) ++ anolis.safeset("goaltsummary" .. suffix, "%{summary}", verbose) ++ anolis.safeset("goaltdescription" .. suffix, "%{?common_description}", verbose) ++ anolis.setcurrent( {"gocanonipath", "goaltcid", "goaltsummary"}, suffix, verbose) + local postdescr = "\n\nThis package provides symbolic links that alias the following Go import paths " .. + "to %{currentgocanonipath}:" + local posthead = "" +@@ -222,20 +222,20 @@ local function altenv(suffix, rpmname, goaltipaths, verbose) + "\n\nAliasing Go import paths via symbolic links or http redirects is fragile. " .. + "If your Go code depends on this package, you should patch it to import " .. + "directly %{currentgocanonipath}." +- fedora.explicitset("currentgoaltdescription", "%{expand:%{?goaltdescription" .. suffix .. "}" .. ++ anolis.explicitset("currentgoaltdescription", "%{expand:%{?goaltdescription" .. suffix .. "}" .. + postdescr .. "}", verbose) +- fedora.explicitset("currentgoaltheader", "%{expand:%{?goaltheader" .. suffix .. "}" .. ++ anolis.explicitset("currentgoaltheader", "%{expand:%{?goaltheader" .. suffix .. "}" .. + posthead .. "}", verbose) +- fedora.explicitset("currentgoaltname", rpmname .. "-devel", verbose) +- fedora.explicitset("currentgoaltfilelist", rpmname .. "-%{gofilelist}", verbose) ++ anolis.explicitset("currentgoaltname", rpmname .. "-devel", verbose) ++ anolis.explicitset("currentgoaltfilelist", rpmname .. "-%{gofilelist}", verbose) + if ismain then +- fedora.zalias( {"gocanonipath", "goaltsummary", "goaltdescription"}, verbose) ++ anolis.zalias( {"gocanonipath", "goaltsummary", "goaltdescription"}, verbose) + end + end + + -- Create a single %package section for a known kind of Go subpackage + local function singlepkg(kind, suffix, verbose) +- local fedora = require "fedora.common" ++ local anolis = require "anolis.common" + if (kind == "devel") then + develenv(suffix, verbose) + print( +@@ -246,16 +246,16 @@ local function singlepkg(kind, suffix, verbose) + "BuildArch: noarch\n" .. + "%{?currentgodevelheader}\n" .. + "%description -n %{currentgodevelname}\n") .. +- fedora.wordwrap("%{?currentgodeveldescription}") .. ++ anolis.wordwrap("%{?currentgodeveldescription}") .. + "\n") + elseif (kind == "alt") then + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose) ++ anolis.zalias({"goaltipaths","gocid","goaltcid"}, verbose) + end +- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) ++ anolis.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) + if ismain then +- fedora.zalias({"goaltcid"}, verbose) ++ anolis.zalias({"goaltcid"}, verbose) + end + for rpmname, goaltipaths in pairs(indexedgoipaths("%{goaltipaths" .. suffix .. "}", + "%{goaltcid" .. suffix .. "}")) do +@@ -268,7 +268,7 @@ local function singlepkg(kind, suffix, verbose) + "BuildArch: noarch\n" .. + "%{?currentgoaltheader}\n" .. + "%description -n %{currentgoaltname}\n") .. +- fedora.wordwrap("%{?currentgoaltdescription}") .. ++ anolis.wordwrap("%{?currentgoaltdescription}") .. + "\n") + end + else +@@ -278,12 +278,12 @@ end + + -- Create one or all %package sections for a known kind of go subpackage + local function pkg(kind, suffix, processall, verbose) +- local fedora = require "fedora.common" ++ local anolis = require "anolis.common" + if (kind == "devel") then + develenvinit() + end + if processall then +- for _, suffix in pairs(fedora.getsuffixes(pivot[kind])) do ++ for _, suffix in pairs(anolis.getsuffixes(pivot[kind])) do + singlepkg(kind, suffix, verbose) + end + else +@@ -297,14 +297,14 @@ local function singlefiles(kind, suffix, verbose) + develenv(suffix, verbose) + print(rpm.expand('%files -n %{currentgodevelname} -f "%{goworkdir}/%{currentgodevelfilelist}"\n')) + elseif (kind == "alt") then +- local fedora = require "fedora.common" ++ local anolis = require "anolis.common" + local ismain = (suffix == "") or (suffix == "0") + if ismain then +- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose) ++ anolis.zalias({"goaltipaths","gocid","goaltcid"}, verbose) + end +- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) ++ anolis.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose) + if ismain then +- fedora.zalias({"goaltcid"}, verbose) ++ anolis.zalias({"goaltcid"}, verbose) + end + for rpmname, goaltipaths in pairs(indexedgoipaths("%{goaltipaths" .. suffix .. "}", + "%{goaltcid" .. suffix .. "}")) do +@@ -318,12 +318,12 @@ end + + -- Create one or all %files sections for a known kind of go subpackage + local function files(kind, suffix, processall, verbose) +- local fedora = require "fedora.common" ++ local anolis = require "anolis.common" + if (kind == "devel") then + develenvinit() + end + if processall then +- for _, suffix in pairs(fedora.getsuffixes(pivot[kind])) do ++ for _, suffix in pairs(anolis.getsuffixes(pivot[kind])) do + singlefiles(kind, suffix, verbose) + end + else +diff --git a/rpm/macros.d/macros.go-rpm b/rpm/macros.d/macros.go-rpm +index 8890023..3a42cfd 100644 +--- a/rpm/macros.d/macros.go-rpm ++++ b/rpm/macros.d/macros.go-rpm +@@ -72,7 +72,7 @@ + # -C default: %{commit} + # -B default: %{branch} + %goenv(z:i:vV:T:C:B:) %{lua: +-local go = require "fedora.rpm.go" ++local go = require "anolis.rpm.go" + local suffix = rpm.expand("%{?-z*}") + local goipath = rpm.expand("%{?-i*}") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -134,7 +134,7 @@ cd "%{mybuilddir}/src/%{mygoipath}" + # operations + # -v be verbose + %goprep(z:ai:b:s:kerv) %{lua: +-local fedora = require "fedora.common" ++local anolis = require "anolis.common" + local extract = (rpm.expand("%{-e}") == "") + local installdeps = (rpm.expand("%{-r}") == "") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") +@@ -153,7 +153,7 @@ local function process(suffix) + end + -- Main loop + if processall then +- for _,s in pairs(fedora.getsuffixes("goipath")) do ++ for _,s in pairs(anolis.getsuffixes("goipath")) do + process(s) + end + else +@@ -170,12 +170,12 @@ end + # -i use the specified import path value instead of the one + # found in %{goipath} + %go_generate_buildrequires(z:ai:) %{lua: +-local fedora = require "fedora.common" ++local anolis = require "anolis.common" + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local forcedgoipath = rpm.expand("%{?-i}") + local golistargs = "" + if processall then +- for _, s in pairs(fedora.getsuffixes("goipath")) do ++ for _, s in pairs(anolis.getsuffixes("goipath")) do + golistargs = golistargs .. " --package-path %{goipath" .. s .. "}" + end + golistargs = string.gsub(golistargs, "^ ", "") +@@ -237,7 +237,7 @@ print(rpm.expand('GOPATH="%{?gobuilddir:%{gobuilddir}:}${GOPATH:+${GOPATH}:}%{?g + # When invoked several times with different file list names, it will attribute + # directories to the first file list that makes use of them. + %goinstall(z:ai:b:s:o:O:ve:d:t:rV:T:C:B:p:g:) %{lua: +-local fedora = require "fedora.common" ++local anolis = require "anolis.common" + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local myenvflags = rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}') + local myinstallflags = rpm.expand('%{!-i:-i "%%{currentgoipath}" }' .. +@@ -263,7 +263,7 @@ local function process(suffix) + end + -- Main loop + if processall then +- for _,s in pairs(fedora.getsuffixes("goipath")) do ++ for _,s in pairs(anolis.getsuffixes("goipath")) do + process(s) + end + else +@@ -285,7 +285,7 @@ end + # -z calls + # -v be verbose + %godevelinstall(z:av) %{lua: +-local go = require "fedora.rpm.go" ++local go = require "anolis.rpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -299,7 +299,7 @@ go.install("devel", suffix, processall, verbose) + # -z calls + # -v be verbose + %goaltinstall(z:av) %{lua: +-local go = require "fedora.rpm.go" ++local go = require "anolis.rpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -331,7 +331,7 @@ go.install("alt", suffix, processall, verbose) + # -r exclude files matching , + %gocheck(z:ai:b:s:vd:t:rV:T:C:B:p:g:w) %{lua: + rpm.undefine('_auto_set_build_flags') +-local fedora = require "fedora.common" ++local anolis = require "anolis.common" + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local myenvflags = rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}') + local mycheckflags = rpm.expand('%{!-i:-i "%%{currentgoipath}" }' .. +@@ -358,7 +358,7 @@ local function process(suffix) + end + -- Main loop + if processall then +- for _,s in pairs(fedora.getsuffixes("goipath")) do ++ for _,s in pairs(anolis.getsuffixes("goipath")) do + process(s) + end + else +diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm +index 884463f..32b8af2 100644 +--- a/rpm/macros.d/macros.go-srpm ++++ b/rpm/macros.d/macros.go-srpm +@@ -43,7 +43,7 @@ + # version. For example: a (different) major version, a + # specific shortened commit, etc + %gorpmname(c:) %{lua: +-local go = require "fedora.srpm.go" ++local go = require "anolis.srpm.go" + print(go.rpmname("%1", "%{-c*}")) + } + +@@ -107,14 +107,14 @@ print(go.rpmname("%1", "%{-c*}")) + %gometa(az:svi) %{lua: + print( "BuildRequires: go-rpm-macros\\n") + print(rpm.expand("ExclusiveArch: %{go_arches}\\n")) +-local fedora = require "fedora.common" +-local go = require "fedora.srpm.go" ++local anolis = require "anolis.common" ++local go = require "anolis.srpm.go" + local verbose = rpm.expand("%{-v}") ~= "" + local informative = rpm.expand("%{-i}") ~= "" + local silent = rpm.expand("%{-s}") ~= "" + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + if processall then +- for _,s in pairs(fedora.getsuffixes("goipath")) do ++ for _,s in pairs(anolis.getsuffixes("goipath")) do + go.meta(s,verbose,informative,silent) + end + else +@@ -136,7 +136,7 @@ end + # -z calls + # -v be verbose + %godevelpkg(z:av) %{lua: +-local go = require "fedora.srpm.go" ++local go = require "anolis.srpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -150,7 +150,7 @@ go.pkg("devel", suffix, processall, verbose) + # -z calls + # -v be verbose + %goaltpkg(z:av) %{lua: +-local go = require "fedora.srpm.go" ++local go = require "anolis.srpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -171,7 +171,7 @@ go.pkg("alt", suffix, processall, verbose) + # -z calls + # -v be verbose + %godevelfiles(z:av) %{lua: +-local go = require "fedora.srpm.go" ++local go = require "anolis.srpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +@@ -185,7 +185,7 @@ go.files("devel", suffix, processall, verbose) + # -z calls + # -v be verbose + %goaltfiles(z:av) %{lua: +-local go = require "fedora.srpm.go" ++local go = require "anolis.srpm.go" + local suffix = rpm.expand("%{-z*}") + local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "") + local verbose = (rpm.expand("%{-v}") ~= "") +-- +2.19.1.6.gb485710b + diff --git a/go-rpm-macros-3.0.15.tar.gz b/go-rpm-macros-3.0.15.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..20e06a1877cd8299d294bd30b133b2b6f4f4e4a0 Binary files /dev/null and b/go-rpm-macros-3.0.15.tar.gz differ diff --git a/go-rpm-macros.spec b/go-rpm-macros.spec new file mode 100644 index 0000000000000000000000000000000000000000..9abcd53625242044b3504950e5cf68d7f8d25ddf --- /dev/null +++ b/go-rpm-macros.spec @@ -0,0 +1,137 @@ +%define anolis_release 1 + +%global _spectemplatedir %{_datadir}/rpmdevtools/anolis +%global _docdir_fmt %{name} + +%global golang_arches x86_64 aarch64 +%global gopath %{_datadir}/gocode + +ExclusiveArch: %{golang_arches} + +Name: go-rpm-macros +Version: 3.0.15 +Release: %{anolis_release}%{?dist} +Summary: Build-stage rpm automation for Go packages + +License: GPLv3+ +URL: https://pagure.io/go-rpm-macros +Source: https://pagure.io/go-rpm-macros/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-modify-for-anolis.patch + +Requires: go-srpm-macros = %{version}-%{release} +Requires: go-filesystem = %{version}-%{release} +Requires: golist + +%ifarch %{golang_arches} +Requires: golang +Provides: compiler(golang) +Provides: compiler(go-compiler) = 2 +Obsoletes: go-compilers-golang-compiler < %{version}-%{release} +%endif + +%description +This package provides build-stage rpm automation to simplify the creation of Go +language (golang) packages. + +It does not need to be included in the default build root: go-srpm-macros will +pull it in for Go packages only. + +%package -n go-srpm-macros +Summary: Source-stage rpm automation for Go packages +BuildArch: noarch +Requires: system-rpm-config + +%description -n go-srpm-macros +This package provides SRPM-stage rpm automation to simplify the creation of Go +language (golang) packages. + +It limits itself to the automation subset required to create Go SRPM packages +and needs to be included in the default build root. + +The rest of the automation is provided by the go-rpm-macros package, that +go-srpm-macros will pull in for Go packages only. + +%package -n go-filesystem +Summary: Directories used by Go packages +License: Public Domain + +%description -n go-filesystem +This package contains the basic directory layout used by Go packages. + +%package -n go-rpm-templates +Summary: RPM spec templates for Go packages +License: MIT +BuildArch: noarch +Requires: go-rpm-macros = %{version}-%{release} + +%description -n go-rpm-templates +This package contains documented rpm spec templates showcasing how to use the +macros provided by go-rpm-macros to create Go packages. + +%prep +%forgeautosetup -p1 +%writevars -f rpm/macros.d/macros.go-srpm golang_arches gopath +for template in templates/rpm/*\.spec ; do + target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g") + grep -v '^#' "${template}" > "${target}" + touch -r "${template}" "${target}" +done + +%install +install -m 0755 -vd %{buildroot}%{gopath}/src +install -m 0755 -vd %{buildroot}%{_spectemplatedir} +install -m 0644 -vp templates/rpm/*spec \ + %{buildroot}%{_spectemplatedir} +install -m 0755 -vd %{buildroot}%{_bindir} +install -m 0755 bin/* %{buildroot}%{_bindir} +install -m 0755 -vd %{buildroot}%{rpmmacrodir} +install -m 0644 -vp rpm/macros.d/macros.go-* \ + %{buildroot}%{rpmmacrodir} +install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/srpm +install -m 0644 -vp rpm/lua/srpm/*lua \ + %{buildroot}%{_rpmluadir}/anolis/srpm +install -m 0755 -vd %{buildroot}%{_rpmluadir}/anolis/rpm +install -m 0644 -vp rpm/lua/rpm/*lua \ + %{buildroot}%{_rpmluadir}/anolis/rpm +install -m 0755 -vd %{buildroot}%{_rpmconfigdir}/fileattrs +install -m 0644 -vp rpm/fileattrs/*.attr \ + %{buildroot}%{_rpmconfigdir}/fileattrs/ +install -m 0755 -vp rpm/*\.{prov,deps} \ + %{buildroot}%{_rpmconfigdir}/ + +%ifarch %{golang_arches} +install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ + %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-golang +%endif + +%files +%license LICENSE.txt +%doc README.md +%{_bindir}/* +%{_rpmconfigdir}/fileattrs/*.attr +%{_rpmconfigdir}/*.prov +%{_rpmconfigdir}/*.deps +%{_rpmconfigdir}/macros.d/macros.go-rpm* +%{_rpmconfigdir}/macros.d/macros.go-compiler* +%{_rpmluadir}/anolis/rpm/*.lua + +%files -n go-srpm-macros +%license LICENSE.txt +%doc README.md +%{_rpmconfigdir}/macros.d/macros.go-srpm +%{_rpmluadir}/anolis/srpm/*.lua + +%files -n go-filesystem +%dir %{gopath} +%dir %{gopath}/src + +%files -n go-rpm-templates +%license LICENSE-templates.txt +%doc README.md +%dir %{dirname:%{_spectemplatedir}} +%dir %{_spectemplatedir} +%{_spectemplatedir}/*.spec + +%changelog +* Thu Mar 10 2022 Chunmei Xu 3.0.15-1 +- init from upstream 3.0.15.