Add option -a to include BuilArch: noarch
Option -A disables that (the default, does nothing at the moment) Co-Authored-By: Miro Hrončok <miro@hroncok.cz> (cherry picked from commit 840a26c515db6b45fda5bce35422db3a7c2f09d5) The release was deliberately set to 8.1 rather than 9, as we don't want to beat Fedora 40 to it.
This commit is contained in:
parent
9409f311fd
commit
cb461e77de
@ -225,15 +225,19 @@
|
||||
end
|
||||
}
|
||||
|
||||
%python_extras_subpkg(n:i:f:F) %{expand:%{lua:
|
||||
%python_extras_subpkg(n:i:f:FaA) %{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)'
|
||||
local option_F = '-F (skip %%files section)'
|
||||
local option_a = '-a (insert BuildArch: noarch)'
|
||||
local option_A = '-A (do not insert BuildArch: noarch (default))'
|
||||
local value_n = rpm.expand('%{-n*}')
|
||||
local value_i = rpm.expand('%{-i*}')
|
||||
local value_f = rpm.expand('%{-f*}')
|
||||
local value_F = rpm.expand('%{-F}')
|
||||
local value_a = rpm.expand('%{-a}')
|
||||
local value_A = rpm.expand('%{-A}')
|
||||
local args = rpm.expand('%{*}')
|
||||
if value_n == '' then
|
||||
rpm.expand('%{error:%%%0: missing option ' .. option_n .. '}')
|
||||
@ -250,6 +254,9 @@
|
||||
if value_f ~= '' and value_F ~= '' then
|
||||
rpm.expand('%{error:%%%0: simultaneous ' .. option_f .. ' and ' .. option_F .. ' options are not possible}')
|
||||
end
|
||||
if value_a ~= '' and value_A ~= '' then
|
||||
rpm.expand('%{error:%%%0: simultaneous ' .. option_a .. ' and ' .. option_A .. ' options are not possible}')
|
||||
end
|
||||
if args == '' then
|
||||
rpm.expand('%{error:%%%0 requires at least one argument with "extras" name}')
|
||||
end
|
||||
@ -277,7 +284,11 @@
|
||||
elseif value_f ~= '' then
|
||||
files = '%files -n ' .. rpmname .. ' -f ' .. value_f
|
||||
end
|
||||
for i, line in ipairs({pkgdef, summary, requires, description, files, ''}) do
|
||||
local tags = summary .. '\\\n' .. requires
|
||||
if value_a ~= '' then
|
||||
tags = tags .. '\\\nBuildArch: noarch'
|
||||
end
|
||||
for i, line in ipairs({pkgdef, tags, description, files, ''}) do
|
||||
print(line .. '\\\n')
|
||||
end
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ elseif posix.stat('macros.python-srpm') then
|
||||
end
|
||||
}
|
||||
Version: %{__default_python3_version}
|
||||
Release: 8%{?dist}
|
||||
Release: 8.1%{?dist}
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -163,7 +163,10 @@ grep -E '^#[^%%]*%%[^%%]' %{buildroot}%{rpmmacrodir}/macros.* && exit 1 || true
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com>
|
||||
* Tue Jun 25 2024 Cristian Le <fedora@lecris.me> - 3.12-8.1
|
||||
- %%python_extras_subpkg: Add option -a to include BuildArch: noarch
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.12-8
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu Jan 25 2024 Miro Hrončok <mhroncok@redhat.com> - 3.12-7
|
||||
|
@ -619,6 +619,45 @@ def test_python_extras_subpkg_F():
|
||||
assert lines == expected
|
||||
|
||||
|
||||
def test_python_extras_subpkg_a():
|
||||
lines = rpm_eval('%python_extras_subpkg -n python3-setuptools_scm -a -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 = 6-7
|
||||
BuildArch: noarch
|
||||
%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_A():
|
||||
lines = rpm_eval('%python_extras_subpkg -n python3-setuptools_scm -A -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 = 6-7
|
||||
%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_aA():
|
||||
lines = rpm_eval('%python_extras_subpkg -n python3-setuptools_scm -a -A -F toml',
|
||||
version='6', release='7', fails=True)
|
||||
assert lines[0] == ('error: %python_extras_subpkg: simultaneous -a '
|
||||
'(insert BuildArch: noarch) and -A (do not insert '
|
||||
'BuildArch: noarch (default)) options are not possible')
|
||||
|
||||
|
||||
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