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
This commit is contained in:
Alejandro Sáez 2024-07-31 10:01:35 +02:00
parent 4b104bc0a3
commit d0e1fba51f
2 changed files with 31 additions and 0 deletions

View File

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

View File

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