Compare commits

...

No commits in common. 'c9' and 'c9-beta' have entirely different histories.
c9 ... c9-beta

4
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/go-rpm-macros-3.2.0.tar.gz SOURCES/go-rpm-macros-3.6.0.tar.gz
SOURCES/golist-0.10.1.tar.gz SOURCES/golist-0.10.4.tar.gz

@ -1,2 +1,2 @@
0d0704c603edceb886cb94c588ed61179a5760e6 SOURCES/go-rpm-macros-3.2.0.tar.gz 9db262bd1b5acd1c3490d55b839819a878e6659c SOURCES/go-rpm-macros-3.6.0.tar.gz
bf428b2ba15f68df39e3da7647ccfdeb8beedd3b SOURCES/golist-0.10.1.tar.gz 4a105131658d029fe0b2d312b078a056748af2b4 SOURCES/golist-0.10.4.tar.gz

@ -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

@ -1,12 +1,14 @@
From 1001f5a99439556c5ad3efe6045923e985a52f82 Mon Sep 17 00:00:00 2001 From 1001f5a99439556c5ad3efe6045923e985a52f82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com> From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Wed, 23 Nov 2022 13:43:23 +0100 Date: Wed, 22 Sep 2023 12:00:00 +0100
Subject: [PATCH] Add %gobuild and %gotest Subject: [PATCH] Add %gobuild and %gotest
Both macros are define in rpm/macros.d/macros.go-compilers-gcc. 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. 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 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 ++++++++ rpm/macros.d/macros.go-srpm | 8 ++++++++
1 file changed, 8 insertions(+) 1 file changed, 8 insertions(+)
@ -23,7 +25,7 @@ index a46f81f..05cd6c9 100644
+# Define commands for building +# Define commands for building
+# BUILD_ID can be generated for golang build no matter of debuginfo +# BUILD_ID can be generated for golang build no matter of debuginfo
+%gobuild(o:) \ +%gobuild(o:) \
+CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie '-tags=rpm_crashtraceback libtrust_openssl ' -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\ +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 +# Define commands for testing
+%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**}; +%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};

@ -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

@ -1,64 +0,0 @@
From c05378a9d5d7ceb0fef2a915df9b88750685a3a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Thu, 24 Nov 2022 15:05:06 +0100
Subject: [PATCH] Update default gobuild args
---
rpm/macros.d/macros.go-compilers-golang | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/rpm/macros.d/macros.go-compilers-golang b/rpm/macros.d/macros.go-compilers-golang
index 74428a3..8cee8e2 100644
--- a/rpm/macros.d/macros.go-compilers-golang
+++ b/rpm/macros.d/macros.go-compilers-golang
@@ -20,6 +20,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+%gocompilerflags -buildmode pie -compiler gc
+
# This *must* be all on one line, as it will be used in shell
# assignments. eg
#
@@ -29,13 +31,16 @@
#
# %make GOBUILDFLAGS="%gobuildflags"
#
-%gobuildflags() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -compressdwarf=false -linkmode=external -extldflags '%{build_ldflags} %{?__golang_extldflags}'" -a -v -x}
+%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}
+%_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}
# Turn off Go modules
%gomodulesmode GO111MODULE=off
# Define commands for building
# BUILD_ID can be generated for golang build no matter of debuginfo
+%_gobuild_cmd CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build %{_gobuildflags_internal}
+%gobuild_compat_el8(o:) %{expand:%{_gobuild_cmd} %{?**};}
%gobuild(o:) %{expand:
# https://pagure.io/go-rpm-macros/pull-request/38
# Most of the default LDFLAGS for Fedora are not supported so we don't want
@@ -44,14 +49,16 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
%global _dwz_low_mem_die_limit 0
%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
- go build %{gobuildflags} %{?**};
+ %{_gobuild_cmd} %{?**};
}
${workroot}${GOPATH:+:${GOPATH}}
# Define commands for testing
%gotestflags %{gocompilerflags}
%gotestextldflags %{build_ldflags} %{?__golang_extldflags}
-%gotest() %{expand:
- %undefine _auto_set_build_flags
- %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};
+%_gotest_cmd %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'"
+%gotest_compat_el8(o:) %{expand:%{_gotest_cmd} %{?**};}
+%gotest(o:) %{expand:
+ %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
+ %{_gotest_cmd} %{?**};
}
--
2.38.1

@ -1,5 +1,5 @@
%global forgeurl https://pagure.io/go-rpm-macros %global forgeurl https://pagure.io/go-rpm-macros
Version: 3.2.0 Version: 3.6.0
%forgemeta %forgemeta
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 #https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
@ -24,7 +24,7 @@ Version: 3.2.0
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
# do not create debuginfo packages when we add a build section # do not create debuginfo packages when we add a build section
%global debug_package %{nil} %global debug_package %{nil}
%global golist_version 0.10.1 %global golist_version 0.10.4
%global golist_builddir %{_builddir}/golist-%{golist_version}/_build %global golist_builddir %{_builddir}/golist-%{golist_version}/_build
%global golist_goipath pagure.io/golist %global golist_goipath pagure.io/golist
# where to bundle the golist executable # where to bundle the golist executable
@ -36,7 +36,7 @@ Version: 3.2.0
ExclusiveArch: %{golang_arches} %{gccgo_arches} ExclusiveArch: %{golang_arches} %{gccgo_arches}
Name: go-rpm-macros Name: go-rpm-macros
Release: 2%{?dist} Release: 3%{?dist}
Summary: Build-stage rpm automation for Go packages Summary: Build-stage rpm automation for Go packages
License: GPLv3+ License: GPLv3+
@ -69,17 +69,23 @@ Provides: compiler(go-compiler) = 1
Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release} Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release}
%endif %endif
Patch0: update-default-gobuild-args.patch
# Replace golang-github-urfave-cli with a minimal # Replace golang-github-urfave-cli with a minimal
# command line parser backend to bootstrap golist # command line parser backend to bootstrap golist
# without dependencies. # without dependencies.
Patch1: golist-bootstrap-cli-no-vendor.patch 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. # 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. # 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. # 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: rhbz#1965292
Patch2: add-gobuild-and-gotest.patch # Resolves: RHEL-5529
Patch3: add-gobuild-and-gotest.patch
# Remove when rpm >= 4.17.0
Patch4: remove-isdefined-function.patch
%description %description
This package provides build-stage rpm automation to simplify the creation of Go This package provides build-stage rpm automation to simplify the creation of Go
@ -125,8 +131,6 @@ macros provided by go-rpm-macros to create Go packages.
%prep %prep
%forgesetup %forgesetup
%patch0 -p1
%writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_arches gopath %writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_arches gopath
for template in templates/rpm/*\.spec ; do for template in templates/rpm/*\.spec ; do
target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g") target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g")
@ -136,6 +140,8 @@ done
# unpack golist and patch # unpack golist and patch
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
# Add libexec to PATH
%patch2 -p1
pushd %{_builddir} pushd %{_builddir}
tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz
cd golist-%{golist_version} cd golist-%{golist_version}
@ -155,7 +161,8 @@ if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
fi fi
%endif %endif
%patch2 -p1 %patch3 -p1
%patch4 -p1
%build %build
# build golist # build golist
@ -214,7 +221,6 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
install -m 0755 -vd %{buildroot}%{golist_execdir} install -m 0755 -vd %{buildroot}%{golist_execdir}
install -m 0755 -vp %{golist_builddir}/bin/* %{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
%endif %endif
%files %files
@ -251,6 +257,23 @@ sed -i "s,golist,%{golist_execdir}/golist,g" %{buildroot}%{_bindir}/go-rpm-integ
%{_spectemplatedir}/*.spec %{_spectemplatedir}/*.spec
%changelog %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 * Fri Jul 28 2023 Alejandro Sáez <asm@redhat.com> - 3.2.0-2
- Add golang_arches_future - Add golang_arches_future
- Resolves: rhbz#2227224 - Resolves: rhbz#2227224

Loading…
Cancel
Save