diff --git a/SOURCES/macros.fedora-misc b/SOURCES/macros.fedora-misc new file mode 100644 index 0000000..1dcbfbe --- /dev/null +++ b/SOURCES/macros.fedora-misc @@ -0,0 +1,79 @@ +# Some miscellaneous Fedora-related macros + +# List files matching inclusion globs, excluding files matching exclusion blogs +# Optional parameters: +# – -i "" inclusion globs +# – -x "" exclusion globs +# Globs are space-separated lists of shell globs. Such lists require %{quote:} +# use for safe rpm argument passing. +# Alternatively, set the following rpm variables before calling the macro: +# – “listfiles_include” inclusion globs +# — “listfiles_exclude” exclusion globs +# Arguments passed to the macro without flags will be interpreted as inclusion +# globs. +%listfiles(i:x:) %{expand: +%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))} + listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) + %if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))} + while IFS= read -r finc ; do + realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ + | sort -u | grep -q "${finc}" || echo "${finc}" + done <<< "${listfiles_include}" + %else + echo "${listfiles_include}" + %endif +%endif +} + +# https://github.com/rpm-software-management/rpm/issues/581 +# Write the contents of a list of rpm variables to a macro file. +# The target file must contain the corresponding anchors. +# For example %writevars -f myfile foo bar will replace: +# @@FOO@@ with the rpm evaluation of %{foo} and +# @@BAR@@ with the rpm evaluation of %{bar} +# in myfile +%writevars(f:) %{lua: +local fedora = require "fedora.common" +local macrofile = rpm.expand("%{-f*}") +local rpmvars = {} +for i = 1, rpm.expand("%#") do + table.insert(rpmvars, rpm.expand("%" .. i)) +end +fedora.writevars(macrofile,rpmvars) +} + +# gpgverify verifies signed sources. There is documentation in the script. +%gpgverify(k:s:d:) %{lua: +local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ") +local keyring = rpm.expand("%{-k*}") +local signature = rpm.expand("%{-s*}") +local data = rpm.expand("%{-d*}") +print(script) +if keyring ~= "" then + print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' ")) +end +if signature ~= "" then + print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' ")) +end +if data ~= "" then + print(rpm.expand("--data='%{SOURCE" .. data .. "}' ")) +end +} + +# gpgverify verifies signed sources. There is documentation in the script. +%gpgverify(k:s:d:) %{lua: +local script = rpm.expand("%{_rpmconfigdir}/redhat/gpgverify ") +local keyring = rpm.expand("%{-k*}") +local signature = rpm.expand("%{-s*}") +local data = rpm.expand("%{-d*}") +print(script) +if keyring ~= "" then + print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' ")) +end +if signature ~= "" then + print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' ")) +end +if data ~= "" then + print(rpm.expand("--data='%{SOURCE" .. data .. "}' ")) +end +} diff --git a/SPECS/redhat-rpm-config.spec b/SPECS/redhat-rpm-config.spec index 8f6ac23..458fc6e 100644 --- a/SPECS/redhat-rpm-config.spec +++ b/SPECS/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 124 +Version: 125 Release: 1%{?dist} # No version specified. License: GPL+ @@ -46,6 +46,7 @@ Source152: macros.vpath Source153: macros.forge Source154: macros.ldconfig Source155: macros.kernel-srpm +Source156: macros.fedora-misc # Build policy scripts # this comes from https://github.com/rpm-software-management/rpm/pull/344 @@ -186,6 +187,7 @@ install -p -m 755 %{SOURCE21} %{buildroot}%{_rpmconfigdir}/kabi.sh %{_rpmconfigdir}/macros.d/macros.ldconfig %{_rpmconfigdir}/macros.d/macros.vpath %{_rpmconfigdir}/macros.d/macros.kernel-srpm +%{_rpmconfigdir}/macros.d/macros.fedora-misc %{_rpmconfigdir}/kabi.sh %doc buildflags.md @@ -203,6 +205,9 @@ install -p -m 755 %{SOURCE21} %{buildroot}%{_rpmconfigdir}/kabi.sh %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Fri Nov 27 2020 Florian Festi - 125-1 +- Add missing macros.fedora-misc file (#1874576) + * Mon Nov 09 2020 Florian Festi - 124-1 - Add macros.kernel-srpm (#1874578) - Added gpgverify (#1874576)