From 7277f397c21d73a1586fc9655d1641f42f7956e3 Mon Sep 17 00:00:00 2001 From: wenyuzifang Date: Thu, 25 Sep 2025 14:18:17 +0800 Subject: [PATCH] Update code from upstream --- ...Add-libexec-to-path-for-EPEL9-golist.patch | 52 +++++++++++++++++++ go-rpm-macros.spec | 14 +++-- remove-isdefined-function.patch | 27 ++++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 0001-Add-libexec-to-path-for-EPEL9-golist.patch create mode 100644 remove-isdefined-function.patch diff --git a/0001-Add-libexec-to-path-for-EPEL9-golist.patch b/0001-Add-libexec-to-path-for-EPEL9-golist.patch new file mode 100644 index 0000000..6e0d7f9 --- /dev/null +++ b/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/go-rpm-macros.spec b/go-rpm-macros.spec index 6c68c60..31a7874 100644 --- a/go-rpm-macros.spec +++ b/go-rpm-macros.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 %bcond_with golist %global golang_arches x86_64 aarch64 loongarch64 riscv64 sw_64 @@ -9,14 +9,19 @@ ExclusiveArch: %{golang_arches} Name: go-rpm-macros -Version: 3.6.0 +BuildRequires: golang +Version: 3.6.0 Release: %{anolis_release}%{?dist} Summary: Build-stage rpm automation for Go packages License: GPLv3+ URL: https://pagure.io/%{name} -Source: https://pagure.io/%{name}/archive/%{version}/%{name}-%{version}.tar.gz +Source0: https://pagure.io/go-rpm-macros/archive/3.6.0/go-rpm-macros-3.6.0.tar.gz +Source1: https://pagure.io/golist/archive/v0.10.4/golist-0.10.4.tar.gz +Source2: golist-0.10.4-vendor.tar.xz Patch1: 1001-modify-for-anolis.patch +Patch2: 0001-Add-libexec-to-path-for-EPEL9-golist.patch +Patch3: remove-isdefined-function.patch Requires: go-srpm-macros = %{version}-%{release} go-filesystem = %{version}-%{release} %if %{with golist} @@ -133,6 +138,9 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ %doc README.md %changelog +* Thu Sep 25 2025 wenyuzifang - 3.6.0-4 +- Ensure build tools are accessible in EPEL9 by adding libexec path to environment. +- Ensure compatibility with older RPM versions by replacing unavailable isdefined function with a working alternative. * Thu Aug 14 2025 Yang Cheng - 3.6.0-3 - add support for sw_64 build diff --git a/remove-isdefined-function.patch b/remove-isdefined-function.patch new file mode 100644 index 0000000..b0dd80d --- /dev/null +++ b/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 + -- Gitee