Use dynamic %_prefix value when matching files for python(abi) provides

See https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/UFKUM5UKCTNGIT3KJVYEI5VXPI23QMBN/

Flatpak builds redefine %_prefix and the dependencies should remain present.

Also get rid of one useless ^ and prep the pattern for two digit Python major versions.

Add a test that tests that we match our default %_prefix (was the case even before this commit).
This commit is contained in:
Miro Hrončok 2020-04-07 14:41:51 +02:00
parent bbfe4930d9
commit 8eef42cbaa
4 changed files with 31 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Name: python-rpm-generators
Summary: Dependency generators for Python RPMs
Version: 11
Release: 1%{?dist}
Release: 2%{?dist}
# Originally all those files were part of RPM, so license is kept here
License: GPLv2+
@ -45,6 +45,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondistdeps.py
%{_rpmconfigdir}/pythondistdeps.py
%changelog
* Tue Apr 07 2020 Miro Hrončok <mhroncok@redhat.com> - 11-2
- Use dynamic %%_prefix value when matching files for python(abi) provides
* Wed Apr 01 2020 Miro Hrončok <mhroncok@redhat.com> - 11-1
- Rewrite python(abi) generators to Lua to make them faster
- RPM 4.16+ is needed

View File

@ -24,5 +24,5 @@
end
}
%__python_path ^((/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(^%{_bindir}/python[[:digit:]]\\.[[:digit:]]+))$
%__python_path ^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$
%__python_magic [Pp]ython.*(executable|byte-compiled)

View File

@ -14,3 +14,6 @@ rpm -qp --provides ${RPMDIR}/${ARCH}/python-arched-0-0.${ARCH}.rpm | grep -v "${
rpm -qp --requires ${RPMDIR}/noarch/python-noarch-0-0.noarch.rpm | grep "${ABI}"
rpm -qp --provides ${RPMDIR}/noarch/python-noarch-0-0.noarch.rpm | grep -v "${ABI}"
rpm -qp --provides ${RPMDIR}/${ARCH}/python-misplaced-interpreter-0-0.${ARCH}.rpm | grep -v "${ABI}"
rpm -qp --requires ${RPMDIR}/noarch/python-misplaced-library-0-0.noarch.rpm | grep -v "${ABI}"

View File

@ -10,11 +10,18 @@ BuildRequires: python3-devel
%install
mkdir -p %{buildroot}%{python3_sitelib}
mkdir -p %{buildroot}/opt%{python3_sitelib}
mkdir -p %{buildroot}%{python3_sitearch}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}/opt%{_bindir}
echo "print()" > %{buildroot}%{python3_sitelib}/file.py
echo "print()" > %{buildroot}/opt%{python3_sitelib}/file.py
cp %{python3_sitearch}/../lib-dynload/cmath.*.so %{buildroot}%{python3_sitearch}/file.so
cp %{_bindir}/python%{python3_version} %{buildroot}%{_bindir}/python%{python3_version}
cp %{_bindir}/python%{python3_version} %{buildroot}/opt%{_bindir}/python%{python3_version}
%package -n python-noarch
@ -41,3 +48,19 @@ Summary: ...
%files -n python-interpreter
%{_bindir}/python%{python3_version}
%package -n python-misplaced-library
Summary: ...
BuildArch: noarch
%description -n python-misplaced-library
...
%files -n python-misplaced-library
%pycached /opt%{python3_sitelib}/file.py
%package -n python-misplaced-interpreter
Summary: ...
%description -n python-misplaced-interpreter
...
%files -n python-misplaced-interpreter
/opt%{_bindir}/python%{python3_version}