If tests are run in this repository, they exist.
Other packages in Fedora require fedpkg-minimal to download the sources.
We also want to run this test in CentOS Stream where fedpkg-minimal is
not available, hence adding centpkg invocation.
The change will have no effect in this repository, but is essential for
the smooth tests run of other components.
This removes an ugly hack that was used to get rid of:
warning: Macro %1 defined but not used within scope
I've noticed the %_pythonname_obsoletes generator does not expand %1
on non-RHELs and yet the warning is not shown.
When debugging the missing warning,
I've noticed it is never shown at all.
According to RPM upstream, the warning was an undesired artifact:
https://github.com/rpm-software-management/rpm/discussions/2501
It was purposefully removed starting with RPM 4.17.
See https://gitlab.com/fedora/legal/fedora-license-data/-/issues/214
The script was only ever contributed to by me and Tomas Orsava.
$ git log --format='%aN <%aE>' pythonbundles.py | sort -u
Miro Hrončok <miro@hroncok.cz>
Tomas Orsava <torsava@redhat.com>
This license clarification is:
Signed-off-by: Miro Hrončok <miro@hroncok.cz>
Signed-off-by: Tomas Orsava <torsava@redhat.com>
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.
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:
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"
On Python 3.10, the base package generated the following requirements:
python3.10dist(base-dependency)
python3.10dist(base-dependency-with-matching-marker)
And for the [an-extra] extra:
python3.10dist(base-dependency-with-matching-marker) <--- REDUNDANT, WRONG
python3.10dist(extra-only-dependency-with-matching-marker)
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 issue is build[virtualenv] 0.8.0, which we use for tests. The package has:
Requires-Dist: tomli (>=1.0.0) ; python_version < "3.11"
And on Python 3.10, it generated the following dependency for python3-build+virtualenv-0.8.0-2.fc37.noarch.rpm:
python3.10dist(tomli) >= 1
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
Improve handling of > operator, preventing post-release from satisfying most rpm requirements.
Improve handling of < operator, preventing pre-release from satisfying rpm requirement.
Improve handling of != operator with prefix matching, preventing pre-release from satisfying rpm requirements.
There were three problems:
- sys.version was not imported
- sys.version[:3] is not reliable on Python 3.10+
- distutils is deprecated on Python 3.10+
We were not hit by the missing import in Fedora because we only run the script
on .dist-info/.egg-info/.egg and not on .py files, so this if-branch never runs.
But when the script was fed with a .py path, it errored:
Traceback (most recent call last):
File "/usr/lib/rpm/pythondistdeps.py", line 344, in <module>
purelib = get_python_lib(standard_lib=0, plat_specific=0).split(version[:3])[0]
NameError: name 'version' is not defined
The sys.version[:3] thing kinda works for Python 3.10+ because *in this
particular case* splitting on '3.1' and taking the prefix yields the same
results as splitting on '3.10', but I consider that mere coincidence.
Finally, since the distutils import happened at module-level,
we got the Deprecation warning in all Fedora's Python packages:
/usr/lib/rpm/pythondistdeps.py:16: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12
Backported from d12e039037