Backport rpmautospec fallback macros

rpmautospec koji plugin bakes in the result of %autorelease and
%autochangelog into the SRPM. When used on a Fedora or EL 9 machine with
rpmautospec installed, fedpkg does the same. However, it's currently
impossible to rebuild specfiles that use rpmautospec on EL 8 itself due
to the unexpanded %autorelease and %autochangelog macros failing the
SRPM build.

This adds the same fallback %autorelease and %autochangelog macro
definitions that are available in the Fedora and EPEL 9 buildroots. This
allows locally rebuilding packages that use rpmautospec with plain
rpmbuild or fedpkg on an EL 8 system or with `mock --spec`.
epel8
Maxwell G 2 years ago
parent 59caa90b5f
commit 7c1824e99a
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8

@ -1,6 +1,6 @@
Name: epel-rpm-macros Name: epel-rpm-macros
Version: 8 Version: 8
Release: 37 Release: 38
Summary: Extra Packages for Enterprise Linux RPM macros Summary: Extra Packages for Enterprise Linux RPM macros
License: GPLv2 License: GPLv2
@ -23,6 +23,9 @@ Source24: sysusers.generate-pre.sh
# misc macros # misc macros
Source150: macros.build-constraints Source150: macros.build-constraints
Source151: https://src.fedoraproject.org/rpms/redhat-rpm-config/raw/rawhide/f/macros.shell-completions Source151: https://src.fedoraproject.org/rpms/redhat-rpm-config/raw/rawhide/f/macros.shell-completions
# autochangelog and autorelease fallback macros
%global rpmautospec_commit 52f3c2017e10c5ab5a183fed772e9fe8a86a20fb
Source152: https://pagure.io/fedora-infra/rpmautospec/raw/%{rpmautospec_commit}/f/rpm/macros.d/macros.rpmautospec
BuildArch: noarch BuildArch: noarch
Requires: redhat-release >= %{version} Requires: redhat-release >= %{version}
@ -99,10 +102,13 @@ install -Dpm 644 %{SOURCE150} \
%{buildroot}%{_rpmmacrodir}/macros.build-constraints %{buildroot}%{_rpmmacrodir}/macros.build-constraints
install -Dpm 644 %{SOURCE151} \ install -Dpm 644 %{SOURCE151} \
%{buildroot}%{_rpmmacrodir}/macros.shell-completions %{buildroot}%{_rpmmacrodir}/macros.shell-completions
install -Dpm 644 %{SOURCE152} \
%{buildroot}%{_rpmmacrodir}/macros.rpmautospec
%files %files
%license GPL %license GPL
%{_rpmmacrodir}/macros.epel-rpm-macros %{_rpmmacrodir}/macros.epel-rpm-macros
%{_rpmmacrodir}/macros.rpmautospec
%{_sysconfdir}/rpm/macros.zzz-epel-override %{_sysconfdir}/rpm/macros.zzz-epel-override
%{_fileattrsdir}/pythondist.attr %{_fileattrsdir}/pythondist.attr
@ -119,6 +125,9 @@ install -Dpm 644 %{SOURCE151} \
%changelog %changelog
* Fri Mar 10 2023 Maxwell G <maxwell@gtmx.me> - 8-38
- Backport rpmautospec fallback macros
* Wed Feb 08 2023 Maxwell G <gotmax@e.email> - 8-37 * Wed Feb 08 2023 Maxwell G <gotmax@e.email> - 8-37
- Stop overriding macros that are now in RHEL 8.7 - Stop overriding macros that are now in RHEL 8.7

@ -0,0 +1,16 @@
%autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = tonumber(rpm.expand("%{?_rpmautospec_release_number}%{!?_rpmautospec_release_number:1}"));
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
%autochangelog %{lua:
locale = os.setlocale(nil)
os.setlocale("C.utf8")
date = os.date("%a %b %d %Y")
os.setlocale(locale)
packager = rpm.expand("%{?packager}%{!?packager:John Doe <packager@example.com>}")
evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n")
print("- local build")
}
Loading…
Cancel
Save