From 135990572414c65aa04425f2e8dbeca17a143ac0 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 22 Aug 2023 11:10:34 -0400 Subject: [PATCH] Add macros.rpmautospec While these macros were previously shipped as a subpackage of python-rpmautospec, they do not depend on the Python module, and the rest of that package includes dependencies not wanted in RHEL/ELN (such as koji). --- macros.rpmautospec | 16 ++++++++++++++++ redhat-rpm-config.spec | 10 ++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 macros.rpmautospec 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") +} + diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 4568385..f5876bf 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -4,7 +4,7 @@ # 2) When making changes, increment the version (in baserelease) by 1. # rpmdev-bumpspec and other tools update the macro below, which is used # in Version: to get the desired effect. -%global baserelease 263 +%global baserelease 264 Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config @@ -50,6 +50,7 @@ Source153: macros.forge Source155: macros.ldconfig Source156: macros.vpath Source157: macros.shell-completions +Source158: macros.rpmautospec # Build policy scripts # this comes from https://github.com/rpm-software-management/rpm/pull/344 @@ -106,7 +107,6 @@ Requires: qt5-srpm-macros Requires: qt6-srpm-macros # rust-srpm-macros v24 contains %%build_rustflags defintion Requires: rust-srpm-macros >= 24 -Requires: rpmautospec-rpm-macros Requires: package-notes-srpm-macros Requires: pyproject-srpm-macros @@ -135,6 +135,8 @@ Requires: (llvm if clang) # -fstack-clash-protection and -fcf-protection require GCC 8. Conflicts: gcc < 8.0.1-0.22 +Obsoletes: rpmautospec-rpm-macros < 0.3.6 + Provides: system-rpm-config = %{version}-%{release} %global rrcdir /usr/lib/rpm/redhat @@ -238,6 +240,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.fedora-misc %{_rpmconfigdir}/macros.d/macros.forge %{_rpmconfigdir}/macros.d/macros.ldconfig +%{_rpmconfigdir}/macros.d/macros.rpmautospec %{_rpmconfigdir}/macros.d/macros.shell-completions %{_rpmconfigdir}/macros.d/macros.vpath %dir %{_rpmluadir}/fedora @@ -254,6 +257,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Tue Aug 22 2023 Yaakov Selkowitz - 264-1 +- Add macros.rpmautospec + * Mon Aug 21 2023 Miroslav Suchy - 263-1 - Migrate to SPDX