%python_extras_subpkg: Only %ghost the egg-info/dist-info directory, not the content
That way, accidentally unpackaged files within are reported as errors. Currently, when %python_extras_subpkg is used, the egg-info/dist-info directory is packaged as %ghost. When the main package does not have it, the RPM build would succeed. The extras packages would have the python3dist() requires and provides, but the main package would not. By adding %dir after %ghost, we only package the directory (which is enough for python3-rpm-generators to process it), but the files in the directory are not included. When not packaged in the main package, the RPM build fails. This is a safeguard against packaging mistakes. The visible difference is that rpm -ql/repoquery -l would only return the metadata directory. And the RPM build would fail if .egg-info is a file, which is only possible with Python < 3.12 for packages using distutils (no extras anyway).
This commit is contained in:
parent
9e5c1461f2
commit
0d417402db
3 changed files with 8 additions and 4 deletions
|
|
@ -287,7 +287,7 @@
|
|||
'It makes sure the dependencies are installed.\\\n'
|
||||
local files = ''
|
||||
if value_i ~= '' then
|
||||
files = '%files -n ' .. rpmname .. '\\\n' .. '%ghost ' .. value_i
|
||||
files = '%files -n ' .. rpmname .. '\\\n' .. '%ghost %dir ' .. value_i
|
||||
elseif value_f ~= '' then
|
||||
files = '%files -n ' .. rpmname .. ' -f ' .. value_f
|
||||
end
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ elseif posix.stat('macros.python-srpm') then
|
|||
end
|
||||
}
|
||||
Version: %{__default_python3_version}
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
|
@ -169,6 +169,10 @@ grep -E '^#[^%%]*%%[^%%]' %{buildroot}%{rpmmacrodir}/macros.* && exit 1 || true
|
|||
|
||||
|
||||
%changelog
|
||||
* Thu Oct 16 2025 Miro Hrončok <mhroncok@redhat.com> - 3.14-9
|
||||
- %%python_extras_subpkg: Only %%ghost the egg-info/dist-info directory, not the content
|
||||
- That way, accidentally unpackaged files within are reported as errors
|
||||
|
||||
* Tue Sep 09 2025 Miro Hrončok <mhroncok@redhat.com> - 3.14-8
|
||||
- %%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)
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ def test_python_extras_subpkg_i():
|
|||
It makes sure the dependencies are installed.
|
||||
|
||||
%files -n python3-setuptools_scm+toml
|
||||
%ghost /usr/lib/python{X_Y}/site-packages/*.egg-info
|
||||
%ghost %dir /usr/lib/python{X_Y}/site-packages/*.egg-info
|
||||
|
||||
%package -n python3-setuptools_scm+yaml
|
||||
Summary: Metapackage for python3-setuptools_scm: yaml extras
|
||||
|
|
@ -562,7 +562,7 @@ def test_python_extras_subpkg_i():
|
|||
It makes sure the dependencies are installed.
|
||||
|
||||
%files -n python3-setuptools_scm+yaml
|
||||
%ghost /usr/lib/python{X_Y}/site-packages/*.egg-info
|
||||
%ghost %dir /usr/lib/python{X_Y}/site-packages/*.egg-info
|
||||
""").lstrip().splitlines()
|
||||
assert lines == expected
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue