Doing fedpkg srpm creates a source RPM (cpio) with spec + sources. The spec has expanded %autochangelog (correct) but unexpanded %autorelease (bad). This is not only an inconsistency ...
fedpkg srpm
The expanded spec file could be used to migrate a source RPM out from dist-git, and keep the appropriate release number. This is e.g. needed to support %autorelease in Copr... or for wrapping e.g. RHEL packages from Fedora.
Copr builds source RPM from Fedora DistGit first (or say it rather builds package sources = spec + sources), and from that, it builds RPMs into all configured chroots (there are other implementation details like the proxy-copr-distgit, lemme know if we need to go that deep).
Related report: #199
Reproducer:
$ rpm -q fedpkg python3-rpkg fedpkg-1.41-1.fc35.noarch python3-rpkg-1.63-2.fc35.noarch $ fedpkg srpm Not downloading already downloaded zim-0.74.1.tar.gz setting SOURCE_DATE_EPOCH=1632528000 Wrote: /tmp/Zim/Zim-0.74.1-1.fc36.src.rpm $ bsdtar xf /tmp/Zim/Zim-0.74.1-1.fc36.src.rpm -O Zim.spec | grep ^Release Release: %autorelease
The release should be expanded, same as changelog:
$ bsdtar xf /tmp/Zim/Zim-0.74.1-1.fc36.src.rpm -O Zim.spec | grep %changelog -A10 %changelog * Sat Sep 25 2021 Robin Lee <cheeselee@fedoraproject.org> 0.74.1-1 - Update to 0.74.1 * Thu Sep 16 2021 Robin Lee <cheeselee@fedoraproject.org> 0.74.0-1 - Update to 0.74.0 and enable tests * Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.73.5-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.73.5-2
As discussed in #199, this was apparently implemented a differently than I expected, but it is fixed. Each spec file gets this:
## START: Set by rpmautospec ## (rpmautospec version 0.2.5) %define autorelease(e:s:pb:) %{?-p:0.}%{lua: release_number = 2; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist} ## END: Set by rpmautospec
It works.
Metadata Update from @praiskup: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)