Commit Graph

126 Commits

Author SHA1 Message Date
Miro Hrončok
00b07b2e9c CI: Drop the unused requirement of fedpkg-minimal
tests/download_data_and_run_pytest.sh uses it only when run from other packages.
2024-08-20 11:22:20 +02:00
Karolina Surma
c2d6a50db3 CI: Test the generated Obsoletes are correct in ELN/RHEL 2024-08-19 15:22:41 +02:00
Karolina Surma
1c6998a6db Add gating.yaml 2024-08-06 14:16:23 +02:00
Troy Dawson
faf5ee7bb0 Bump release for June 2024 mass rebuild 2024-06-24 09:19:39 -07:00
Fedora Release Engineering
223b71bb5e Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-26 10:19:05 +00:00
Fedora Release Engineering
f3d6832f4d Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-22 06:41:25 +00:00
Miro Hrončok
592400f58b Remove a no longer needed workaround for RPM <= 4.16 warning
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.
2023-10-06 11:59:15 +02:00
Miro Hrončok
52372a464c Avoid DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors
The warning only happened on corrupted metadata.

The warning originates in 880a6219a1
2023-10-03 12:07:49 +02:00
Fedora Release Engineering
8fe27ad070 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-21 13:45:10 +00:00
Todd Zullinger
f9b21eca49 Fix URL tag
The Pagure instance at src.fedoraproject.org requires namespaces.  This
project is in the rpms namespace.  Update the URL tag accordingly.
2023-05-24 12:58:14 -04:00
Miro Hrončok
50768e7a3d Declare the license via a complex SPDX expression rather than "effective license" 2023-05-05 14:14:41 +02:00
Miro Hrončok
e348b87fd9 License: Clarify pythonbundles.py license
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>
2023-05-05 14:01:14 +02:00
Kalev Lember
47a0b37ac0 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.
2023-04-20 04:23:47 +02:00
Miro Hrončok
d6993270c2 CI: Run pytest via script to make it easier to reuse it in python-packaging 2023-04-19 20:27:07 +02:00
Miro Hrončok
2b8d03b0b1 CI: Add rpm -qa | sort for easier inspectability 2023-04-18 11:14:49 +02:00
Miro Hrončok
2b230d8b53 CI: Assert pythonbundles also ignores [extras]
See https://bugzilla.redhat.com/show_bug.cgi?id=2140230#c12 to #c14.
2023-03-13 15:49:45 +01:00
Miro Hrončok
079b71a567 Ignore environment markers in pythonbundles.py
Use packaging.requirements instead of a naïve split on ==.
2023-03-07 17:35:06 +01:00
Miro Hrončok
279638a969 Avoid needless pkg_resources import in pythonbundles.py 2023-03-07 17:16:58 +01:00
Miro Hrončok
500fda1e6d CI: Remove tests for non-PEP440 versions
packaging 22+ no longer supports them, so neither can we.
2023-02-03 12:28:22 +00:00
Miro Hrončok
1bdd94dd1d CI: Include stdout/stderr in test failures 2023-02-03 12:28:22 +00:00
Fedora Release Engineering
9d7ca941e7 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-20 17:03:50 +00:00
Karolina Surma
78c739cfd1 Update the test data sources 2023-01-05 09:39:19 +01:00
Karolina Surma
197a88bf93 https://fedoraproject.org/wiki/Changes/Prevent-Providing-python3dist(pkg)=0 2023-01-05 09:39:19 +01:00
Fedora Release Engineering
7b3e3b30de Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 22:07:02 +00:00
Miro Hrončok
cf65060b7e https://fedoraproject.org/wiki/Changes/PythonDistPEP503ProvidesOnly 2022-06-02 12:43:00 +02:00
Miro Hrončok
0bd051d514 Don't include all requirements with True-evaluating markers in extras subpackages
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
2022-06-02 12:05:11 +02:00
Sandro Mani
76e71def2c Add namespace option to pythodistdeps.py
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2022-02-10 11:54:50 +01:00
Charalampos Stratakis
ecd2f8b3f8 Add rpminspect file 2022-02-02 15:24:19 +00:00
Tomas Orsava
e18b8c952c Add tests for automatically not generating Obsoletes tags on Fedora 2022-02-02 13:58:09 +01:00
Tomas Orsava
b1fa63bf02 From python3-foo packages automatically generate python3.X-foo Obsoletes tags on CentOS/RHEL 2022-01-26 17:07:05 +01:00
Tomas Orsava
fbd2f87265 Fix typo in lua comment 2022-01-26 17:06:51 +01:00
Fedora Release Engineering
2ff265d8fd - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-21 15:19:07 +00:00
Gordon Messmer
2c2f8bd984 Handle legacy version specifiers that would previously raise exceptions. 2021-12-19 14:08:05 -08:00
Gordon Messmer
a3ad67b505 Additional fix for dev releases. 2021-10-29 20:00:41 -07:00
Gordon Messmer
27f9733f0b Sync dependency conversion with upstream pyreq2rpm.
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.
2021-10-28 21:50:58 -07:00
Fedora Release Engineering
98fa009fc8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 09:18:27 +00:00
Miro Hrončok
9bd2a43a74 Support multiple vendor files in pythonbundles.py
Not bumping the release, will happily wait until it bubbles trough.
2021-06-22 18:28:43 +00:00
Miro Hrončok
04ae9b96f2 CI: Adapt pythondist.spec for Python 3.10 being the main Python version
Preserves comaptbility with Python 3.9.
2021-06-18 19:20:16 +02:00
Tomas Orsava
cc489bde7a pythondistdeps.py: Catch all exceptions and terminate build if one is raised 2021-05-25 18:51:44 +02:00
Tomas Orsava
27d363833e pythondistdeps.py: Detect and error when metadata is corrupted 2021-05-25 18:11:00 +02:00
Miro Hrončok
20f8b2c775 Fix python(abi) generator (the one written in Python)
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 https://github.com/rpm-software-management/python-rpm-packaging/commit/d12e039037
2021-04-19 22:59:10 +02:00
Miro Hrončok
0a12aa5a2f Do not generate setuptools requirement for console_scripts on Python 3.10+
See https://fedoraproject.org/wiki/Changes/Reduce_dependencies_on_python3-setuptools
2021-03-31 11:56:16 +02:00
Tomas Orsava
a295a58559 Add __pycache__ into .gitignore 2021-03-11 13:41:54 +01:00
Tomas Orsava
3a4efade98 pythondistdeps.py: Always output extras names in lowercase 2021-03-11 13:41:54 +01:00
Tomas Orsava
b44c808358 pythondistdeps.py: Compare extras as lowercase
- New test sources tarball with added test data
2021-03-11 13:41:25 +01:00
Tomas Orsava
103464475f pythondistdeps.py: Changing order in test-data 2021-03-11 12:46:23 +01:00
Tomas Orsava
48510eebae scripts/pythondistdeps: Fix for Python 3.10
self.name in PathDistribution is a property in Python 3.10+ and thus we
can't redefine it as an instance variable. Instead we explicitly define
it as a property, which works on all supported Python versions.
2021-02-24 14:07:24 +01:00
Tomas Orsava
438d8d3b70 scripts/pythondistdeps: Backport switch to importlib.metadata from upstream
Upstream change to importlib.metadata: https://github.com/rpm-software-management/rpm/pull/1317

Due to extras packages being hadled slightly differently by importlib,
one test case for this was added.  And due to changes in handling
requires.txt files, comments were removed from the pyreq2rpm.tests
testing package.

Also because of the switch, we removed the dependency on setuptools and
added a dependency on packaging.

Note: Some packages with egg-info files might provide a different name
due to this change if there is a conflict between the filename and the
name in the metadata. Previously, the filename was sometimes used to
parse the name, now it is always the content of that file, which is what
packaging does, and thus also pip and other Python tooling. Currently,
this is known to affect only 1 package in Fedora (ntpsec).

The resulting script is different from upstream because of not yet upstreamed changes in Fedora:
- scripts/pythondistdeps: Rework error messages
- scripts/pythondistdeps: Add parameter --package-name
- scripts/pythondistdeps: Implement provides/requires for extras packages
- pythondistdeps.py: When parsing extras name, take the rightmost +

These changes are proposed in this upstream PR: https://github.com/rpm-software-management/rpm/pull/1546
2021-02-18 16:08:27 +01:00
Miro Hrončok
2d631762c5 Remove unused 2.7 from --majorver-provides-versions
Fixup for 8c2a1c0ac9.
This makes no real difference, just a cleanup, hence not bumping.
2021-02-08 10:53:40 +01:00
Miro Hrončok
8c2a1c0ac9 Disable the dist generators for Python 2
https://fedoraproject.org/wiki/Changes/Disable_Python_2_Dist_RPM_Generators_and_Freeze_Python_2_Macros

The regex previously matched any Python version in a form of <single digit>.<at least one digit>.

Now it matches anything from 3.0 above: <single digit (3 or higher)>.<at least one digit>

It still does not match <multiple digits>.<at least one digit>, e.g. 11.0.

This is a breaking change, hence the version bump.
2021-02-03 14:09:45 +01:00