From d0e1fba51fde3a6be27b6b52237bea4a30fc106d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= Date: Wed, 31 Jul 2024 10:01:35 +0200 Subject: [PATCH] Remove rpm.isdefined function rpm.isdefined is in rpm >= 4.17.0 but RHEL 9.5 is a little bit behind that version so if fails. Resolves: RHEL-51368 --- go-rpm-macros.spec | 4 ++++ remove-isdefined-function.patch | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 remove-isdefined-function.patch diff --git a/go-rpm-macros.spec b/go-rpm-macros.spec index 68376c1..622a205 100644 --- a/go-rpm-macros.spec +++ b/go-rpm-macros.spec @@ -84,6 +84,9 @@ Patch2: 0001-Add-libexec-to-path-for-EPEL9-golist.patch # 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. @@ -159,6 +162,7 @@ fi %endif %patch3 -p1 +%patch4 -p1 %build # build golist 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 +