| |
@@ -112,10 +112,17 @@
|
| |
|
| |
def requirements_for_extra(self, extra):
|
| |
extra_deps = []
|
| |
+ # we are only interested in dependencies with extra == 'our_extra' marker
|
| |
for req in self.requirements:
|
| |
+ # no marker at all, nothing to evaluate
|
| |
if not req.marker:
|
| |
continue
|
| |
- if req.marker.evaluate(get_marker_env(self, extra)):
|
| |
+ # does the marker include extra == 'our_extra'?
|
| |
+ # we can only evaluate the marker as a whole,
|
| |
+ # so we evaluate it twice (using 2 different marker_envs)
|
| |
+ # and see if it only evaluates to True with our extra
|
| |
+ if (req.marker.evaluate(get_marker_env(self, extra)) and
|
| |
+ not req.marker.evaluate(get_marker_env(self, None))):
|
| |
extra_deps.append(req)
|
| |
return extra_deps
|
| |
|
| |
The idea is that the extra subpackage only has requirements specific to that extra.
The logic however only excluded requirements without markers,
but requirements with a marker that was correct leaked to all extras subpackages.
E.g. with the following requirements:
On Python 3.10, the base package generated the following requirements:
And for the [an-extra] extra:
Now we no longer just check if the marker evaluates to True,
but we also check that the same marker evaluates to False when the extra is not given.
A real package with this thing issue build[virtualenv] 0.8.0, which we use for tests. The package has:
And on Python 3.10, it generated the following dependency for python3-build+virtualenv-0.8.0-2.fc37.noarch.rpm:
Now it no longer does. This is asserted in tests.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2090186
Upstream PR: https://github.com/rpm-software-management/python-rpm-packaging/pull/16