From c2a86936e6807695ceb993c5b561f909ff2096f4 Mon Sep 17 00:00:00 2001 From: desert-sailor Date: Fri, 30 May 2025 17:37:39 +0800 Subject: [PATCH] Fix some bugs for %%python_extras_subpkg --- macros.python | 33 +++++++++++++++++++++++++++------ openEuler-rpm-config.spec | 6 +++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/macros.python b/macros.python index 7882e4e..e52751b 100644 --- a/macros.python +++ b/macros.python @@ -341,15 +341,19 @@ PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ %{__python3} -m tox -e py%{python3_version_nodots} --current-env %{?*} } -%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 .. '}') @@ -366,24 +370,41 @@ PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ 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 local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}' - for extras in args:gmatch('%w+') do + for extras in args:gmatch('[^%s,]+') do local rpmname = value_n .. '+' .. extras local pkgdef = '%package -n ' .. rpmname local summary = 'Summary: Metapackage for ' .. value_n .. ': ' .. extras .. ' extras' - local description = '%description -n ' .. rpmname .. '\\\n' .. - 'This is a metapackage bringing in ' .. extras .. ' extras requires for ' .. value_n .. '.\\\n' .. - 'It contains no code, just makes sure the dependencies are installed.\\\n' + local description = '%description -n ' .. rpmname .. '\\\n' + local current_line = 'This is a metapackage bringing in' + for _, word in ipairs({extras, 'extras', 'requires', 'for', value_n .. '.'}) do + local line = current_line .. ' ' .. word + if line:len() > 79 then + description = description .. current_line .. '\\\n' + current_line = word + else + current_line = line + end + end + description = description .. current_line .. '\\\n' .. + 'It makes sure the dependencies are installed.\\\n' local files = '' if value_i ~= '' then files = '%files -n ' .. rpmname .. '\\\n' .. '%ghost ' .. value_i 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 diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 5b4cc52..d32f6c3 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 26 +Release: 27 License: GPL+ AND MIT Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -211,6 +211,10 @@ sed -i "s|@OSCPE@|$(cat /etc/system-release-cpe)|" %{buildroot}%{rpmvdir}/%{vend %{rpmvdir}/find-requires.ksyms %changelog +* Fri May 30 2025 Dongxing Wang - 31-27 +- Fix %python_extras_subpkg with underscores in extras names + Allow commas as argument separator for extras names in %python_extras_subpkg + * Fri May 30 2025 Dongxing Wang - 31-26 - Introduce %%python_extras_subpkg -- Gitee