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.
This commit is contained in:
Michal Domonkos 2021-06-03 17:25:29 +02:00
parent 33b5f1bcf4
commit 101692ba47
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 <= 186
# 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
* Thu Jun 03 2021 Michal Domonkos <mdomonko@redhat.com> - 1.0-5
- Adopt kernel-rpm-macros subpackage from redhat-rpm-config
- Adopt kernel-rpm-macros & kmod.attr subpackage from redhat-rpm-config
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

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
}