Restore compatibility with RPM 4.16
I have made the decision to restore compatibility with EL 9 and pause efforts in https://todo.sr.ht/~gotmax23/forge-srpm-macros/3 to continue adopting new RPM 4.17+ features. Packagers have requested the ability to use %forgeversion on EL 9, and we need to support it for tools like Packit and Zuul CI that build SRPMs in CentOS Stream containers to be able to adopt it. Relates: https://todo.sr.ht/~gotmax23/forge-srpm-macros/3
This commit is contained in:
parent
48679d415e
commit
a5539f0b7f
5 changed files with 22 additions and 24 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# NOTICE: This file is generated from ci.yml.in. Do not edit!
|
||||
|
||||
image: fedora/37
|
||||
image: rockylinux/9
|
||||
packages:
|
||||
- python3-pytest
|
||||
- python3-pyyaml
|
||||
|
|
@ -28,13 +28,8 @@ This code has been split out from redhat-rpm-config to ease maintenance.
|
|||
|
||||
## Compatibility
|
||||
|
||||
Fedora 37 / RPM 4.18 and above are tested in CI.
|
||||
|
||||
These macros do not yet use any RPM 4.18+ features,
|
||||
but [there are plans][4.17] to adopt newer RPM features that are not available
|
||||
on older distributions like EL 9.
|
||||
|
||||
[4.17]: https://todo.sr.ht/~gotmax23/forge-srpm-macros/3
|
||||
The minimum supported RPM version is 4.16. The macros are tested in CI on
|
||||
Fedora 38+ and EL 9.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
|||
2
cigen.sh
2
cigen.sh
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
for i in fedora/37 fedora/38 fedora/39; do
|
||||
for i in rockylinux/9 fedora/38 fedora/39; do
|
||||
file=".builds/$(echo $i | cut -d/ -f2).yml"
|
||||
sed "s|@@IMAGE@@|$i|" ci.yml.in >$file
|
||||
done
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ end
|
|||
-- Also called directly by gometa
|
||||
local function meta(suffix, verbose, informative, silent)
|
||||
local fedora = require "fedora.common"
|
||||
local util = require "fedora.srpm._forge_util"
|
||||
local ismain = (suffix == "") or (suffix == "0")
|
||||
if ismain then
|
||||
fedora.zalias({"forgeurl", "forgesource", "forgesetupargs",
|
||||
|
|
@ -210,7 +211,7 @@ local function meta(suffix, verbose, informative, silent)
|
|||
forgeurl = expliciturl
|
||||
end
|
||||
local forge
|
||||
forgeurl, forge = idforge(forgeurl, silent, macros["forgename" .. suffix])
|
||||
forgeurl, forge = idforge(forgeurl, silent, util.get_macro("forgename" .. suffix))
|
||||
if (forge ~= nil) then
|
||||
fedora.explicitset("forgeurl" .. suffix, forgeurl, verbose)
|
||||
fedora.explicitset("forgename" .. suffix, forge, verbose)
|
||||
|
|
|
|||
|
|
@ -98,53 +98,55 @@ print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm
|
|||
# Version: %{forgeversion}
|
||||
|
||||
%forgeversion(pz:ab:) %{lua:
|
||||
-- Zero-alias version/version0 macros
|
||||
local fedora = require "fedora.common"
|
||||
local util = require "fedora.srpm._forge_util"
|
||||
\
|
||||
-- Zero-alias version/version0 macros
|
||||
fedora.zalias({"version", "distprefix", "_forgeversionsuffix"}, nil)
|
||||
|
||||
\
|
||||
-- Determine the seperator
|
||||
local sep = "^"
|
||||
if opt.p then
|
||||
if util.get_flag("p") then
|
||||
sep = "~"
|
||||
end
|
||||
|
||||
\
|
||||
-- Release uses %dist and %distprefix, so we need to make sure it's not used before
|
||||
if macros.release then
|
||||
if util.is_defined("release") then
|
||||
rpm.expand(
|
||||
"%{error:'Version: %%forgeversion' must be invoked before setting Release.}"
|
||||
)
|
||||
end
|
||||
|
||||
\
|
||||
-- Determine baseversion
|
||||
local baseversion = opt.b or macros.version0
|
||||
local baseversion = util.get_flag("b", true) or util.get_macro("version0")
|
||||
if not baseversion then
|
||||
rpm.expand(
|
||||
"%{error:You must define %%version0" ..
|
||||
" (%%global version0 <VERSION>) prior to invoking this macro.}"
|
||||
)
|
||||
end
|
||||
|
||||
\
|
||||
-- Concatenate parts. Clear out %distprefix* to avoid duplicating data in Release.
|
||||
-- forgemeta stores the same values in _forgeversionsuffix so we can run
|
||||
-- forgeversion multiple times.
|
||||
local part = ""
|
||||
rpm.undefine("distprefix")
|
||||
if opt.a then
|
||||
if util.get_flag("a") then
|
||||
for i=0,9999 do
|
||||
local curpart = macros["_forgeversionsuffix" .. i]
|
||||
local curpart = util.get_macro("_forgeversionsuffix" .. i)
|
||||
if curpart then
|
||||
part = part .. curpart
|
||||
end
|
||||
rpm.undefine("distprefix" .. i)
|
||||
end
|
||||
else
|
||||
local i = opt.z or ""
|
||||
part = part .. (macros["_forgeversionsuffix" .. i] or "")
|
||||
local i = util.get_flag("z", true) or ""
|
||||
part = part .. (util.get_macro("_forgeversionsuffix" .. i) or "")
|
||||
end
|
||||
|
||||
\
|
||||
-- Strip any leading '.'
|
||||
part = part:gsub("^%.", "")
|
||||
|
||||
\
|
||||
-- Print final version
|
||||
if part ~= "" then
|
||||
print(baseversion .. sep .. part)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue