diff --git a/go-rpm-macros.spec b/go-rpm-macros.spec index 6c68c609b69c964fbed01a85eb0d80f1e9e4918e..265b2167db8aed9c4dddef61e64ed3019ec37ebd 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,18 @@ 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/golist/archive/v0.10.4/golist-0.10.4.tar.gz +Source1: https://pagure.io/go-rpm-macros/archive/3.6.0/go-rpm-macros-3.6.0.tar.gz +Source2: golist-0.10.4-vendor.tar.xz Patch1: 1001-modify-for-anolis.patch +Patch2: remove-isdefined-function.patch Requires: go-srpm-macros = %{version}-%{release} go-filesystem = %{version}-%{release} %if %{with golist} @@ -133,6 +137,8 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ %doc README.md %changelog +* Thu Aug 28 2025 Wenyuzifang - 3.6.0-4 +- Apply to ensure compatibility with older RPM versions and prevent build failures on RHEL 9.5. * Thu Aug 14 2025 Yang Cheng - 3.6.0-3 - add support for sw_64 build diff --git a/golist-0.10.4-vendor.tar.xz b/golist-0.10.4-vendor.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..3bbcee2b053254ca6cc6c96a3f3c2cd7e3483f23 Binary files /dev/null and b/golist-0.10.4-vendor.tar.xz differ diff --git a/golist-0.10.4.tar.gz b/golist-0.10.4.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a1ed64baeb0c4c838ced18459f4d44baa30943ad Binary files /dev/null and b/golist-0.10.4.tar.gz differ diff --git a/remove-isdefined-function.patch b/remove-isdefined-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0dd80d8bafd8932fbf12e54787d010363f7c1e9 --- /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 +