diff --git a/epel-rpm-macros.spec b/epel-rpm-macros.spec index 80273c9..32ed50c 100644 --- a/epel-rpm-macros.spec +++ b/epel-rpm-macros.spec @@ -1,6 +1,6 @@ Name: epel-rpm-macros Version: 8 -Release: 37 +Release: 38 Summary: Extra Packages for Enterprise Linux RPM macros License: GPLv2 @@ -23,6 +23,9 @@ Source24: sysusers.generate-pre.sh # misc macros Source150: macros.build-constraints 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 Requires: redhat-release >= %{version} @@ -99,10 +102,13 @@ install -Dpm 644 %{SOURCE150} \ %{buildroot}%{_rpmmacrodir}/macros.build-constraints install -Dpm 644 %{SOURCE151} \ %{buildroot}%{_rpmmacrodir}/macros.shell-completions +install -Dpm 644 %{SOURCE152} \ + %{buildroot}%{_rpmmacrodir}/macros.rpmautospec %files %license GPL %{_rpmmacrodir}/macros.epel-rpm-macros +%{_rpmmacrodir}/macros.rpmautospec %{_sysconfdir}/rpm/macros.zzz-epel-override %{_fileattrsdir}/pythondist.attr @@ -119,6 +125,9 @@ install -Dpm 644 %{SOURCE151} \ %changelog +* Fri Mar 10 2023 Maxwell G - 8-38 +- Backport rpmautospec fallback macros + * Wed Feb 08 2023 Maxwell G - 8-37 - Stop overriding macros that are now in RHEL 8.7 diff --git a/macros.rpmautospec b/macros.rpmautospec new file mode 100644 index 0000000..170e480 --- /dev/null +++ b/macros.rpmautospec @@ -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 }") + evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") + print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n") + print("- local build") +} +