Set Version: %{__default_python3_version} to remove one place to bump

Since Fedora 33, the package version always == %{__default_python3_version}.
When we update Python to 3.X+1, we update the version and the macro.

When the macro is not updated confusing things happen.
See for example https://bugzilla.redhat.com/show_bug.cgi?id=1931421#c4

We could assert the versions match in %check instead,
but this way a temporary pull request for a new Python version, such as
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/50
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/84
can be kept rebased via the git forge UI.

Note that the value of %{__default_python3_version} is loaded from sources in
dist git, otherwise it would be defined by the previous build of this package.

As a result, the spec file is no longer parsable on it's own, but IMHO that's OK.
This commit is contained in:
Miro Hrončok 2021-02-23 23:21:47 +01:00
parent a6382f5b5a
commit 8a1e9e0953
1 changed files with 10 additions and 5 deletions

View File

@ -1,11 +1,6 @@
Name: python-rpm-macros
Version: 3.9
Release: 35%{?dist}
Summary: The common Python RPM macros
# macros and lua: MIT, compileall2.py: PSFv2
License: MIT and Python
# Macros:
Source101: macros.python
Source102: macros.python-srpm
@ -19,6 +14,16 @@ Source201: python.lua
%global compileall2_version 0.7.1
Source301: https://github.com/fedora-python/compileall2/raw/v%{compileall2_version}/compileall2.py
# macros and lua: MIT, compileall2.py: PSFv2
License: MIT and Python
# The package version MUST be always the same as %%{__default_python3_version}.
# To have only one source of truth, we load the macro and use it.
# The macro is defined in python-srpm-macros.
%{load:%{SOURCE102}}
Version: %{__default_python3_version}
Release: 35%{?dist}
BuildArch: noarch
# For %%__default_python3_pkgversion used in %%python_provide