From 288f312fa5b99ca925533000c2b3856007d8f2ed Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 30 Sep 2024 15:35:40 +0000 Subject: [PATCH] import CS go-rpm-macros-3.6.0-3.el9 --- .gitignore | 4 +- .go-rpm-macros.metadata | 4 +- ...Add-libexec-to-path-for-EPEL9-golist.patch | 52 +++++++++++++++ SOURCES/add-gobuild-and-gotest.patch | 2 +- SOURCES/remove-isdefined-function.patch | 27 ++++++++ SOURCES/update-default-gobuild-args.patch | 64 ------------------- SPECS/go-rpm-macros.spec | 33 +++++++--- 7 files changed, 109 insertions(+), 77 deletions(-) create mode 100644 SOURCES/0001-Add-libexec-to-path-for-EPEL9-golist.patch create mode 100644 SOURCES/remove-isdefined-function.patch delete mode 100644 SOURCES/update-default-gobuild-args.patch diff --git a/.gitignore b/.gitignore index dc417fc..14f2922 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/go-rpm-macros-3.2.0.tar.gz -SOURCES/golist-0.10.1.tar.gz +SOURCES/go-rpm-macros-3.6.0.tar.gz +SOURCES/golist-0.10.4.tar.gz diff --git a/.go-rpm-macros.metadata b/.go-rpm-macros.metadata index 36416a0..f64db2c 100644 --- a/.go-rpm-macros.metadata +++ b/.go-rpm-macros.metadata @@ -1,2 +1,2 @@ -0d0704c603edceb886cb94c588ed61179a5760e6 SOURCES/go-rpm-macros-3.2.0.tar.gz -bf428b2ba15f68df39e3da7647ccfdeb8beedd3b SOURCES/golist-0.10.1.tar.gz +9db262bd1b5acd1c3490d55b839819a878e6659c SOURCES/go-rpm-macros-3.6.0.tar.gz +4a105131658d029fe0b2d312b078a056748af2b4 SOURCES/golist-0.10.4.tar.gz diff --git a/SOURCES/0001-Add-libexec-to-path-for-EPEL9-golist.patch b/SOURCES/0001-Add-libexec-to-path-for-EPEL9-golist.patch new file mode 100644 index 0000000..6e0d7f9 --- /dev/null +++ b/SOURCES/0001-Add-libexec-to-path-for-EPEL9-golist.patch @@ -0,0 +1,52 @@ +From 948c86d17904abf5d9d9c42c55ab78f6b970b972 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= +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 [ [-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 [ [-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 + diff --git a/SOURCES/add-gobuild-and-gotest.patch b/SOURCES/add-gobuild-and-gotest.patch index 77c06b4..81c3fda 100644 --- a/SOURCES/add-gobuild-and-gotest.patch +++ b/SOURCES/add-gobuild-and-gotest.patch @@ -25,7 +25,7 @@ index a46f81f..05cd6c9 100644 +# 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 ' -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 +%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**}; diff --git a/SOURCES/remove-isdefined-function.patch b/SOURCES/remove-isdefined-function.patch new file mode 100644 index 0000000..b0dd80d --- /dev/null +++ b/SOURCES/remove-isdefined-function.patch @@ -0,0 +1,27 @@ +From 75a528c97a3960e993d378ab3bedd37be3620975 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= +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 + diff --git a/SOURCES/update-default-gobuild-args.patch b/SOURCES/update-default-gobuild-args.patch deleted file mode 100644 index 9c5ec1c..0000000 --- a/SOURCES/update-default-gobuild-args.patch +++ /dev/null @@ -1,64 +0,0 @@ -From c05378a9d5d7ceb0fef2a915df9b88750685a3a9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= -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 - diff --git a/SPECS/go-rpm-macros.spec b/SPECS/go-rpm-macros.spec index a4f5bce..f9f2147 100644 --- a/SPECS/go-rpm-macros.spec +++ b/SPECS/go-rpm-macros.spec @@ -1,5 +1,5 @@ %global forgeurl https://pagure.io/go-rpm-macros -Version: 3.2.0 +Version: 3.6.0 %forgemeta #https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 @@ -24,7 +24,7 @@ Version: 3.2.0 %if 0%{?bundle_golist} # do not create debuginfo packages when we add a build section %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_goipath pagure.io/golist # where to bundle the golist executable @@ -69,11 +69,12 @@ Provides: compiler(go-compiler) = 1 Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release} %endif -Patch0: update-default-gobuild-args.patch # 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. @@ -81,7 +82,10 @@ Patch1: golist-bootstrap-cli-no-vendor.patch # This also sets the GOAMD64 variable to v2 # Resolves: rhbz#1965292 # Resolves: RHEL-5529 -Patch2: add-gobuild-and-gotest.patch +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 @@ -127,8 +131,6 @@ macros provided by go-rpm-macros to create Go packages. %prep %forgesetup -%patch0 -p1 - %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") @@ -138,6 +140,8 @@ 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} @@ -157,7 +161,8 @@ if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then fi %endif -%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build # build golist @@ -216,7 +221,6 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \ %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 %endif %files @@ -253,6 +257,19 @@ sed -i "s,golist,%{golist_execdir}/golist,g" %{buildroot}%{_bindir}/go-rpm-integ %{_spectemplatedir}/*.spec %changelog +* Wed Jul 31 2024 Alejandro Sáez - 3.6.0-3 +- Fix typo in add-gobuild-and-gotest.patch +- Resolves: RHEL-7437 + +* Wed Jul 31 2024 Alejandro Sáez - 3.6.0-2 +- Remove rpm.isdefined function +- Resolves: RHEL-51368 + +* Mon Jul 29 2024 Alejandro Sáez - 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 - 3.2.0-3 - Update add-gobuild-and-gotest.patch to add GOPPC64 and GOAMD64 - Resolves: RHEL-5529