From cecab66c5d8bfde3693c81a266d6af594d4c9ed7 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Apr 09 2020 11:36:16 +0000 Subject: Optimize kernel module provides by using a parametric generator This cuts the kernel provide generation time from ~33s to 2.5s on my laptop. Tighten the path matching rule a bit while at it - it doesn't matter that much with parametric generator but there's no point looking at entries we don't generate dependencies on. --- diff --git a/kmod.attr b/kmod.attr index f2a50d0..44a8d56 100644 --- a/kmod.attr +++ b/kmod.attr @@ -1,2 +1,21 @@ -%__kmod_provides %{_rpmconfigdir}/kmod.prov -%__kmod_path ^/lib/modules/.*$ +%__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 +} diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 7145e90..0108ce9 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 153 +Version: 154 Release: 1%{?dist} # No version specified. License: GPL+ @@ -73,7 +73,6 @@ Source501: config.sub # Dependency generators & their rules Source600: kmod.attr -Source601: kmod.prov Source602: libsymlink.attr # BRPs @@ -162,7 +161,6 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.* mkdir -p %{buildroot}%{_fileattrsdir} install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr -install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov mkdir -p %{buildroot}%{_rpmluadir}/fedora/{rpm,srpm} install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua @@ -182,7 +180,6 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{rrcdir}/find-requires %{rrcdir}/brp-ldconfig %{_fileattrsdir}/*.attr -%{_rpmconfigdir}/kmod.prov %{_rpmconfigdir}/macros.d/macros.*-srpm %{_rpmconfigdir}/macros.d/macros.dwz %{_rpmconfigdir}/macros.d/macros.forge @@ -209,6 +206,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Thu Apr 09 2020 Panu Matilainen - 154-1 +- Optimize kernel module provides by using a parametric generator + * Thu Feb 20 2020 Jason L Tibbitts III - 153-1 - Add dependency on fonts-srpm-macros, as those have now been approved by FPC.