Compare commits

..

2 Commits
c10 ... c9-beta

Author SHA1 Message Date
AlmaLinux RelEng Bot
ffa65e2103 import CS go-rpm-macros-3.8.1-1.el9 2026-03-30 10:30:21 -04:00
ccee62712b import CS go-rpm-macros-3.6.0-11.el9 2025-09-15 12:02:05 +00:00
7 changed files with 235 additions and 136 deletions

6
.gitignore vendored
View File

@ -1,3 +1,3 @@
go-rpm-macros-3.8.0.tar.bz2
golist-0.10.4-vendor.tar.xz
golist-0.10.4.tar.gz
SOURCES/go-rpm-macros-3.8.1.tar.bz2
SOURCES/golist-0.10.4-vendor.tar.xz
SOURCES/golist-0.10.4.tar.gz

3
.go-rpm-macros.metadata Normal file
View File

@ -0,0 +1,3 @@
5b4090f510c9aad55f858c58b6b42870f048e4db SOURCES/go-rpm-macros-3.8.1.tar.bz2
bd3d0d5f4f5f00be280ac571e734022af4d9d80b SOURCES/golist-0.10.4-vendor.tar.xz
4a105131658d029fe0b2d312b078a056748af2b4 SOURCES/golist-0.10.4.tar.gz

View File

@ -0,0 +1,52 @@
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

View File

@ -0,0 +1,34 @@
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

View File

@ -0,0 +1,27 @@
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

View File

@ -1,42 +1,23 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 1;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%global forgeurl https://gitlab.com/fedora/sigs/go/go-rpm-macros
Version: 3.8.0
%forgemeta
Version: 3.8.1
#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 riscv64
%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
%if 0%{?rhel} >= 10
%global golang_arches x86_64 aarch64 ppc64le s390x riscv64
%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}
@ -52,19 +33,23 @@ Version: 3.8.0
%global debug_package %{nil}
%endif
ExclusiveArch: %{golang_arches} %{gccgo_arches}
Name: go-rpm-macros
Release: %autorelease
Release: 1%{?dist}
Summary: Build-stage rpm automation for Go packages
License: GPL-3.0-or-later
License: GPLv3+
URL: %{forgeurl}
Source: %{forgesource}
Source0: %{forgeurl}/-/archive/%{version}/go-rpm-macros-%{version}.tar.bz2
%if 0%{?bundle_golist}
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
%endif
Requires: go-srpm-macros = %{version}-%{release}
Requires: go-filesystem = %{version}-%{release}
@ -90,6 +75,20 @@ Provides: compiler(go-compiler) = 1
Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release}
%endif
# 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.
@ -114,7 +113,7 @@ 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
License: Public Domain
%description -n go-filesystem
This package contains the basic directory layout used by Go packages.
@ -122,7 +121,7 @@ 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
BuildArch: noarch
Requires: go-rpm-macros = %{version}-%{release}
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
#Requires: redhat-rpm-templates
@ -132,7 +131,8 @@ 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
%autosetup -N
%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")
@ -140,12 +140,20 @@ for template in templates/rpm/*\.spec ; do
touch -r "${template}" "${target}"
done
# unpack golist and vendor deps
# unpack golist and patch
%if 0%{?bundle_golist}
# Add libexec to PATH
%patch -P 2 -p1
tar -xf %{SOURCE1}
tar -C %{golist_builddir} -xf %{SOURCE2}
pushd %{golist_builddir}
popd
cp %{golist_builddir}/LICENSE LICENSE-golist
%endif
%patch -P 3 -p1
%patch -P 4 -p1
%build
# build golist
%if 0%{?bundle_golist}
@ -254,123 +262,103 @@ sed -i "s,golist ,%{golist_execdir}/golist ,g" \
%{_rpmluadir}/fedora/srpm/*.lua
%changelog
## START: Generated by rpmautospec
* Fri Sep 12 2025 Alejandro Sáez <asm@redhat.com> - 3.8.0-1
- Update to 3.8.0
* Wed Oct 01 2025 Alejandro Sáez <asm@redhat.com> - 3.8.1-1
- Update to 3.8.1
- Changed the forgeurl to gitlab
- Resolves: RHEL-112845
* Thu Apr 03 2025 Edjunior Machado <emachado@redhat.com> - 3.6.0-6
- Update CI support
* Tue Apr 15 2025 Alejandro Sáez <asm@redhat.com> - 3.6.0-11
- Bump release for el9 to avoid clash with el9_6 build
- Related: RHEL-86067
- Related: RHEL-7366
* Thu Mar 13 2025 Andrea Bolognani <abologna@redhat.com> - 3.6.0-5
- Add riscv64 to golang_arches for RHEL 10+
* Fri Apr 11 2025 Alejandro Sáez <asm@redhat.com> - 3.6.0-10
- Fix malformed patch macros
- Related: RHEL-86067
- Related: RHEL-7366
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 3.6.0-4
- Bump release for October 2024 mass rebuild:
* Fri Apr 04 2025 Alejandro Sáez <asm@redhat.com> - 3.6.0-9
- Add patches back again
- Resolves: RHEL-86067
- Related: RHEL-7366
* Fri Sep 27 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-3
- Delete rpminspect.yaml
* Thu Apr 03 2025 Alejandro Sáez <asm@redhat.com> - 3.6.0-8
- Add full golist implementation
- Resolves: RHEL-7366
* Fri Sep 27 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 3.6.0-2
- Enable debuginfo
* Wed Nov 13 2024 Alejandro Sáez <asm@redhat.com>
- Revert go-rpm-templates to noarch
- Resolves: RHEL-67300
- Related: RHEL-52226
* Wed Jul 24 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-1
* Wed Nov 06 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-6
- Add back again ExclusiveArch, it was removed by mistake.
- Resolves: RHEL-52226
* Mon Nov 04 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-5
- Make golist non optional
- Resolves: RHEL-52226
* Thu Oct 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-4
- Enable debuginfo package
- Resolves: RHEL-52226
* 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
* Wed Jun 26 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-5
- Add rpminspect.yaml
* 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
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.3.0-4
- Bump release for June 2024 mass rebuild
* Fri Jul 28 2023 Alejandro Sáez <asm@redhat.com> - 3.2.0-2
- Add golang_arches_future
- Resolves: rhbz#2227224
* Thu May 23 2024 Alejandro Sáez <asm@redhat.com> - 3.3.0-3
- Remove explicit dependency of forge-srpm-macros
* 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
* Fri May 03 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-2
- gating.yaml: Add gating config for rhel-10
* 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
* Sun Oct 29 2023 Robert-André Mauchin <zebob.m@gmail.com> - 3.3.0-1
- Update to 3.3.0
* 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
* Sun Oct 29 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-9
- Update golist to 0.10.4
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Sep 07 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-8
- Add explicit dependency on forge-srpm-macros
* Tue Aug 03 2021 David Benoit <dbenoit@redhat.com> 3.0.9-7
- Escape quotation marks in gobuildflags
- Resolves: rhbz#1988717
* Thu Jun 22 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-7
- Simplify golist tarball unpacking
* Tue Jul 27 2021 David Benoit <dbenoit@redhat.com> 3.0.9-6
- Remove arch conditional on gocompilerflags
- Related: rhbz#1982298
* Tue Jun 20 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-6
- Bundle golist in RHEL builds
* 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
* 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
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jun 02 2022 Miro Hrončok <miro@hroncok.cz> - 3.0.15-2
- Drop ExclusiveArch, always build go-srpm-macros and go-filesystem
* Sun Jan 30 2022 Maxwell G <gotmax@e.email> - 3.0.15-1
- Update to 3.0.15.
* Sat Jan 29 2022 Maxwell G <gotmax@e.email> - 3.0.14-1
- Update to 3.0.14.
* Sat Jan 22 2022 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.13-4
- Fix typo
* Sat Jan 22 2022 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.13-3
- Fix typo
* Sat Jan 22 2022 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.13-2
- Fix archive upload
* Sat Jan 22 2022 Robert-André Mauchin <zebob.m@gmail.com> - 3.0.13-1
- Update to 3.0.13
* 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 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)
@ -393,5 +381,3 @@ sed -i "s,golist ,%{golist_execdir}/golist ,g" \
* 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
## END: Generated by rpmautospec

View File

@ -1,3 +0,0 @@
SHA512 (go-rpm-macros-3.8.0.tar.bz2) = 42ff55ac9018a292d2b719c61288b63fadcb5ee5b551def3b3f809cf7817d89f936936e5c4d26f7c7a48caa96bba11ce48f00e00bc3137d71c419ad03701bea1
SHA512 (golist-0.10.4-vendor.tar.xz) = 53efe2d344d5eeb7954dd7c18a1142c67c1e7009b4d34b503372e010a6380a2218bceccff4925b513c8a80a3c3de8290c244d338f1da00c438d00f9affd8b363
SHA512 (golist-0.10.4.tar.gz) = 81fc9cdc4cb0fa1b78ade56c60cb2ac0070dcb11130a333e61053a266e2312b03e64a6705415d6d20883ae4f8cd0be57722c93835c3efffdfaeb9330f4cc12ea