%python_extras_subpkg: Add -v option to specify the required version(-release)
This is useful when the extras are built from a different specfile (e.g. in EPEL for a RHEL base package). (cherry picked from Fedora commit 9e5c1461f2346d245a18e3650834d548647dff48)
This commit is contained in:
parent
9702eb2076
commit
01d780f2f8
@ -230,7 +230,7 @@
|
||||
end
|
||||
}
|
||||
|
||||
%python_extras_subpkg(n:i:f:FaA) %{expand:%{lua:
|
||||
%python_extras_subpkg(n:i:f:FaAv:) %{expand:%{lua:
|
||||
local option_n = '-n (name of the base package)'
|
||||
local option_i = '-i (buildroot path to metadata)'
|
||||
local option_f = '-f (builddir path to a filelist)'
|
||||
@ -243,6 +243,7 @@
|
||||
local value_F = rpm.expand('%{-F}')
|
||||
local value_a = rpm.expand('%{-a}')
|
||||
local value_A = rpm.expand('%{-A}')
|
||||
local value_v = rpm.expand('%{-v}')
|
||||
local args = rpm.expand('%{*}')
|
||||
if value_n == '' then
|
||||
rpm.expand('%{error:%%%0: missing option ' .. option_n .. '}')
|
||||
@ -265,7 +266,8 @@
|
||||
if args == '' then
|
||||
rpm.expand('%{error:%%%0 requires at least one argument with "extras" name}')
|
||||
end
|
||||
local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}'
|
||||
local verrel = rpm.expand('%{?-v*}%{!?-v:%{version}-%{release}}')
|
||||
local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}' .. verrel
|
||||
for extras in args:gmatch('[^%s,]+') do
|
||||
local rpmname = value_n .. '+' .. extras
|
||||
local pkgdef = '%package -n ' .. rpmname
|
||||
|
||||
@ -55,7 +55,7 @@ elseif posix.stat('macros.python-srpm') then
|
||||
end
|
||||
}
|
||||
Version: %{__default_python3_version}
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -167,6 +167,11 @@ grep -E '^#[^%%]*%%[^%%]' %{buildroot}%{rpmmacrodir}/macros.* && exit 1 || true
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Sep 09 2025 Miro Hrončok <mhroncok@redhat.com> - 3.12-11
|
||||
- %%python_extras_subpkg: Add -v option to specify the required version(-release)
|
||||
- This is useful when the extras are built from a different specfile (e.g. in EPEL for a RHEL base package)
|
||||
- Resolves: RHEL-117448
|
||||
|
||||
* Mon Apr 07 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.12-10
|
||||
- Add brp script to modify .dist-info/INSTALLER file
|
||||
- Resolves: RHEL-86802
|
||||
|
||||
@ -658,6 +658,21 @@ def test_python_extras_subpkg_aA():
|
||||
'BuildArch: noarch (default)) options are not possible')
|
||||
|
||||
|
||||
def test_python_extras_subpkg_v():
|
||||
lines = rpm_eval('%python_extras_subpkg -n python3-setuptools_scm -A -v 1.2.3 -F toml',
|
||||
version='6', release='7')
|
||||
expected = textwrap.dedent(f"""
|
||||
%package -n python3-setuptools_scm+toml
|
||||
Summary: Metapackage for python3-setuptools_scm: toml extras
|
||||
Requires: python3-setuptools_scm = 1.2.3
|
||||
%description -n python3-setuptools_scm+toml
|
||||
This is a metapackage bringing in toml extras requires for
|
||||
python3-setuptools_scm.
|
||||
It makes sure the dependencies are installed.
|
||||
""").lstrip().splitlines()
|
||||
assert lines == expected
|
||||
|
||||
|
||||
def test_python_extras_subpkg_underscores():
|
||||
lines = rpm_eval('%python_extras_subpkg -n python3-webscrapbook -F adhoc_ssl',
|
||||
version='0.33.3', release='1.fc33')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user