Description of problem: When a Python dependency has a *matching* marker, e.g. a metadata line like this: Requires-Dist: base-dependency-with-matching-marker ; python_version < "3.15" It leaks to the requirements of extra subpackages. This is not a severe problem, because the extra subpackages require the base package anyway, but it's a confusing behavior that was not planned in https://fedoraproject.org/wiki/Changes/PythonExtras Version-Release number of selected component (both and likely anything in between): python3-rpm-generators-12-8.fc35.noarch python3-rpm-generators-12-14.fc37.noarch How reproducible: Always Steps to Reproduce: 1. rpmbuild -ba reproducer-extras-base-leaking.spec 2. rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking-0-0.noarch.rpm | grep python 3. rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking+an-extra-0-0.noarch.rpm | grep python ======================== Name: reproducer-extras-base-leaking Version: 0 Release: 0 Summary: ... License: MIT BuildArch: noarch BuildRequires: python3-devel %description ... %python_extras_subpkg -n reproducer-extras-base-leaking -i %{python3_sitelib}/reproducer-0.dist-info an-extra %install mkdir -p %{buildroot}%{python3_sitelib}/reproducer-0.dist-info/ cat << EOF > %{buildroot}%{python3_sitelib}/reproducer-0.dist-info/METADATA Metadata-Version: 2.1 Name: reproducer Version: 0 Requires-Dist: base-dependency Requires-Dist: base-dependency-with-matching-marker ; python_version < "3.15" Requires-Dist: base-dependency-with-unmatching-marker ; python_version < "3.8" Provides-Extra: an-extra Requires-Dist: extra-only-dependency-with-matching-marker ; extra == 'an-extra' and python_version < "3.15" Requires-Dist: extra-only-dependency-with-unmatching-marker ; extra == 'an-extra' and python_version < "3.8" EOF %files %{python3_sitelib}/reproducer-0.dist-info/ ======================== Actual results: $ rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking-0-0.noarch.rpm | grep python python(abi) = 3.10 python3.10dist(base-dependency) python3.10dist(base-dependency-with-matching-marker) $ rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking+an-extra-0-0.noarch.rpm | grep python python(abi) = 3.10 python3.10dist(base-dependency-with-matching-marker) python3.10dist(extra-only-dependency-with-matching-marker) Expected results: $ rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking-0-0.noarch.rpm | grep python python(abi) = 3.10 python3.10dist(base-dependency) python3.10dist(base-dependency-with-matching-marker) $ rpm -qRp ../RPMS/noarch/reproducer-extras-base-leaking+an-extra-0-0.noarch.rpm | grep python python(abi) = 3.10 python3.10dist(extra-only-dependency-with-matching-marker) Additional info: I believe this is caused by https://github.com/rpm-software-management/python-rpm-packaging/blob/a18ca48959/scripts/pythondistdeps.py#L116-L119 if not req.marker: continue if req.marker.evaluate(get_marker_env(self, extra)): extra_deps.append(req) 1) All requirements without a marker are skipped by continue 2) Requirements with markers are evaluated in {'python_full_version': '3.10', 'python_version': '3.10', 'extra': 'an-extra'} 3) python_version < "3.15" evaluates to true in that environment
I believe this might be fixed by something like: if not req.marker: continue if not req.marker.evaluate(get_marker_env(self, None)) and req.marker.evaluate(get_marker_env(self, extra)): extra_deps.append(req)
"upstream" PR: https://github.com/rpm-software-management/python-rpm-packaging/pull/16
Fedora PR: https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/56
FEDORA-2022-af41964158 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-af41964158
FEDORA-2022-4a6373847b has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-4a6373847b
FEDORA-2022-af41964158 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2022-4a6373847b has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-4a6373847b` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-4a6373847b See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2022-4a6373847b has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report.