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
This commit is contained in:
Michal Domonkos 2021-05-12 16:55:37 +02:00
parent 2625834549
commit a5aed4f0e6
2 changed files with 32 additions and 4 deletions

View File

@ -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 <mdomonko@redhat.com> - 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 <mboddu@redhat.com> - 1.0-5

21
kmod.attr Normal file
View File

@ -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
}