Compare commits
No commits in common. "c9-beta" and "a10s" have entirely different histories.
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,2 +1,16 @@
|
||||
SOURCES/go-rpm-macros-3.6.0.tar.gz
|
||||
SOURCES/golist-0.10.4.tar.gz
|
||||
/go-rpm-macros-3.0.8.tar.gz
|
||||
/go-rpm-macros-3.0.9.tar.gz
|
||||
/go-rpm-macros-3.0.10.tar.gz
|
||||
/go-rpm-macros-3.0.11.tar.gz
|
||||
/go-rpm-macros-3.0.12.tar.gz
|
||||
/go-rpm-macros-3.0.13.tar.gz
|
||||
/go-rpm-macros-3.0.14.tar.gz
|
||||
/go-rpm-macros-3.0.15.tar.gz
|
||||
/go-rpm-macros-3.1.0.tar.gz
|
||||
/go-rpm-macros-3.2.0.tar.gz
|
||||
/golist-0.10.3.tar.gz
|
||||
/golist-0.10.3-vendor.tar.xz
|
||||
/golist-0.10.4.tar.gz
|
||||
/golist-0.10.4-vendor.tar.xz
|
||||
/go-rpm-macros-3.3.0.tar.gz
|
||||
/go-rpm-macros-3.6.0.tar.gz
|
||||
|
@ -1,2 +0,0 @@
|
||||
9db262bd1b5acd1c3490d55b839819a878e6659c SOURCES/go-rpm-macros-3.6.0.tar.gz
|
||||
4a105131658d029fe0b2d312b078a056748af2b4 SOURCES/golist-0.10.4.tar.gz
|
@ -1,52 +0,0 @@
|
||||
From 948c86d17904abf5d9d9c42c55ab78f6b970b972 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
|
||||
Date: Tue, 5 Jul 2022 19:50:30 +0200
|
||||
Subject: [PATCH] Add libexec to path for EPEL9 golist
|
||||
|
||||
---
|
||||
bin/go-rpm-integration | 2 ++
|
||||
rpm/gosymlink.deps | 2 ++
|
||||
rpm/macros.d/macros.go-rpm | 3 ++-
|
||||
3 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bin/go-rpm-integration b/bin/go-rpm-integration
|
||||
index 8a0f6b2..d460a61 100755
|
||||
--- a/bin/go-rpm-integration
|
||||
+++ b/bin/go-rpm-integration
|
||||
@@ -17,6 +17,8 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
+export PATH="${PATH}:/usr/libexec/go-rpm-macros"
|
||||
+
|
||||
usage() {
|
||||
cat >&2 << EOF_USAGE
|
||||
Usage: $0 <action> [ [-h] ]
|
||||
diff --git a/rpm/gosymlink.deps b/rpm/gosymlink.deps
|
||||
index d7f2866..a6d6538 100755
|
||||
--- a/rpm/gosymlink.deps
|
||||
+++ b/rpm/gosymlink.deps
|
||||
@@ -16,6 +16,8 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
+export PATH="${PATH}:/usr/libexec/go-rpm-macros"
|
||||
+
|
||||
usage() {
|
||||
cat >&2 << EOF_USAGE
|
||||
Usage: $0 <action> [ [-h] ]
|
||||
diff --git a/rpm/macros.d/macros.go-rpm b/rpm/macros.d/macros.go-rpm
|
||||
index f773f34..9cad4df 100644
|
||||
--- a/rpm/macros.d/macros.go-rpm
|
||||
+++ b/rpm/macros.d/macros.go-rpm
|
||||
@@ -186,6 +186,7 @@ else
|
||||
end
|
||||
print(rpm.expand('GOPATH="%{?gobuilddir:%{gobuilddir}:}${GOPATH:+${GOPATH}:}%{?gopath}" ' ..
|
||||
'GO111MODULE=off ' ..
|
||||
+ 'PATH="${PATH}:%{_libexecdir}/go-rpm-macros" ' ..
|
||||
"golist --imported " .. golistargs ..
|
||||
" --template 'golang({{.}})\\\\n'" ..
|
||||
" --with-tests --skip-self\\n"))
|
||||
--
|
||||
2.36.1
|
||||
|
@ -1,34 +0,0 @@
|
||||
From 1001f5a99439556c5ad3efe6045923e985a52f82 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
|
||||
Date: Wed, 22 Sep 2023 12:00:00 +0100
|
||||
Subject: [PATCH] Add %gobuild and %gotest
|
||||
|
||||
Both macros are define in rpm/macros.d/macros.go-compilers-gcc.
|
||||
CentOS Stream 9 go-srpm-macros discards that file and only installs rpm/macros.d/macros.go-srpm.
|
||||
|
||||
This commit adds %gobuild and %gotest to rpm/macros.d/macros.go-srpm with the same options that RHEL 8 uses.
|
||||
|
||||
This also sets the base ISA for x86_64 and Power.
|
||||
---
|
||||
rpm/macros.d/macros.go-srpm | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm
|
||||
index a46f81f..05cd6c9 100644
|
||||
--- a/rpm/macros.d/macros.go-srpm
|
||||
+++ b/rpm/macros.d/macros.go-srpm
|
||||
@@ -202,3 +202,11 @@ local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
||||
local verbose = (rpm.expand("%{-v}") ~= "")
|
||||
go.files("alt", suffix, processall, verbose)
|
||||
}
|
||||
+
|
||||
+# Define commands for building
|
||||
+# BUILD_ID can be generated for golang build no matter of debuginfo
|
||||
+%gobuild(o:) \
|
||||
+GOPPC64=power9 GOAMD64=v2 CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie -tags="rpm_crashtraceback libtrust_openssl ${GO_BUILDTAGS-${BUILDTAGS-}}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\
|
||||
+
|
||||
+# Define commands for testing
|
||||
+%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};
|
||||
--
|
||||
2.38.1
|
||||
|
@ -1,322 +0,0 @@
|
||||
diff --git a/cmd/golist/golist.go b/cmd/golist/golist.go
|
||||
index ee028ae..e9c038d 100644
|
||||
--- a/cmd/golist/golist.go
|
||||
+++ b/cmd/golist/golist.go
|
||||
@@ -11,9 +11,8 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
- "github.com/urfave/cli"
|
||||
-
|
||||
"pagure.io/golist/pkg/util"
|
||||
+ "pagure.io/golist/pkg/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -100,7 +99,6 @@ func main() {
|
||||
}
|
||||
|
||||
app.Action = func(c *cli.Context) error {
|
||||
-
|
||||
if len(c.StringSlice("package-path")) == 0 {
|
||||
return fmt.Errorf("--package-path is not set")
|
||||
}
|
||||
diff --git a/pkg/cli/cli.go b/pkg/cli/cli.go
|
||||
new file mode 100644
|
||||
index 0000000..ec91056
|
||||
--- /dev/null
|
||||
+++ b/pkg/cli/cli.go
|
||||
@@ -0,0 +1,293 @@
|
||||
+package cli
|
||||
+
|
||||
+/* golist uses a very small portion of functionality
|
||||
+ from github.com/urfave/cli. This module provides
|
||||
+ minimal substitute API implementations for only the
|
||||
+ core functionality used by golist, for the purpose of
|
||||
+ bootstrapping golist without additional dependencies.
|
||||
+*/
|
||||
+
|
||||
+import (
|
||||
+ "strings"
|
||||
+ "fmt"
|
||||
+ "os"
|
||||
+)
|
||||
+
|
||||
+type String string
|
||||
+type StringSlice []string
|
||||
+type Bool bool
|
||||
+
|
||||
+type Flag interface {
|
||||
+ name() string
|
||||
+ usage() string
|
||||
+}
|
||||
+
|
||||
+type BoolFlag struct {
|
||||
+ Name string
|
||||
+ Usage string
|
||||
+ Value bool
|
||||
+}
|
||||
+
|
||||
+type StringFlag struct {
|
||||
+ Name string
|
||||
+ Usage string
|
||||
+ Value string
|
||||
+}
|
||||
+
|
||||
+type StringSliceFlag struct {
|
||||
+ Name string
|
||||
+ Usage string
|
||||
+ Value *StringSlice
|
||||
+}
|
||||
+
|
||||
+type App struct {
|
||||
+ Name string
|
||||
+ Usage string
|
||||
+ Version string
|
||||
+ Flags []Flag
|
||||
+ Action func(*Context) error
|
||||
+
|
||||
+}
|
||||
+
|
||||
+func NewApp() App {
|
||||
+ var a App
|
||||
+ return a
|
||||
+}
|
||||
+
|
||||
+func (a *App) Run(osArgs []string) error {
|
||||
+ c, err := newContext(a.Flags, osArgs)
|
||||
+ if err != nil {
|
||||
+ return err
|
||||
+ }
|
||||
+ if c.Bool("help") {
|
||||
+ a.PrintHelp()
|
||||
+ os.Exit(0)
|
||||
+ }
|
||||
+ return a.Action(c)
|
||||
+}
|
||||
+
|
||||
+func (a *App) PrintHelp() {
|
||||
+ maxNameLen := 0
|
||||
+ for _, flag := range a.Flags {
|
||||
+ length := len(flag.name())
|
||||
+ if length > maxNameLen {
|
||||
+ maxNameLen = length
|
||||
+ }
|
||||
+ }
|
||||
+ fmtSpec := "%-" + fmt.Sprintf("%v", maxNameLen + 6) + "s\t%s\n"
|
||||
+ fmt.Printf("%s - %s\n", a.Name, a.Usage)
|
||||
+ fmt.Printf("Options:\n")
|
||||
+ for _, flag := range a.Flags {
|
||||
+ flagNameSlice := append([]string{canonicalName(flag)}, alternateNames(flag)...)
|
||||
+ for i, _ := range flagNameSlice {
|
||||
+ if len(flagNameSlice[i]) > 1 {
|
||||
+ flagNameSlice[i] = fmt.Sprintf("--%s", flagNameSlice[i])
|
||||
+ } else {
|
||||
+ flagNameSlice[i] = fmt.Sprintf("-%s", flagNameSlice[i])
|
||||
+ }
|
||||
+ }
|
||||
+ flagNameStr := strings.Join(flagNameSlice, ", ")
|
||||
+ switch flag.(type) {
|
||||
+ case StringFlag:
|
||||
+ flagNameStr = fmt.Sprintf(" %s value", flagNameStr)
|
||||
+ case StringSliceFlag:
|
||||
+ flagNameStr = fmt.Sprintf(" %s value", flagNameStr)
|
||||
+ case BoolFlag:
|
||||
+ flagNameStr = fmt.Sprintf(" %s", flagNameStr)
|
||||
+ }
|
||||
+ fmt.Printf(fmtSpec, flagNameStr, flag.usage())
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+type Context struct {
|
||||
+ flagValues map[string]interface{}
|
||||
+ flagDecls map[string]Flag
|
||||
+ altFlags map[string]string
|
||||
+ positionalArgs []string
|
||||
+}
|
||||
+
|
||||
+func (c *Context) Bool(flag string) bool {
|
||||
+ iface, ok := c.flagDecls[flag]
|
||||
+ if !ok {
|
||||
+ panic("undefined flag" + flag)
|
||||
+ }
|
||||
+ switch iface.(type) {
|
||||
+ case BoolFlag:
|
||||
+ break
|
||||
+ default:
|
||||
+ panic("flag type mismatch - expected BoolFlag, got: " + flag)
|
||||
+ }
|
||||
+ val, ok := c.flagValues[flag]
|
||||
+ if !ok {
|
||||
+ return iface.(BoolFlag).Value
|
||||
+ }
|
||||
+ return val.(bool)
|
||||
+}
|
||||
+
|
||||
+func (c *Context) String(flag string) string {
|
||||
+ iface, ok := c.flagDecls[flag]
|
||||
+ if !ok {
|
||||
+ panic("undefined flag" + flag)
|
||||
+ }
|
||||
+ switch iface.(type) {
|
||||
+ case StringFlag:
|
||||
+ break
|
||||
+ default:
|
||||
+ panic("flag type mismatch - expected StringFlag, got: " + flag)
|
||||
+ }
|
||||
+ val, ok:= c.flagValues[flag]
|
||||
+ if !ok {
|
||||
+ return iface.(StringFlag).Value
|
||||
+ }
|
||||
+ return val.(string)
|
||||
+}
|
||||
+
|
||||
+func (c *Context) StringSlice(flag string) []string {
|
||||
+ iface, ok := c.flagDecls[flag];
|
||||
+ if !ok {
|
||||
+ panic("undefined flag" + flag)
|
||||
+ }
|
||||
+ switch iface.(type) {
|
||||
+ case StringSliceFlag:
|
||||
+ break
|
||||
+ default:
|
||||
+ panic("flag type mismatch - expected StringSliceFlag, got: " + flag)
|
||||
+ }
|
||||
+ val, ok := c.flagValues[flag]
|
||||
+ if !ok {
|
||||
+ val = iface.(StringSliceFlag).Value
|
||||
+ if val != nil {
|
||||
+ return []string{}
|
||||
+ }
|
||||
+ }
|
||||
+ return val.([]string)
|
||||
+}
|
||||
+
|
||||
+// Create a hash mapping from flag names to declarations
|
||||
+// and alt names to flag names.
|
||||
+func (c *Context) setupFlags(flagDecls []Flag) error {
|
||||
+ helpFlag := BoolFlag {
|
||||
+ Name: "help, h",
|
||||
+ Usage: "Show help message",
|
||||
+ }
|
||||
+ flagDecls = append(flagDecls, helpFlag)
|
||||
+ for _, flag := range flagDecls {
|
||||
+ flagName := canonicalName(flag)
|
||||
+ if _, ok:= c.flagDecls[flagName]; ok {
|
||||
+ return fmt.Errorf("cannot redeclare flag: %s", flagName)
|
||||
+ }
|
||||
+ c.flagDecls[flagName] = flag
|
||||
+ altFlagNames := alternateNames(flag)
|
||||
+ for _, altName := range altFlagNames {
|
||||
+ c.altFlags[altName] = flagName
|
||||
+ }
|
||||
+ }
|
||||
+ return nil
|
||||
+}
|
||||
+
|
||||
+func (c *Context) parseArgs(osArgs []string) error {
|
||||
+ // process command line arguments as a stream of tokens.
|
||||
+ // operations consume the first token in the stream until
|
||||
+ // the stream is empty.
|
||||
+ argStream := osArgs
|
||||
+ for len(argStream) > 0 {
|
||||
+ arg := argStream[0]
|
||||
+ if ! isFlag(arg) {
|
||||
+ argStream = argStream[1:]
|
||||
+ c.positionalArgs = append(c.positionalArgs, arg)
|
||||
+
|
||||
+ } else {
|
||||
+ arg = trimFlag(arg)
|
||||
+ if _, ok:= c.altFlags[arg]; ok {
|
||||
+ arg = c.altFlags[arg]
|
||||
+ }
|
||||
+ iface, ok := c.flagDecls[arg]
|
||||
+ if !ok {
|
||||
+ return fmt.Errorf("unexpected argument: %v", arg)
|
||||
+ }
|
||||
+ switch flag := iface.(type) {
|
||||
+ case StringFlag:
|
||||
+ argStream = argStream[1:]
|
||||
+ if len(argStream) == 0 {
|
||||
+ return fmt.Errorf("expected value for argument: %v", arg)
|
||||
+ }
|
||||
+ if isFlag(argStream[0]) {
|
||||
+ return fmt.Errorf("unexpected flag: %v", arg)
|
||||
+ }
|
||||
+ c.flagValues[arg] = argStream[0]
|
||||
+ case StringSliceFlag:
|
||||
+ argStream = argStream[1:]
|
||||
+ if len (argStream) == 0 {
|
||||
+ return fmt.Errorf("expected value for argument: %v", arg)
|
||||
+ }
|
||||
+ if isFlag(argStream[0]) {
|
||||
+ return fmt.Errorf("unexpected flag: %v", arg)
|
||||
+ }
|
||||
+ c.flagValues[arg] = make([]string, 0)
|
||||
+ c.flagValues[arg] = append(c.flagValues[arg].([]string), argStream[0])
|
||||
+ argStream = argStream[1:]
|
||||
+ for len(argStream) > 0 && ! isFlag(argStream[0]) {
|
||||
+ c.flagValues[arg] = append(c.flagValues[arg].([]string), argStream[0])
|
||||
+ argStream = argStream[1:]
|
||||
+ }
|
||||
+ case BoolFlag:
|
||||
+ argStream = argStream[1:]
|
||||
+ c.flagValues[canonicalName(flag)] = true
|
||||
+ default:
|
||||
+ return fmt.Errorf("unexpected flag: %v", arg)
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return nil
|
||||
+}
|
||||
+
|
||||
+func newContext(flags []Flag, osArgs []string) (*Context, error) {
|
||||
+ var c Context
|
||||
+ c.flagValues = make(map[string]interface{})
|
||||
+ c.flagDecls = make(map[string]Flag)
|
||||
+ c.altFlags = make(map[string]string)
|
||||
+ c.altFlags = make(map[string]string)
|
||||
+ if err := c.setupFlags(flags); err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ if err := c.parseArgs(osArgs); err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ return &c, nil
|
||||
+}
|
||||
+
|
||||
+func (f StringFlag) name() string {return f.Name}
|
||||
+func (f StringFlag) usage() string {return f.Usage}
|
||||
+func (f BoolFlag) name() string {return f.Name}
|
||||
+func (f BoolFlag) usage() string {return f.Usage}
|
||||
+func (f StringSliceFlag) name() string {return f.Name}
|
||||
+func (f StringSliceFlag) usage() string {return f.Usage}
|
||||
+
|
||||
+// takes a Flag with a comma delimited string
|
||||
+// of flag names and returns the first one
|
||||
+func canonicalName(flag Flag) string {
|
||||
+ flagNames := strings.Split(flag.name(), ",")
|
||||
+ return strings.TrimSpace(flagNames[0])
|
||||
+}
|
||||
+
|
||||
+// takes a Flag with a comma delimited string
|
||||
+// of flag names and returns them as a string slice
|
||||
+// with the canonical (first) flag ommitted
|
||||
+func alternateNames(flag Flag) []string {
|
||||
+ flagNames := strings.Split(flag.name(), ",")
|
||||
+ altNames := flagNames[1:]
|
||||
+ for i, _ := range altNames {
|
||||
+ altNames[i] = strings.TrimSpace(altNames[i])
|
||||
+ }
|
||||
+ return altNames
|
||||
+}
|
||||
+
|
||||
+func isFlag(arg string) bool {
|
||||
+ return strings.HasPrefix(arg, "-")
|
||||
+}
|
||||
+
|
||||
+func trimFlag(arg string) string {
|
||||
+ return strings.Trim(strings.Trim(arg, "-"), "-")
|
||||
+}
|
||||
+
|
@ -1,27 +0,0 @@
|
||||
From 75a528c97a3960e993d378ab3bedd37be3620975 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
|
||||
Date: Tue, 30 Jul 2024 17:05:39 +0200
|
||||
Subject: [PATCH] Avoid using rpm.isdefined function
|
||||
|
||||
isdefined is in rpm >= 4.17.0 but RHEL 9.5 is a little bit behind that
|
||||
version so if fails. This should behave similar.
|
||||
---
|
||||
rpm/lua/srpm/go.lua | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua
|
||||
index 01a43a1..4f8011b 100644
|
||||
--- a/rpm/lua/srpm/go.lua
|
||||
+++ b/rpm/lua/srpm/go.lua
|
||||
@@ -69,7 +69,7 @@ local function rpmname(goipath, compatid)
|
||||
-- numbers on top of it, keep a - prefix before version strings
|
||||
result = string.gsub(result, "%-v([%.%d]+)$", "-%1")
|
||||
result = string.gsub(result, "%-v([%.%d]+%-)", "-%1")
|
||||
- if rpm.isdefined('go_use_new_versioning') then
|
||||
+ if rpm.expand("%{?go_use_new_versioning}") ~= "" then
|
||||
-- according to the guidelines, if the base package name does not end with
|
||||
-- a digit, the version MUST be directly appended to the package name with
|
||||
-- no intervening separator.
|
||||
--
|
||||
2.45.2
|
||||
|
@ -1,337 +0,0 @@
|
||||
%global forgeurl https://pagure.io/go-rpm-macros
|
||||
Version: 3.6.0
|
||||
%forgemeta
|
||||
|
||||
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
%global _spectemplatedir %{_datadir}/rpmdevtools/fedora
|
||||
%global _docdir_fmt %{name}
|
||||
|
||||
# Master definition that will be written to macro files
|
||||
%global golang_arches_future x86_64 %{arm} aarch64 ppc64le s390x
|
||||
%global golang_arches %{ix86} %{golang_arches_future}
|
||||
%global gccgo_arches %{mips}
|
||||
%if 0%{?rhel} >= 9
|
||||
%global golang_arches x86_64 aarch64 ppc64le s390x
|
||||
%endif
|
||||
# Go sources can contain arch-specific files and our macros will package the
|
||||
# correct files for each architecture. Therefore, move gopath to _libdir and
|
||||
# make Go devel packages archful
|
||||
%global gopath %{_datadir}/gocode
|
||||
|
||||
# whether to bundle golist or require it as a dependency
|
||||
%global bundle_golist 1
|
||||
|
||||
%if 0%{?bundle_golist}
|
||||
# do not create debuginfo packages when we add a build section
|
||||
%global debug_package %{nil}
|
||||
%global golist_version 0.10.4
|
||||
%global golist_builddir %{_builddir}/golist-%{golist_version}/_build
|
||||
%global golist_goipath pagure.io/golist
|
||||
# where to bundle the golist executable
|
||||
%global golist_execdir %{_libexecdir}/go-rpm-macros/
|
||||
# define gobuild to avoid this package requiring itself to build
|
||||
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v %{?**};
|
||||
%endif
|
||||
|
||||
ExclusiveArch: %{golang_arches} %{gccgo_arches}
|
||||
|
||||
Name: go-rpm-macros
|
||||
Release: 3%{?dist}
|
||||
Summary: Build-stage rpm automation for Go packages
|
||||
|
||||
License: GPLv3+
|
||||
URL: %{forgeurl}
|
||||
Source0: %{forgesource}
|
||||
%if 0%{?bundle_golist}
|
||||
Source1: https://pagure.io/golist/archive/v%{golist_version}/golist-%{golist_version}.tar.gz
|
||||
%endif
|
||||
|
||||
Requires: go-srpm-macros = %{version}-%{release}
|
||||
Requires: go-filesystem = %{version}-%{release}
|
||||
|
||||
%if 0%{?bundle_golist}
|
||||
BuildRequires: golang
|
||||
%else
|
||||
Requires: golist
|
||||
%endif
|
||||
|
||||
%ifarch %{golang_arches}
|
||||
Requires: golang
|
||||
Provides: compiler(golang)
|
||||
Provides: compiler(go-compiler) = 2
|
||||
Obsoletes: go-compilers-golang-compiler < %{version}-%{release}
|
||||
%endif
|
||||
|
||||
%ifarch %{gccgo_arches}
|
||||
Requires: gcc-go
|
||||
Provides: compiler(gcc-go)
|
||||
Provides: compiler(go-compiler) = 1
|
||||
Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release}
|
||||
%endif
|
||||
|
||||
# Replace golang-github-urfave-cli with a minimal
|
||||
# command line parser backend to bootstrap golist
|
||||
# without dependencies.
|
||||
Patch1: golist-bootstrap-cli-no-vendor.patch
|
||||
# Add libexec to PATH in order to launch golist in every script
|
||||
Patch2: 0001-Add-libexec-to-path-for-EPEL9-golist.patch
|
||||
|
||||
# RHEL 8 only provides the macros.go-srpm file which includes gobuild and gotest.
|
||||
# C9S also only provides the macros.go-srpm file but it also follows upstream which includes gobuild and gotest in the macros.go-compilers-gcc.
|
||||
# For a simple fix, this patch ports both RHEL 8 macros to macros.go-srpm.
|
||||
# This also sets the GOAMD64 variable to v2
|
||||
# Resolves: rhbz#1965292
|
||||
# Resolves: RHEL-5529
|
||||
Patch3: add-gobuild-and-gotest.patch
|
||||
|
||||
# Remove when rpm >= 4.17.0
|
||||
Patch4: remove-isdefined-function.patch
|
||||
|
||||
%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: redhat-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}
|
||||
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
#Requires: redhat-rpm-templates
|
||||
|
||||
%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
|
||||
%forgesetup
|
||||
|
||||
%writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_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
|
||||
|
||||
# unpack golist and patch
|
||||
%if 0%{?bundle_golist}
|
||||
# Add libexec to PATH
|
||||
%patch2 -p1
|
||||
pushd %{_builddir}
|
||||
tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz
|
||||
cd golist-%{golist_version}
|
||||
%patch1 -p1
|
||||
cp %{_builddir}/golist-%{golist_version}/LICENSE %{_builddir}/go-rpm-macros-%{version}/LICENSE-golist
|
||||
popd
|
||||
|
||||
# create directory structure for a Go build
|
||||
if [[ ! -e %{golist_builddir}/bin ]]; then
|
||||
install -m 0755 -vd %{golist_builddir}/bin
|
||||
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode
|
||||
fi
|
||||
if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
|
||||
install -m 0755 -vd %{golist_builddir}/src/pagure.io
|
||||
ln -sf $(dirname %{golist_builddir}) %{golist_builddir}/src/%{golist_goipath}
|
||||
|
||||
fi
|
||||
%endif
|
||||
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
# build golist
|
||||
%if 0%{?bundle_golist}
|
||||
pushd %{golist_builddir}/src/%{golist_goipath}
|
||||
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode
|
||||
for cmd in cmd/* ; do
|
||||
%gobuild -o %{golist_builddir}/bin/$(basename $cmd) %{golist_goipath}/$cmd
|
||||
done
|
||||
popd
|
||||
%endif
|
||||
|
||||
%install
|
||||
# Some of those probably do not work with gcc-go right now
|
||||
# This is not intentional, but mips is not a primary Fedora architecture
|
||||
# Patches and PRs are welcome
|
||||
|
||||
install -m 0755 -vd %{buildroot}%{gopath}/src
|
||||
|
||||
install -m 0755 -vd %{buildroot}%{_spectemplatedir}
|
||||
|
||||
if ls templates/rpm/*\.spec; then
|
||||
install -m 0644 -vp templates/rpm/*spec \
|
||||
%{buildroot}%{_spectemplatedir}
|
||||
fi
|
||||
|
||||
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}/fedora/srpm
|
||||
install -m 0644 -vp rpm/lua/srpm/*lua \
|
||||
%{buildroot}%{_rpmluadir}/fedora/srpm
|
||||
install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/rpm
|
||||
install -m 0644 -vp rpm/lua/rpm/*lua \
|
||||
%{buildroot}%{_rpmluadir}/fedora/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
|
||||
|
||||
%ifarch %{gccgo_arches}
|
||||
install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
|
||||
%{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-gcc
|
||||
%endif
|
||||
|
||||
# install golist
|
||||
%if 0%{?bundle_golist}
|
||||
install -m 0755 -vd %{buildroot}%{golist_execdir}
|
||||
install -m 0755 -vp %{golist_builddir}/bin/* %{buildroot}%{golist_execdir}/
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LICENSE.txt LICENSE-golist
|
||||
%doc README.md
|
||||
%{_bindir}/*
|
||||
%{_rpmconfigdir}/fileattrs/*.attr
|
||||
%{_rpmconfigdir}/*.prov
|
||||
%{_rpmconfigdir}/*.deps
|
||||
%{_rpmconfigdir}/macros.d/macros.go-rpm*
|
||||
%{_rpmconfigdir}/macros.d/macros.go-compiler*
|
||||
%{_rpmluadir}/fedora/rpm/*.lua
|
||||
# package golist
|
||||
%if 0%{?bundle_golist}
|
||||
%{golist_execdir}/golist
|
||||
%endif
|
||||
|
||||
%files -n go-srpm-macros
|
||||
%license LICENSE.txt
|
||||
%doc README.md
|
||||
%{_rpmconfigdir}/macros.d/macros.go-srpm
|
||||
%{_rpmluadir}/fedora/srpm/*.lua
|
||||
|
||||
%files -n go-filesystem
|
||||
%dir %{gopath}
|
||||
%dir %{gopath}/src
|
||||
|
||||
%files -n go-rpm-templates
|
||||
%license LICENSE-templates.txt
|
||||
%doc README.md
|
||||
# https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
%dir %{dirname:%{_spectemplatedir}}
|
||||
%dir %{_spectemplatedir}
|
||||
%{_spectemplatedir}/*.spec
|
||||
|
||||
%changelog
|
||||
* Wed Jul 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-3
|
||||
- Fix typo in add-gobuild-and-gotest.patch
|
||||
- Resolves: RHEL-7437
|
||||
|
||||
* Wed Jul 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-2
|
||||
- Remove rpm.isdefined function
|
||||
- Resolves: RHEL-51368
|
||||
|
||||
* Mon Jul 29 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-1
|
||||
- Update to 3.6.0
|
||||
- Revert the usage of rpmautospec, check git's history
|
||||
- Resolves: RHEL-14963
|
||||
|
||||
* Fri Sep 22 2023 Alejandro Sáez <asm@redhat.com> - 3.2.0-3
|
||||
- Update add-gobuild-and-gotest.patch to add GOPPC64 and GOAMD64
|
||||
- Resolves: RHEL-5529
|
||||
|
||||
* Fri Jul 28 2023 Alejandro Sáez <asm@redhat.com> - 3.2.0-2
|
||||
- Add golang_arches_future
|
||||
- Resolves: rhbz#2227224
|
||||
|
||||
* Wed Nov 23 2022 Alejandro Sáez <asm@redhat.com> - 3.2.0-1
|
||||
- Update to 3.2.0
|
||||
- Add add-gobuild-and-gotest.patch
|
||||
- Resolves: rhbz#1965292
|
||||
|
||||
* Wed Jan 26 2022 Alejandro Sáez <asm@redhat.com> - 3.0.9-10
|
||||
- Fix typos in update-default-gobuild-args.patch
|
||||
- Related: rhbz#2043107
|
||||
|
||||
* Tue Jan 18 2022 David Benoit <dbenoit@redhat.com> 3.0.9-9
|
||||
- Delete remove-fedora-dependency-automation.patch
|
||||
- Bundle golist in /usr/libexec
|
||||
- Related: rhbz#2043107
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Tue Aug 03 2021 David Benoit <dbenoit@redhat.com> 3.0.9-7
|
||||
- Escape quotation marks in gobuildflags
|
||||
- Resolves: rhbz#1988717
|
||||
|
||||
* Tue Jul 27 2021 David Benoit <dbenoit@redhat.com> 3.0.9-6
|
||||
- Remove arch conditional on gocompilerflags
|
||||
- Related: rhbz#1982298
|
||||
|
||||
* Fri Jul 23 2021 David Benoit <dbenoit@redhat.com> 3.0.9-5
|
||||
- Remove fedora-specific Go dependency automation macros
|
||||
- Remove dependency on golist
|
||||
- Temporarily remove incompatible template spec files
|
||||
- Update gobuild flags
|
||||
- Resolves: rhbz#1982298
|
||||
|
||||
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com>
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Thu Feb 11 2021 Jeff Law <law@redhat.com> - 3.0.9-3
|
||||
- Drop 32 bit arches in EL 9 (originally from Petr Sabata)
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.9-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Thu Aug 13 2020 Neal Gompa <ngompa13@gmail.com> - 3.0.9-1
|
||||
- Update to 3.0.9
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Wed Jun 05 2019 Nicolas Mailhot <nim@fedoraproject.org>
|
||||
- 3.0.8-3
|
||||
- initial Fedora import, for golist 0.10.0 and redhat-rpm-config 130
|
39
changelog
Normal file
39
changelog
Normal file
@ -0,0 +1,39 @@
|
||||
* Thu Jul 18 2024 Eduard Abdullin <eabdullin@almalinux.org> - 3.0.12-3.alma.1
|
||||
- Add x86_64_v2 to arch list
|
||||
|
||||
* Sat Jan 22 2022 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.12-3
|
||||
- Update to 3.0.12
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.11-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.11-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Mon May 17 2021 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.11-1
|
||||
- Update to 3.0.11
|
||||
|
||||
* Mon Apr 26 2021 Alejandro Sáez <asm@redhat.com> - 3.0.10-1
|
||||
- Update to 3.0.10
|
||||
|
||||
* Thu Feb 11 2021 Jeff Law <law@redhat.com> - 3.0.9-3
|
||||
- Drop 32 bit arches in EL 9 (originally from Petr Sabata)
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.9-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Thu Aug 13 2020 Neal Gompa <ngompa13@gmail.com> - 3.0.9-1
|
||||
- Update to 3.0.9
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.8-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Wed Jun 05 2019 Nicolas Mailhot <nim@fedoraproject.org>
|
||||
- 3.0.8-3
|
||||
- initial Fedora import, for golist 0.10.0 and redhat-rpm-config 130
|
27
gating.yaml
Normal file
27
gating.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_stable
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-8
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-tmt-aarch64.functional}
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-tmt-ppc64le.functional}
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-tmt-x86_64.functional}
|
305
go-rpm-macros.spec
Normal file
305
go-rpm-macros.spec
Normal file
@ -0,0 +1,305 @@
|
||||
%global forgeurl https://pagure.io/go-rpm-macros
|
||||
Version: 3.6.0
|
||||
%forgemeta
|
||||
|
||||
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
%global _spectemplatedir %{_datadir}/rpmdevtools/fedora
|
||||
%global _docdir_fmt %{name}
|
||||
|
||||
# Master definition that will be written to macro files
|
||||
%global golang_arches_future x86_64 x86_64_v2 %{arm} aarch64 ppc64le s390x riscv64
|
||||
%global golang_arches %{ix86} %{golang_arches_future}
|
||||
%global gccgo_arches %{mips}
|
||||
%if 0%{?rhel} >= 9
|
||||
%global golang_arches x86_64 x86_64_v2 aarch64 ppc64le s390x
|
||||
%endif
|
||||
# Go sources can contain arch-specific files and our macros will package the
|
||||
# correct files for each architecture. Therefore, move gopath to _libdir and
|
||||
# make Go devel packages archful
|
||||
%global gopath %{_datadir}/gocode
|
||||
|
||||
# whether to bundle golist or require it as a dependency
|
||||
%if 0%{?rhel}
|
||||
%ifarch %{golang_arches} %{gccgo_arches}
|
||||
%global bundle_golist 1
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global golist_version 0.10.4
|
||||
%if 0%{?bundle_golist}
|
||||
# do not create debuginfo packages when we add a build section
|
||||
%global debug_package %{nil}
|
||||
%global golist_builddir golist-%{golist_version}
|
||||
%global golist_goipath pagure.io/golist
|
||||
# where to bundle the golist executable
|
||||
%global golist_execdir %{_libexecdir}/go-rpm-macros
|
||||
# define gobuild to avoid this package requiring itself to build
|
||||
%define gobuild(o:) GO111MODULE=on go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '${LDFLAGS:-} '" -a -v %{?**};
|
||||
%else
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
Name: go-rpm-macros
|
||||
Release: 1%{?dist}.alma.1
|
||||
Summary: Build-stage rpm automation for Go packages
|
||||
|
||||
License: GPL-3.0-or-later
|
||||
URL: %{forgeurl}
|
||||
Source: %{forgesource}
|
||||
Source1: https://pagure.io/golist/archive/v%{golist_version}/golist-%{golist_version}.tar.gz
|
||||
# vendored dependency tarball, to create:
|
||||
# tar xf golist-%%{golist_version}.tar.gz ; pushd golist-%%{golist_version} ; \
|
||||
# go mod init %%{golist_goipath} && go mod tidy && go mod vendor && \
|
||||
# tar Jcf ../golist-%%{golist_version}-vendor.tar.xz go.mod go.sum vendor/ ; popd
|
||||
Source2: golist-%{golist_version}-vendor.tar.xz
|
||||
|
||||
Requires: go-srpm-macros = %{version}-%{release}
|
||||
Requires: go-filesystem = %{version}-%{release}
|
||||
|
||||
%if 0%{?bundle_golist}
|
||||
BuildRequires: golang
|
||||
Provides: bundled(golist) = %{golist_version}
|
||||
%else
|
||||
Requires: golist
|
||||
%endif
|
||||
|
||||
%ifarch %{golang_arches}
|
||||
Requires: golang
|
||||
Provides: compiler(golang)
|
||||
Provides: compiler(go-compiler) = 2
|
||||
Obsoletes: go-compilers-golang-compiler < %{version}-%{release}
|
||||
%endif
|
||||
|
||||
%ifarch %{gccgo_arches}
|
||||
Requires: gcc-go
|
||||
Provides: compiler(gcc-go)
|
||||
Provides: compiler(go-compiler) = 1
|
||||
Obsoletes: go-compilers-gcc-go-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: redhat-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: LicenseRef-Fedora-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
|
||||
# go-rpm-macros only exists on some architectures, so this package cannot be noarch
|
||||
Requires: go-rpm-macros = %{version}-%{release}
|
||||
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
#Requires: redhat-rpm-templates
|
||||
|
||||
%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
|
||||
%autosetup -p1 %{forgesetupargs} -a1
|
||||
%writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_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
|
||||
|
||||
# unpack golist and vendor deps
|
||||
%if 0%{?bundle_golist}
|
||||
tar -C %{golist_builddir} -xf %{SOURCE2}
|
||||
cp %{golist_builddir}/LICENSE LICENSE-golist
|
||||
%endif
|
||||
|
||||
%build
|
||||
# build golist
|
||||
%if 0%{?bundle_golist}
|
||||
pushd %{golist_builddir}
|
||||
for cmd in cmd/* ; do
|
||||
%gobuild -o bin/$(basename $cmd) ./$cmd
|
||||
done
|
||||
popd
|
||||
%endif
|
||||
|
||||
%install
|
||||
install -m 0755 -vd %{buildroot}%{rpmmacrodir}
|
||||
|
||||
install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/srpm
|
||||
install -m 0644 -vp rpm/lua/srpm/*lua \
|
||||
%{buildroot}%{_rpmluadir}/fedora/srpm
|
||||
|
||||
%ifarch %{golang_arches} %{gccgo_arches}
|
||||
# Some of those probably do not work with gcc-go right now
|
||||
# This is not intentional, but mips is not a primary Fedora architecture
|
||||
# Patches and PRs are welcome
|
||||
|
||||
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 0644 -vp rpm/macros.d/macros.go-*rpm* \
|
||||
%{buildroot}%{rpmmacrodir}
|
||||
install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/rpm
|
||||
install -m 0644 -vp rpm/lua/rpm/*lua \
|
||||
%{buildroot}%{_rpmluadir}/fedora/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}/
|
||||
%else
|
||||
install -m 0644 -vp rpm/macros.d/macros.go-srpm \
|
||||
%{buildroot}%{rpmmacrodir}
|
||||
%endif
|
||||
|
||||
%ifarch %{golang_arches}
|
||||
install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang{,-pie} \
|
||||
%{buildroot}%{_rpmconfigdir}/macros.d/
|
||||
%endif
|
||||
|
||||
%ifarch %{gccgo_arches}
|
||||
install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
|
||||
%{buildroot}%{_rpmconfigdir}/macros.d/
|
||||
%endif
|
||||
|
||||
# install golist
|
||||
%if 0%{?bundle_golist}
|
||||
install -m 0755 -vd %{buildroot}%{golist_execdir}
|
||||
install -m 0755 -vp %{golist_builddir}/bin/* %{buildroot}%{golist_execdir}/
|
||||
sed -i "s,golist ,%{golist_execdir}/golist ,g" \
|
||||
%{buildroot}%{_bindir}/go-rpm-integration \
|
||||
%{buildroot}%{_rpmconfigdir}/gosymlink.deps \
|
||||
%{buildroot}%{_rpmmacrodir}/macros.go-rpm
|
||||
%endif
|
||||
|
||||
%ifarch %{golang_arches} %{gccgo_arches}
|
||||
%files
|
||||
%license LICENSE.txt
|
||||
%if %{defined bundle_golist}
|
||||
%license LICENSE-golist %{golist_builddir}/vendor/modules.txt
|
||||
%endif
|
||||
%doc README.md
|
||||
%{_bindir}/*
|
||||
%{_rpmconfigdir}/fileattrs/*.attr
|
||||
%{_rpmconfigdir}/*.prov
|
||||
%{_rpmconfigdir}/*.deps
|
||||
%{_rpmmacrodir}/macros.go-rpm*
|
||||
%{_rpmmacrodir}/macros.go-compiler*
|
||||
%{_rpmluadir}/fedora/rpm/*.lua
|
||||
# package golist
|
||||
%if 0%{?bundle_golist}
|
||||
%{golist_execdir}/golist
|
||||
%endif
|
||||
|
||||
|
||||
%files -n go-rpm-templates
|
||||
%license LICENSE-templates.txt
|
||||
%doc README.md
|
||||
# https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
|
||||
%dir %{dirname:%{_spectemplatedir}}
|
||||
%dir %{_spectemplatedir}
|
||||
%{_spectemplatedir}/*.spec
|
||||
|
||||
%files -n go-filesystem
|
||||
%dir %{gopath}
|
||||
%dir %{gopath}/src
|
||||
%endif
|
||||
|
||||
# we only build go-srpm-macros on all architectures
|
||||
%files -n go-srpm-macros
|
||||
%license LICENSE.txt
|
||||
%doc README.md
|
||||
%{_rpmmacrodir}/macros.go-srpm
|
||||
%{_rpmluadir}/fedora/srpm/*.lua
|
||||
|
||||
%changelog
|
||||
* Tue Sep 02 2024 Eduard Abdullin <eabdullin@almalinux.org> - 3.6.0-1.alma.1
|
||||
- Add x86_64_v2 to arch list
|
||||
|
||||
* Wed Jul 24 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-1
|
||||
- Update to 3.6.0
|
||||
|
||||
* Wed Jun 26 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-5
|
||||
- Add rpminspect.yaml
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.3.0-4
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu May 23 2024 Alejandro Sáez <asm@redhat.com> - 3.3.0-3
|
||||
- Remove explicit dependency of forge-srpm-macros
|
||||
|
||||
* Fri May 03 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-2
|
||||
- gating.yaml: Add gating config for rhel-10
|
||||
|
||||
* Sun Oct 29 2023 Robert-André Mauchin <zebob.m@gmail.com> - 3.3.0-1
|
||||
- Update to 3.3.0
|
||||
|
||||
* Sun Oct 29 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-9
|
||||
- Update golist to 0.10.4
|
||||
|
||||
* Thu Sep 07 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-8
|
||||
- Add explicit dependency on forge-srpm-macros
|
||||
|
||||
* Thu Jun 22 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-7
|
||||
- Simplify golist tarball unpacking
|
||||
|
||||
* Tue Jun 20 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-6
|
||||
- Bundle golist in RHEL builds
|
||||
|
||||
* Mon Apr 24 2023 Edjunior Machado <emachado@redhat.com> - 3.2.0-4
|
||||
- tests: Fix fmf plan deprecated attributes
|
||||
|
||||
* Sun Apr 16 2023 Nianqing Yao <imbearchild@outlook.com> - 3.2.0-3
|
||||
- Add riscv64 to %golang_arches
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Sep 02 2022 Maxwell G <gotmax@e.email> - 3.2.0-1
|
||||
- Update to 3.2.0.
|
||||
|
||||
* Fri Sep 02 2022 Maxwell G <gotmax@e.email> - 3.1.0-5
|
||||
- Use %{_rpmmacrodir} macro
|
||||
|
||||
* Tue Aug 09 2022 Maxwell G <gotmax@e.email> - 3.1.0-4
|
||||
- Use correct SPDX identifier for Public Domain
|
||||
|
||||
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-3
|
||||
- Convert top level license to SPDX.
|
||||
|
||||
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-2
|
||||
- Stop installing duplicate go-compilers macros
|
||||
|
||||
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-1
|
||||
- Update to 3.1.0.
|
||||
|
||||
* Fri Jul 29 2022 Maxwell G <gotmax@e.email> - 3.0.15-4
|
||||
- Add %%golang_arches_future macro
|
5
plans/ci.fmf
Normal file
5
plans/ci.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
5
rpminspect.yaml
Normal file
5
rpminspect.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
debuginfo:
|
||||
ignore:
|
||||
# go-rpm-macros golist contains debugging symbols (RHEL-38521)
|
||||
- /usr/libexec/go-rpm-macros/golist
|
3
sources
Normal file
3
sources
Normal file
@ -0,0 +1,3 @@
|
||||
SHA512 (go-rpm-macros-3.6.0.tar.gz) = 904406180a1bedb70dd0bacc3794dee7f1ff8e4329230750ef903338f22c2beb995e23f1d647191a4e094860b31933ae7b3acfa35d6ca67aed8c591bdd45c3bb
|
||||
SHA512 (golist-0.10.4.tar.gz) = 81fc9cdc4cb0fa1b78ade56c60cb2ac0070dcb11130a333e61053a266e2312b03e64a6705415d6d20883ae4f8cd0be57722c93835c3efffdfaeb9330f4cc12ea
|
||||
SHA512 (golist-0.10.4-vendor.tar.xz) = 53efe2d344d5eeb7954dd7c18a1142c67c1e7009b4d34b503372e010a6380a2218bceccff4925b513c8a80a3c3de8290c244d338f1da00c438d00f9affd8b363
|
2
tests/README
Normal file
2
tests/README
Normal file
@ -0,0 +1,2 @@
|
||||
The test's Makefiles are not used in Fedora CI infrastructure. But are kept here
|
||||
for backward compatibility with traditional beakerlib test harness in RHEL.
|
66
tests/Sanity/gobuild-grafana/Makefile
Normal file
66
tests/Sanity/gobuild-grafana/Makefile
Normal file
@ -0,0 +1,66 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/go-rpm-macros/Sanity/gobuild-grafana
|
||||
# Description: golang rpm macros usage building grafana
|
||||
# Author: Jan Kuřík <jkurik@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2021 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/go-rpm-macros/Sanity/gobuild-grafana
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Jan Kuřík <jkurik@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: golang rpm macros usage building" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 2h" >> $(METADATA)
|
||||
@echo "RunFor: golang" >> $(METADATA)
|
||||
@echo "Requires: golang" >> $(METADATA)
|
||||
@echo "Requires: go-rpm-macros go-srpm-macros" >> $(METADATA)
|
||||
@echo "Requires: /usr/bin/yumdownloader /usr/bin/yum-builddep" >> $(METADATA)
|
||||
@echo "Requires: /usr/bin/rpmbuild" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2+" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Releases: Fedora" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
3
tests/Sanity/gobuild-grafana/PURPOSE
Normal file
3
tests/Sanity/gobuild-grafana/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
||||
PURPOSE of /tools/go-rpm-macros/Sanity/gobuild-grafana
|
||||
Description: golang rpm macros usage building grafana
|
||||
Author: Jan Kuřík <jkurik@redhat.com>
|
17
tests/Sanity/gobuild-grafana/main.fmf
Normal file
17
tests/Sanity/gobuild-grafana/main.fmf
Normal file
@ -0,0 +1,17 @@
|
||||
summary: golang rpm macros usage building
|
||||
description: ''
|
||||
contact: Jan Kuřík <jkurik@redhat.com>
|
||||
component:
|
||||
- golang
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- golang
|
||||
- go-rpm-macros
|
||||
- go-srpm-macros
|
||||
- /usr/bin/yumdownloader
|
||||
- /usr/bin/yum-builddep
|
||||
- /usr/bin/rpmbuild
|
||||
duration: 2h
|
||||
extra-summary: /tools/go-rpm-macros/Sanity/gobuild-grafana
|
||||
extra-task: /tools/go-rpm-macros/Sanity/gobuild-grafana
|
75
tests/Sanity/gobuild-grafana/runtest.sh
Executable file
75
tests/Sanity/gobuild-grafana/runtest.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/go-rpm-macros/Sanity/gobuild-grafana
|
||||
# Description: golang rpm macros usage building grafana
|
||||
# Author: Jan Kuřík <jkurik@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2021 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="go-rpm-macros"
|
||||
|
||||
GO_PACKAGE="$(rpm -qf $(which go))"
|
||||
|
||||
# Conserve the non-zero return value through the pipe
|
||||
set -o pipefail
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "TmpDir=\$(mktemp -d /var/tmp/XXXXXXX)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "check macros"
|
||||
rlRun "gobuild_string=\"$(rpm -E '%gobuild')\"" 127
|
||||
rlRun "gotest_string=\"$(rpm -E '%gotest')\"" 127
|
||||
rlAssertNotEquals "Checking if %gobuild macro is defined" "$gobuild_string" "%gobuild"
|
||||
rlAssertNotEquals "Checking if %gotest macro is defined" "$gotest_string" "%gotest"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStart FAIL "setup grafana sources"
|
||||
rlRun "SRPM=\$(basename \$(yumdownloader --source --url grafana | tail -n 1))"
|
||||
rlRun "yumdownloader --source grafana"
|
||||
rlRun "yum-builddep --enablerepo=\* -y --srpm ${SRPM}"
|
||||
rlRun "rpm -i -D '_topdir $TmpDir' ${SRPM}"
|
||||
rlRun "sed -i 's/^\s*%define\s*compile_frontend\s.*/%define compile_frontend 0/g' \
|
||||
SPECS/grafana.spec" 0 "Make sure we build only the golang part, no JS stuff"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "rpmbuild grafana"
|
||||
rlRun "rpmbuild --showrc &> ${TmpDir}/rpm.rc"
|
||||
rlFileSubmit "${TmpDir}/rpm.rc"
|
||||
rlAssertGrep "%gobuild" SPECS/grafana.spec -w
|
||||
rlAssertGrep "%gotest" SPECS/grafana.spec -w
|
||||
rlRun "rpmbuild -bc --define='_topdir $TmpDir' SPECS/grafana.spec \
|
||||
|& tee grafana.rpmbuild.log"
|
||||
rlFileSubmit "grafana.rpmbuild.log"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user