From a5aed4f0e6d8094413b4be2673ba8a652e7ed7fb Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Wed, 12 May 2021 16:55:37 +0200 Subject: [PATCH] Add kmod.attr from redhat-rpm-config This file is currently shipped via the binary redhat-rpm-config package itself, so we need an explicit Conflicts to avoid broken upgrades, as well as actually remove the file from the next redhat-rpm-config build, which we'll also do via #1959924. Related: #1959914 --- kernel-srpm-macros.spec | 15 +++++++++++---- kmod.attr | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 kmod.attr diff --git a/kernel-srpm-macros.spec b/kernel-srpm-macros.spec index 110cd81..fa3b08a 100644 --- a/kernel-srpm-macros.spec +++ b/kernel-srpm-macros.spec @@ -9,6 +9,8 @@ Summary: RPM macros that list arches the full kernel is built on License: MIT URL: https://src.fedoraproject.org/rpms/kernel-srpm-macros BuildArch: noarch +# We are now the ones shipping kmod.attr +Conflicts: redhat-rpm-config <= 184 # Macros Source0: macros.kernel-srpm @@ -20,10 +22,13 @@ Source101: find-requires.ksyms Source102: firmware.prov Source103: modalias.prov +# Dependency generators & their rules +Source200: kmod.attr + # Misc helper scripts -Source200: kmodtool -Source201: rpmsort -Source202: symset-table +Source300: kmodtool +Source301: rpmsort +Source302: symset-table %global rrcdir /usr/lib/rpm/redhat @@ -67,10 +72,12 @@ install -p -m 755 -t %{buildroot}%{rrcdir} kmodtool rpmsort symset-table install -p -m 755 -t %{buildroot}%{rrcdir} find-provides.ksyms find-requires.ksyms install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp +install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr %files %{_rpmconfigdir}/macros.d/macros.kernel-srpm +%{_fileattrsdir}/kmod.attr %files -n kernel-rpm-macros %{_rpmconfigdir}/macros.d/macros.kmp @@ -85,7 +92,7 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp %changelog * Wed May 12 2021 Michal Domonkos - 1.0-6 -- Adopt kernel-rpm-macros subpackage from redhat-rpm-config +- Adopt kernel-rpm-macros subpackage & kmod.attr from redhat-rpm-config - Resolves: #1959914 * Fri Apr 16 2021 Mohan Boddu - 1.0-5 diff --git a/kmod.attr b/kmod.attr new file mode 100644 index 0000000..44a8d56 --- /dev/null +++ b/kmod.attr @@ -0,0 +1,21 @@ +%__kmod_path ^/lib/modules/.*/(modules.builtin|.*ko) +%__kmod_provides() %{lua: + function basename(fn) + return string.gsub(fn, "(.*/)(.*)", "%2") + end + function printdep(mod) + print("kmod("..mod..")") + end + local fn = rpm.expand("%{1}") + local bn = basename(fn) + if bn == "modules.builtin" then + for l in io.lines(fn) do + printdep(basename(l)) + end + else + local mod = string.match(bn, "%g+.ko") + if mod then + printdep(mod) + end + end +}