Generate provides for /app-installed flatpak builds
The generator deliberately does not use %{_prefix} in order to avoid generating provides for packages that set a custom prefix. This is done to ensure that provides are only generated for paths where the Python interpreter actually loads modules from. As we can't use %{_prefix} (which would make it all much simpler), this commit adds a conditional to look in /app only when the %flatpak macro is defined, and /usr otherwise. This should fix provides generation for /app-installed flatpak builds.
This commit is contained in:
parent
d6993270c2
commit
47a0b37ac0
@ -1,7 +1,7 @@
|
||||
Name: python-rpm-generators
|
||||
Summary: Dependency generators for Python RPMs
|
||||
Version: 14
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
|
||||
# Originally all those files were part of RPM, so license is kept here
|
||||
License: GPLv2+
|
||||
@ -47,6 +47,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py
|
||||
%{_rpmconfigdir}/pythonbundles.py
|
||||
|
||||
%changelog
|
||||
* Mon Apr 17 2023 Kalev Lember <klember@redhat.com> - 14-4
|
||||
- Generate provides for /app-installed flatpak builds
|
||||
|
||||
* Tue Mar 07 2023 Miro Hrončok <mhroncok@redhat.com> - 14-3
|
||||
- Avoid needless pkg_resources import in pythonbundles.py
|
||||
- Ignore environment markers in pythonbundles.py
|
||||
|
14
python.attr
14
python.attr
@ -5,8 +5,10 @@
|
||||
-- python(abi) = MAJOR.MINOR
|
||||
-- (Don't match against -config tools e.g. /usr/bin/python2.6-config)
|
||||
local path = rpm.expand('%1')
|
||||
if path:match('/usr/bin/python%d+%.%d+$') then
|
||||
local provides = path:gsub('.*/usr/bin/python(%d+%.%d+)', 'python(abi) = %1')
|
||||
-- Use /usr prefix by default, and /app for flatpak builds
|
||||
local prefix = rpm.expand('%{?!flatpak:/usr}%{?flatpak:/app}')
|
||||
if path:match(prefix .. '/bin/python%d+%.%d+$') then
|
||||
local provides = path:gsub('.*' .. prefix .. '/bin/python(%d+%.%d+)', 'python(abi) = %1')
|
||||
print(provides)
|
||||
end
|
||||
}
|
||||
@ -18,10 +20,12 @@
|
||||
-- generating a line of the form:
|
||||
-- python(abi) = MAJOR.MINOR
|
||||
local path = rpm.expand('%1')
|
||||
if path:match('/usr/lib%d*/python%d+%.%d+/.*') then
|
||||
local requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1')
|
||||
-- Use /usr prefix by default, and /app for flatpak builds
|
||||
local prefix = rpm.expand('%{?!flatpak:/usr}%{?flatpak:/app}')
|
||||
if path:match(prefix .. '/lib%d*/python%d+%.%d+/.*') then
|
||||
local requires = path:gsub('.*' .. prefix .. '/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1')
|
||||
print(requires)
|
||||
end
|
||||
}
|
||||
|
||||
%__python_path ^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$
|
||||
%__python_path ^((%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$
|
||||
|
@ -1,3 +1,3 @@
|
||||
%__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format pep503 --package-name %{name} --majorver-provides-versions %{__default_python3_version} %{?!_python_dist_allow_version_zero:--fail-if-zero}
|
||||
%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires --normalized-names-format pep503 --package-name %{name} %{?!_python_no_extras_requires:--require-extras-subpackages} --console-scripts-nodep-setuptools-since 3.10
|
||||
%__pythondist_path ^/usr/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$
|
||||
%__pythondist_path ^%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$
|
||||
|
Loading…
Reference in New Issue
Block a user