|
|
92bf05 |
diff --git a/rpm/fileattrs/go.attr b/rpm/fileattrs/go.attr
|
|
|
92bf05 |
index d4d5761..a9000a7 100644
|
|
|
92bf05 |
--- a/rpm/fileattrs/go.attr
|
|
|
92bf05 |
+++ b/rpm/fileattrs/go.attr
|
|
|
92bf05 |
@@ -2,5 +2,3 @@
|
|
|
92bf05 |
|
|
|
92bf05 |
%__go_path ^%{gopath}/src/.+/.goipath$
|
|
|
92bf05 |
%__go_flags path
|
|
|
92bf05 |
-%__go_provides go-rpm-integration provides --prefix "%{buildroot}" --go-path "%{gopath}" %{?goprovflags}
|
|
|
92bf05 |
-%__go_requires go-rpm-integration requires --prefix "%{buildroot}" --go-path "%{gopath}" %{?goreqflags}
|
|
|
92bf05 |
diff --git a/rpm/lua/rpm/go.lua b/rpm/lua/rpm/go.lua
|
|
|
92bf05 |
index cb5f958..fb42cb7 100644
|
|
|
92bf05 |
--- a/rpm/lua/rpm/go.lua
|
|
|
92bf05 |
+++ b/rpm/lua/rpm/go.lua
|
|
|
92bf05 |
@@ -72,63 +72,6 @@ local function env(suffix, goipath, verbose, usermetadata)
|
|
|
92bf05 |
fedora.explicitset( "currentgoldflags", ldflags, verbose)
|
|
|
92bf05 |
end
|
|
|
92bf05 |
|
|
|
92bf05 |
--- Create a single set of %install tasks for a known kind of Go subpackage
|
|
|
92bf05 |
-local function singleinstall(kind, suffix, verbose)
|
|
|
92bf05 |
- local go = require "fedora.srpm.go"
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- go.develenv(suffix, verbose)
|
|
|
92bf05 |
- for goipath in string.gmatch(rpm.expand("%{currentgoipaths}"), "[^%s]+") do
|
|
|
92bf05 |
- env('', goipath, verbose, {})
|
|
|
92bf05 |
- local vflag = verbose and " -v" or ""
|
|
|
92bf05 |
- print(rpm.expand("%__godevelinstall -i " .. goipath .. vflag .. "\n"))
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- print(rpm.expand("%__godevelinstalldoc\n"))
|
|
|
92bf05 |
- elseif (kind == "alt") then
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- local ismain = (suffix == "") or (suffix == "0")
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose)
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- for rpmname, goaltipaths in pairs(go.indexedgoipaths("%{goaltipaths" .. suffix .. "}",
|
|
|
92bf05 |
- "%{goaltcid" .. suffix .. "}")) do
|
|
|
92bf05 |
- go.altenv(suffix, rpmname, goaltipaths, verbose)
|
|
|
92bf05 |
- gocanonipath = rpm.expand("%{currentgocanonipath}")
|
|
|
92bf05 |
- for _, goaltipath in ipairs(goaltipaths) do
|
|
|
92bf05 |
- fedora.explicitset("currentgoaltipath", goaltipath)
|
|
|
92bf05 |
- print(rpm.expand("%__goaltinstall\n"))
|
|
|
92bf05 |
- goaltipath = string.gsub(goaltipath, "/?[^/]+/?$", "")
|
|
|
92bf05 |
- while (not string.match(gocanonipath, "^" .. goaltipath)) do
|
|
|
92bf05 |
- print(rpm.expand('echo \'%dir "%{gopath}/src/' .. goaltipath .. '"\' >> "%{goworkdir}/%{currentgoaltfilelist}"\n'))
|
|
|
92bf05 |
- goaltipath = string.gsub(goaltipath, "/?[^/]+/?$", "")
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- rpm.expand("%{error:Unknown kind of Go subpackage: " .. kind .. "}")
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
--- Create one or all %install tasks for a known kind of go subpackage
|
|
|
92bf05 |
-local function install(kind, suffix, processall, verbose)
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- local go = require "fedora.srpm.go"
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- go.develenvinit()
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- if processall then
|
|
|
92bf05 |
- for _, suffix in pairs(fedora.getsuffixes(go.pivot[kind])) do
|
|
|
92bf05 |
- singleinstall(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- singleinstall(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
return {
|
|
|
92bf05 |
- env = env,
|
|
|
92bf05 |
- install = install,
|
|
|
92bf05 |
+ env = env,
|
|
|
92bf05 |
}
|
|
|
92bf05 |
diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua
|
|
|
92bf05 |
index 457b8f1..d650b26 100644
|
|
|
92bf05 |
--- a/rpm/lua/srpm/go.lua
|
|
|
92bf05 |
+++ b/rpm/lua/srpm/go.lua
|
|
|
92bf05 |
@@ -232,104 +232,6 @@ local function altenv(suffix, rpmname, goaltipaths, verbose)
|
|
|
92bf05 |
end
|
|
|
92bf05 |
end
|
|
|
92bf05 |
|
|
|
92bf05 |
--- Create a single %package section for a known kind of Go subpackage
|
|
|
92bf05 |
-local function singlepkg(kind, suffix, verbose)
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- develenv(suffix, verbose)
|
|
|
92bf05 |
- print(
|
|
|
92bf05 |
- rpm.expand(
|
|
|
92bf05 |
- "%package -n %{currentgodevelname}\n" ..
|
|
|
92bf05 |
- "Summary: %{currentgodevelsummary}\n" ..
|
|
|
92bf05 |
- "BuildRequires: go-rpm-macros\n" ..
|
|
|
92bf05 |
- "BuildArch: noarch\n" ..
|
|
|
92bf05 |
- "%{?currentgodevelheader}\n" ..
|
|
|
92bf05 |
- "%description -n %{currentgodevelname}\n") ..
|
|
|
92bf05 |
- fedora.wordwrap("%{?currentgodeveldescription}") ..
|
|
|
92bf05 |
- "\n")
|
|
|
92bf05 |
- elseif (kind == "alt") then
|
|
|
92bf05 |
- local ismain = (suffix == "") or (suffix == "0")
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose)
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- for rpmname, goaltipaths in pairs(indexedgoipaths("%{goaltipaths" .. suffix .. "}",
|
|
|
92bf05 |
- "%{goaltcid" .. suffix .. "}")) do
|
|
|
92bf05 |
- altenv(suffix, rpmname, goaltipaths, verbose)
|
|
|
92bf05 |
- print(
|
|
|
92bf05 |
- rpm.expand(
|
|
|
92bf05 |
- "%package -n %{currentgoaltname}\n" ..
|
|
|
92bf05 |
- "Summary: %{currentgoaltsummary}\n" ..
|
|
|
92bf05 |
- "BuildRequires: go-rpm-macros\n" ..
|
|
|
92bf05 |
- "BuildArch: noarch\n" ..
|
|
|
92bf05 |
- "%{?currentgoaltheader}\n" ..
|
|
|
92bf05 |
- "%description -n %{currentgoaltname}\n") ..
|
|
|
92bf05 |
- fedora.wordwrap("%{?currentgoaltdescription}") ..
|
|
|
92bf05 |
- "\n")
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- rpm.expand("%{error:Unknown kind of Go subpackage: " .. kind .. "}")
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
--- Create one or all %package sections for a known kind of go subpackage
|
|
|
92bf05 |
-local function pkg(kind, suffix, processall, verbose)
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- develenvinit()
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- if processall then
|
|
|
92bf05 |
- for _, suffix in pairs(fedora.getsuffixes(pivot[kind])) do
|
|
|
92bf05 |
- singlepkg(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- singlepkg(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
--- Create a single %files section for a known kind of Go subpackage
|
|
|
92bf05 |
-local function singlefiles(kind, suffix, verbose)
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- develenv(suffix, verbose)
|
|
|
92bf05 |
- print(rpm.expand('%files -n %{currentgodevelname} -f "%{goworkdir}/%{currentgodevelfilelist}"\n'))
|
|
|
92bf05 |
- elseif (kind == "alt") then
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- local ismain = (suffix == "") or (suffix == "0")
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- fedora.safeset("goaltcid" .. suffix, "%{?gocid" .. suffix .. "}", verbose)
|
|
|
92bf05 |
- if ismain then
|
|
|
92bf05 |
- fedora.zalias({"goaltcid"}, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- for rpmname, goaltipaths in pairs(indexedgoipaths("%{goaltipaths" .. suffix .. "}",
|
|
|
92bf05 |
- "%{goaltcid" .. suffix .. "}")) do
|
|
|
92bf05 |
- altenv(suffix, rpmname, goaltipaths, verbose)
|
|
|
92bf05 |
- print(rpm.expand('%files -n %{currentgoaltname} -f "%{goworkdir}/%{currentgoaltfilelist}"\n'))
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- rpm.expand("%{error:Unknown kind of Go subpackage: " .. kind .. "}")
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
--- Create one or all %files sections for a known kind of go subpackage
|
|
|
92bf05 |
-local function files(kind, suffix, processall, verbose)
|
|
|
92bf05 |
- local fedora = require "fedora.common"
|
|
|
92bf05 |
- if (kind == "devel") then
|
|
|
92bf05 |
- develenvinit()
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- if processall then
|
|
|
92bf05 |
- for _, suffix in pairs(fedora.getsuffixes(pivot[kind])) do
|
|
|
92bf05 |
- singlefiles(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- else
|
|
|
92bf05 |
- singlefiles(kind, suffix, verbose)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-
|
|
|
92bf05 |
return {
|
|
|
92bf05 |
rpmname = rpmname,
|
|
|
92bf05 |
meta = meta,
|
|
|
92bf05 |
@@ -338,6 +240,5 @@ return {
|
|
|
92bf05 |
develenvinit = develenvinit,
|
|
|
92bf05 |
develenv = develenv,
|
|
|
92bf05 |
altenv = altenv,
|
|
|
92bf05 |
- pkg = pkg,
|
|
|
92bf05 |
- files = files,
|
|
|
92bf05 |
}
|
|
|
92bf05 |
+
|
|
|
92bf05 |
diff --git a/rpm/macros.d/macros.go-compilers-golang b/rpm/macros.d/macros.go-compilers-golang
|
|
|
92bf05 |
index b0ab4c4..942549f 100644
|
|
|
92bf05 |
--- a/rpm/macros.d/macros.go-compilers-golang
|
|
|
92bf05 |
+++ b/rpm/macros.d/macros.go-compilers-golang
|
|
|
92bf05 |
@@ -20,6 +20,8 @@
|
|
|
92bf05 |
#
|
|
|
92bf05 |
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
92bf05 |
|
|
|
92bf05 |
+%gocompilerflags -buildmode pie -compiler gc
|
|
|
92bf05 |
+
|
|
|
92bf05 |
# This *must* be all on one line, as it will be used in shell
|
|
|
92bf05 |
# assignments. eg
|
|
|
92bf05 |
#
|
|
|
92bf05 |
@@ -29,22 +31,33 @@
|
|
|
92bf05 |
#
|
|
|
92bf05 |
# %make GOBUILDFLAGS="%gobuildflags"
|
|
|
92bf05 |
#
|
|
|
92bf05 |
-%gobuildflags() %{expand:%{gocompilerflags} -tags=\\"rpm_crashtraceback \\" -ldflags \\"${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'\\" -a -v -x}
|
|
|
92bf05 |
+%gobuildflags() %{expand:%{gocompilerflags} -tags=\\"rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl\\" -ldflags \\"-linkmode=external -compressdwarf=false ${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'\\" -a -v -x}
|
|
|
92bf05 |
+%_gobuildflags_internal() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x}
|
|
|
92bf05 |
|
|
|
92bf05 |
# Turn off Go modules
|
|
|
92bf05 |
%gomodulesmode GO111MODULE=off
|
|
|
92bf05 |
|
|
|
92bf05 |
# Define commands for building
|
|
|
92bf05 |
# BUILD_ID can be generated for golang build no matter of debuginfo
|
|
|
92bf05 |
+
|
|
|
92bf05 |
+%_gobuild_cmd CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build %{_gobuildflags_internal}
|
|
|
92bf05 |
+%gobuild_compat_el8(o:) %{expand:%{_gobuild_cmd} %{?**};}
|
|
|
92bf05 |
%gobuild(o:) %{expand:
|
|
|
92bf05 |
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
|
|
|
92bf05 |
%global _dwz_low_mem_die_limit 0
|
|
|
92bf05 |
%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
|
|
|
92bf05 |
- go build %{?gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**};
|
|
|
92bf05 |
+ %{_gobuild_cmd} %{?**};
|
|
|
92bf05 |
}
|
|
|
92bf05 |
${workroot}${GOPATH:+:${GOPATH}}
|
|
|
92bf05 |
|
|
|
92bf05 |
# Define commands for testing
|
|
|
92bf05 |
%gotestflags %{gocompilerflags}
|
|
|
92bf05 |
%gotestextldflags %__global_ldflags %{?__golang_extldflags}
|
|
|
92bf05 |
-%gotest() %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};
|
|
|
92bf05 |
+
|
|
|
92bf05 |
+%_gotest_cmd %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'"
|
|
|
92bf05 |
+%gotest_compat_el8(o:) %{expand:%{_gotest_cmd} %{?**};}
|
|
|
92bf05 |
+%gotest(o:) %{expand:
|
|
|
92bf05 |
+ %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
|
|
|
92bf05 |
+ %{_gotest_cmd} %{?**};
|
|
|
92bf05 |
+}
|
|
|
92bf05 |
+
|
|
|
92bf05 |
diff --git a/rpm/macros.d/macros.go-rpm b/rpm/macros.d/macros.go-rpm
|
|
|
92bf05 |
index f773f34..b82581b 100644
|
|
|
92bf05 |
--- a/rpm/macros.d/macros.go-rpm
|
|
|
92bf05 |
+++ b/rpm/macros.d/macros.go-rpm
|
|
|
92bf05 |
@@ -22,42 +22,6 @@
|
|
|
92bf05 |
#
|
|
|
92bf05 |
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
92bf05 |
|
|
|
92bf05 |
-# Default filtering policy
|
|
|
92bf05 |
-# Complete or replace the following variables in your spec file if this policy
|
|
|
92bf05 |
-# does not apply to your project
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Specific example matching rule.
|
|
|
92bf05 |
-# The average Go project example code is incomplete and obsolete. It will
|
|
|
92bf05 |
-# fail to compile as-is, or even panic. It will poison the dependency
|
|
|
92bf05 |
-# generator with bogus or legacy import path requirements. Even when it it
|
|
|
92bf05 |
-# clean and up to date, it will require many third party components not needed
|
|
|
92bf05 |
-# in production. Therefore:
|
|
|
92bf05 |
-# – never install Go project example code in %{gopath}. Publish is as %doc.
|
|
|
92bf05 |
-# — ask politely projects that publish example code in some other directory
|
|
|
92bf05 |
-# than _examples to rename it.
|
|
|
92bf05 |
-# – never rely on third party examples being available or working in another
|
|
|
92bf05 |
-# project. This is *not* production code. Ask upstreams politely to remove
|
|
|
92bf05 |
-# tests or code that import other project examples.
|
|
|
92bf05 |
-%goignoreflags_examples -r '.*example.*'
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Default flags to apply in all stages
|
|
|
92bf05 |
-%godefaultflags %{goignoreflags_examples}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Default flags to apply in Go install (%goinstall)
|
|
|
92bf05 |
-%goinstallflags %{godefaultflags}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Default flags to apply in Go checks (%gochecks)
|
|
|
92bf05 |
-%gocheckflags %{godefaultflags}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Default flags to apply in Go autoprovides
|
|
|
92bf05 |
-%goprovflags %{godefaultflags}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Default flags to apply in Go autorequires
|
|
|
92bf05 |
-%goreqflags %{godefaultflags}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# The default filelist name generated by %goinstall
|
|
|
92bf05 |
-%gofilelist devel.file-list
|
|
|
92bf05 |
-
|
|
|
92bf05 |
# Sets environment variables suitable for a Go source archive. Optional arguments:
|
|
|
92bf05 |
# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
# %{goipath<number>}, %{commit<number>}…
|
|
|
92bf05 |
@@ -116,6 +80,7 @@ fi
|
|
|
92bf05 |
cd "%{mybuilddir}/src/%{mygoipath}"
|
|
|
92bf05 |
}
|
|
|
92bf05 |
|
|
|
92bf05 |
+
|
|
|
92bf05 |
# Perform usual Go source preparation steps. Optional arguments:
|
|
|
92bf05 |
# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
# %{goipath<number>}, %{commit<number>}…
|
|
|
92bf05 |
@@ -160,207 +125,3 @@ else
|
|
|
92bf05 |
process(rpm.expand("%{?-z*}"))
|
|
|
92bf05 |
end
|
|
|
92bf05 |
}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Computes BuildRequires for a given import path. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipath<number>}, %{commit<number>}…
|
|
|
92bf05 |
-# derived from the import path value if not specified
|
|
|
92bf05 |
-# -a process all sources in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -i <go import path> use the specified import path value instead of the one
|
|
|
92bf05 |
-# found in %{goipath<number>}
|
|
|
92bf05 |
-%go_generate_buildrequires(z:ai:) %{lua:
|
|
|
92bf05 |
-local fedora = require "fedora.common"
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local forcedgoipath = rpm.expand("%{?-i}")
|
|
|
92bf05 |
-local golistargs = ""
|
|
|
92bf05 |
-if processall then
|
|
|
92bf05 |
- for _, s in pairs(fedora.getsuffixes("goipath")) do
|
|
|
92bf05 |
- golistargs = golistargs .. " --package-path %{goipath" .. s .. "}"
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- golistargs = string.gsub(golistargs, "^ ", "")
|
|
|
92bf05 |
-elseif forcedgoipath ~= "" then
|
|
|
92bf05 |
- golistargs = "--package-path " .. forcedgoipath
|
|
|
92bf05 |
-else
|
|
|
92bf05 |
- golistargs = "--package-path %{goipath" .. rpm.expand("%{?-z*}") .. "}"
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-print(rpm.expand('GOPATH="%{?gobuilddir:%{gobuilddir}:}${GOPATH:+${GOPATH}:}%{?gopath}" ' ..
|
|
|
92bf05 |
- 'GO111MODULE=off ' ..
|
|
|
92bf05 |
- "golist --imported " .. golistargs ..
|
|
|
92bf05 |
- " --template 'golang({{.}})\\\\n'" ..
|
|
|
92bf05 |
- " --with-tests --skip-self\\n"))
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Try to install Go package files in sensible locations, with strict directory
|
|
|
92bf05 |
-# ownership and lockfile creation as required by Go autodeps.
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Simple arguments, that can not be repeated:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipath<number>}, %{commit<number>}…
|
|
|
92bf05 |
-# derived from the import path value if not specified
|
|
|
92bf05 |
-# -a process all sources in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -i <go import path> use the specified import path value
|
|
|
92bf05 |
-# default: %{goipath<number>}
|
|
|
92bf05 |
-# -b <bindir> read binaries already produced in <bindir>
|
|
|
92bf05 |
-# default: %{gobuilddir}/bin
|
|
|
92bf05 |
-# -s <sourcedir> read expanded and prepared Go sources in <sourcedir>/src
|
|
|
92bf05 |
-# <sourcedir> should be populated in %prep
|
|
|
92bf05 |
-# default: %{gobuilddir}
|
|
|
92bf05 |
-# -o <filename> output installed file list in <filename>
|
|
|
92bf05 |
-# default: %{gofilelist<number>}
|
|
|
92bf05 |
-# -O <directory> output <filename> in <directory>
|
|
|
92bf05 |
-# -l <ldflags> add those flags to LDFLAGS when building unit tests
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Inclusion arguments, that can be repeated:
|
|
|
92bf05 |
-# -e <extension> include files with the provided extension
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Exclusion arguments, that can be repeated, relative to the go import path root:
|
|
|
92bf05 |
-# -d <directory> exclude the files contained in <directory>
|
|
|
92bf05 |
-# not recursive (subdirectories are not excluded)
|
|
|
92bf05 |
-# -t <tree root> exclude the files contained in <tree root>
|
|
|
92bf05 |
-# recursive (subdirectories are excluded)
|
|
|
92bf05 |
-# -r <regexp> exclude files matching <regexp>,
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Optional versionning metadata, that can not be repeated:
|
|
|
92bf05 |
-# -V <version> Should only be specified when creating subpackages with
|
|
|
92bf05 |
-# distinct versions
|
|
|
92bf05 |
-# default: %{version}.%{release}
|
|
|
92bf05 |
-# -T <tag> default: %{tag<number>}
|
|
|
92bf05 |
-# -C <commit> default: %{commit<number>}
|
|
|
92bf05 |
-# -B <branch> default: %{branch<number>}
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# When invoked several times with the same import path goinstall will append to
|
|
|
92bf05 |
-# the existing file list if versionning and exclusion arguments are identical to
|
|
|
92bf05 |
-# previous calls, and error out otherwise.
|
|
|
92bf05 |
-# When invoked several times with different file list names, it will attribute
|
|
|
92bf05 |
-# directories to the first file list that makes use of them.
|
|
|
92bf05 |
-%goinstall(z:ai:b:s:o:O:ve:d:t:rV:T:C:B:p:g:) %{lua:
|
|
|
92bf05 |
-local fedora = require "fedora.common"
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local myenvflags = rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}')
|
|
|
92bf05 |
-local myinstallflags = rpm.expand('%{!-i:-i "%%{currentgoipath}" }' ..
|
|
|
92bf05 |
- '%{!-b:-b "%%{gobuilddir}/bin" }' ..
|
|
|
92bf05 |
- '%{!-s:-s "%%{gobuilddir}" }' ..
|
|
|
92bf05 |
- '%{!-o:-o "%%{thisgofilelist}" }' ..
|
|
|
92bf05 |
- '%{!-O:-O "%%{goworkdir}" }' ..
|
|
|
92bf05 |
- '%{!-V:-V "%{version}-%{release}" }' ..
|
|
|
92bf05 |
- '%{!-T:%%{?currenttag: -T "%%{?currenttag}" }}' ..
|
|
|
92bf05 |
- '%{!-C:%%{?currentcommit: -C "%%{?currentcommit}" }}' ..
|
|
|
92bf05 |
- '%{!-B:%%{?currentbranch: -B "%%{?currentbranch}" }}' ..
|
|
|
92bf05 |
- '%{!-p:-p "%{buildroot}" }' ..
|
|
|
92bf05 |
- '%{!-g:-g "%{gopath}" }' ..
|
|
|
92bf05 |
- '%{?goinstallflags} %{?**}')
|
|
|
92bf05 |
--- Main function
|
|
|
92bf05 |
-local function process(suffix)
|
|
|
92bf05 |
- local zsuffix = ""
|
|
|
92bf05 |
- if (suffix ~= "") and (suffix ~= nil) then
|
|
|
92bf05 |
- zsuffix = "-z " .. suffix .. " "
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- print(rpm.expand('%goenv ' .. zsuffix .. myenvflags .. '\\n' ..
|
|
|
92bf05 |
- 'go-rpm-integration install ' .. myinstallflags .. '\\n'))
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
--- Main loop
|
|
|
92bf05 |
-if processall then
|
|
|
92bf05 |
- for _,s in pairs(fedora.getsuffixes("goipath")) do
|
|
|
92bf05 |
- process(s)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-else
|
|
|
92bf05 |
- process(rpm.expand("%{-z*}"))
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Perform the %install tasks of every known kind of Go subpackage. Arguments:
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%gopkginstall(av) %{expand:
|
|
|
92bf05 |
-%godevelinstall -a %{-v}
|
|
|
92bf05 |
-%goaltinstall -a %{-v}
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Perform the %install tasks of a golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%godevelinstall(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.rpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.install("devel", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Perform the %install tasks of a compat-golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goaltipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%goaltinstall(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.rpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.install("alt", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Run go test with Fedora flags on all subdirectories except for those filtered out
|
|
|
92bf05 |
-# THIS MACRO IS OPT-OUT.
|
|
|
92bf05 |
-#
|
|
|
92bf05 |
-# Simple arguments, that can not be repeated:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipath<number>}, %{commit<number>}…
|
|
|
92bf05 |
-# derived from the import path value if not specified
|
|
|
92bf05 |
-# -a process all sources in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -i <go import path> use the specified import path value
|
|
|
92bf05 |
-# default: %{goipath<number>}
|
|
|
92bf05 |
-# -b <bindir> read binaries already produced in <bindir>
|
|
|
92bf05 |
-# default: %{gobuilddir}/bin
|
|
|
92bf05 |
-# -s <sourcedir> read expanded and prepared Go sources in <sourcedir>/src
|
|
|
92bf05 |
-# <sourcedir> should be populated in %prep
|
|
|
92bf05 |
-# default: %{gobuilddir}
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-# Exclusion arguments, that can be repeated, relative to the go import path root:
|
|
|
92bf05 |
-# -d <directory> exclude the files contained in <directory>
|
|
|
92bf05 |
-# not recursive (subdirectories are not excluded)
|
|
|
92bf05 |
-# -t <tree root> exclude the files contained in <tree root>
|
|
|
92bf05 |
-# recursive (subdirectories are excluded)
|
|
|
92bf05 |
-# -r <regexp> exclude files matching <regexp>,
|
|
|
92bf05 |
-%gocheck(z:ai:b:s:vd:t:rV:T:C:B:p:g:w) %{lua:
|
|
|
92bf05 |
-local fedora = require "fedora.common"
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local myenvflags = rpm.expand('%{?-i} %{?-v} %{?-V} %{?-T} %{?-C} %{?-B}')
|
|
|
92bf05 |
-local mycheckflags = rpm.expand('%{!-i:-i "%%{currentgoipath}" }' ..
|
|
|
92bf05 |
- '%{!-b:-b "%%{gobuilddir}/bin" }' ..
|
|
|
92bf05 |
- '%{!-s:-s "%%{gobuilddir}" }' ..
|
|
|
92bf05 |
- '%{!-V:-V "%{version}-%{release}" }' ..
|
|
|
92bf05 |
- '%{!-T:%%{?currenttag: -T "%%{?currenttag}" }}' ..
|
|
|
92bf05 |
- '%{!-C:%%{?currentcommit: -C "%%{?currentcommit}" }}' ..
|
|
|
92bf05 |
- '%{!-B:%%{?currentbranch: -B "%%{?currentbranch}" }}' ..
|
|
|
92bf05 |
- '%{!-p:-p "%{buildroot}" }' ..
|
|
|
92bf05 |
- '%{!-g:-g "%{gopath}" }' ..
|
|
|
92bf05 |
- '%{?gocheckflags} %{?**}')
|
|
|
92bf05 |
--- Main function
|
|
|
92bf05 |
-local function process(suffix)
|
|
|
92bf05 |
- local zsuffix = ""
|
|
|
92bf05 |
- if (suffix ~= "") and (suffix ~= nil) then
|
|
|
92bf05 |
- zsuffix = "-z " .. suffix .. " "
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
- print(rpm.expand('%goenv ' .. zsuffix .. myenvflags .. '\\n' ..
|
|
|
92bf05 |
- '%{?currentgoldflags:LDFLAGS="${LDFLAGS} %{?currentgoldflags}" }' ..
|
|
|
92bf05 |
- '%{?gotestflags:GO_TEST_FLAGS="%{gotestflags}" }' ..
|
|
|
92bf05 |
- '%{?gotestextldflags:GO_TEST_EXT_LD_FLAGS="%{gotestextldflags}" }' ..
|
|
|
92bf05 |
- 'go-rpm-integration check ' .. mycheckflags .. '\\n'))
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
--- Main loop
|
|
|
92bf05 |
-if processall then
|
|
|
92bf05 |
- for _,s in pairs(fedora.getsuffixes("goipath")) do
|
|
|
92bf05 |
- process(s)
|
|
|
92bf05 |
- end
|
|
|
92bf05 |
-else
|
|
|
92bf05 |
- process(rpm.expand("%{-z*}"))
|
|
|
92bf05 |
-end
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm
|
|
|
92bf05 |
index 884463f..60b62ac 100644
|
|
|
92bf05 |
--- a/rpm/macros.d/macros.go-srpm
|
|
|
92bf05 |
+++ b/rpm/macros.d/macros.go-srpm
|
|
|
92bf05 |
@@ -122,72 +122,3 @@ else
|
|
|
92bf05 |
end
|
|
|
92bf05 |
}
|
|
|
92bf05 |
|
|
|
92bf05 |
-# Create %package sections for every known kind of go subpackage. Arguments:
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%gopkg(av) %{expand:
|
|
|
92bf05 |
-%godevelpkg -a %{-v}
|
|
|
92bf05 |
-%goaltpkg -a %{-v}
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Create a %package section for a golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%godevelpkg(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.srpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.pkg("devel", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Create a %package section for a compat-golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goaltipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%goaltpkg(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.srpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.pkg("alt", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Create %files sections for every known kind of Go subpackage. Arguments:
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%gopkgfiles(av) %{expand:
|
|
|
92bf05 |
-%godevelfiles -a %{-v}
|
|
|
92bf05 |
-%goaltfiles -a %{-v}
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Create a %files section for a golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%godevelfiles(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.srpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.files("devel", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|
|
|
92bf05 |
-
|
|
|
92bf05 |
-# Create a %files section for a compat-golang-*-devel subpackage. Arguments:
|
|
|
92bf05 |
-# -z <number> read the zth block of definitions, for example
|
|
|
92bf05 |
-# %{goaltipaths<number>}
|
|
|
92bf05 |
-# -a process all blocks in one go, instead of using separate
|
|
|
92bf05 |
-# -z calls
|
|
|
92bf05 |
-# -v be verbose
|
|
|
92bf05 |
-%goaltfiles(z:av) %{lua:
|
|
|
92bf05 |
-local go = require "fedora.srpm.go"
|
|
|
92bf05 |
-local suffix = rpm.expand("%{-z*}")
|
|
|
92bf05 |
-local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
92bf05 |
-local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
92bf05 |
-go.files("alt", suffix, processall, verbose)
|
|
|
92bf05 |
-}
|