From a918338bce6e2a78c46a990a4b973508d013b48a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 13 Jul 2018 07:18:40 +0000 Subject: [PATCH 01/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 8a96a7b..324b39c 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 29%{?dist} +Release: 30%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -38,6 +38,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Fri Jul 13 2018 Fedora Release Engineering - 1-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Mon Mar 26 2018 Nicolas Chauvet - 1-29 - Update copyrights - Drop Group field From 10a8eafc53158e05cde1382e3fd3a6dda192e403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 31 Oct 2018 00:19:07 +0100 Subject: [PATCH 02/51] Add BuildRequires for gcc to build kmod modules for fc29 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 1 + 1 file changed, 1 insertion(+) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 92e82c2..ed714cf 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -217,6 +217,7 @@ printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modu %else Requires: kernel-uname-r = ${kernel_uname_r} BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} +BuildRequires: gcc %post -n kmod-${kmodname}-${kernel_uname_r} %{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || : %postun -n kmod-${kmodname}-${kernel_uname_r} From f51f85ec08c1966d87dbed7a706fd38b320d857e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 7 Nov 2018 19:13:56 +0100 Subject: [PATCH 03/51] Update copyrights --- kmodtool-kmodtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index ed714cf..5c5661d 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -4,7 +4,7 @@ # Copyright (c) 2003-2012 Ville Skyttä , # Thorsten Leemhuis # Copyright (c) 2012-2018 Nicolas Chauvet -# Copyright (c) 2017 Nicolas Vieville +# Copyright (c) 2017-2018 Nicolas Viéville # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the From 49f20c452d6ca546626b68d2fca1a56193385bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 7 Nov 2018 19:31:13 +0100 Subject: [PATCH 04/51] Update RPM changelog --- kmodtool.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 324b39c..a26b80e 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 30%{?dist} +Release: 31%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -38,6 +38,10 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Wed Nov 07 2018 Nicolas Viéville - 1-31 +- Update copyrights +- Add BuildRequires for gcc to build kmod modules for fc29+ + * Fri Jul 13 2018 Fedora Release Engineering - 1-30 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 26978bb44743b8dd21e4a9fd19e05978967fb316 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 25 Jan 2019 16:07:01 +0100 Subject: [PATCH 05/51] Add rt as a known kernel variant --- kmodtool-kernel-variants | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmodtool-kernel-variants b/kmodtool-kernel-variants index b047f21..6b04ec1 100644 --- a/kmodtool-kernel-variants +++ b/kmodtool-kernel-variants @@ -1 +1 @@ -@(smp?(-debug)|PAE?(-debug)|lpae|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra) +@(smp?(-debug)|PAE?(-debug)|lpae|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra|rt) From 61bc95e30acedfca930f5863eb4d82ef2453b3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Thu, 8 Nov 2018 08:16:13 +0100 Subject: [PATCH 06/51] Fix minor glitches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool.spec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kmodtool.spec b/kmodtool.spec index a26b80e..aebc846 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -9,6 +9,7 @@ Source1: %{name}-kmodtool Source2: %{name}-kernel-variants BuildArch: noarch + %description This package contains tools and list of recent kernels that get used when building kmod-packages. @@ -23,9 +24,10 @@ building kmod-packages. %install -mkdir -p $RPM_BUILD_ROOT/%{_bindir} $RPM_BUILD_ROOT/%{_datadir}/%{name}/ -install -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/%{_bindir}/kmodtool -install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/%{_datadir}/%{name}/kernel-variants +mkdir -p -m 0755 %{buildroot}%{_bindir} +mkdir -p -m 0755 %{buildroot}%{_datadir}/%{name} +install -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/kmodtool +install -p -m 0644 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/kernel-variants # adjust default-path sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ From 2187151bcc93584aa6c1128f98b47c372d66ba86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Sun, 11 Nov 2018 12:00:56 +0100 Subject: [PATCH 07/51] Last clean-up - remove space at end of line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kmodtool.spec b/kmodtool.spec index aebc846..28f40d2 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -133,11 +133,11 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ - integrate akmodstool into kmodtool * Mon Dec 17 2007 Thorsten Leemhuis - 1-5 -- update kmodtool, so the kmod-foo- package does not require the +- update kmodtool, so the kmod-foo- package does not require the kmod-foo package when building for kernels that were passed with for-kernels * Tue Dec 04 2007 Thorsten Leemhuis - 1-4 -- update kmodtool, so the kmod-foo metapackage requires the proper version +- update kmodtool, so the kmod-foo metapackage requires the proper version of the kmod-foo- package * Tue Dec 04 2007 Thorsten Leemhuis - 1-3 @@ -195,7 +195,7 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ * Wed Oct 03 2007 Thorsten Leemhuis - 5-1 - disable --all-but-latest stuff -- does not work as expected -- rename up2date list of kernels from "latest" to "current" as latest +- rename up2date list of kernels from "latest" to "current" as latest and newest are to similar in wording; asjust script as well - kmodtool: don't provide kernel-modules, not needed anymore with the new stayle and hurts @@ -209,12 +209,12 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ - s/latests/latest/ - update kernel lists for rawhide and test2 kernels - make kmod-helpers-livna-list-kernels print BuildRequires for all kernels - as well; this is not needed and will slow build a bit as it will track + as well; this is not needed and will slow build a bit as it will track all the kernel-devel packages in, but that way we make sure they are really available in the buildsys * Fri Sep 07 2007 Thorsten Leemhuis - 3-4 -- implement proper arch deps +- implement proper arch deps * Fri Sep 07 2007 Thorsten Leemhuis - 3-3 - proper list of todays rawhide-kernels From 0f7338ef581d9042e7931efc13444ede8ac67597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Thu, 8 Nov 2018 08:15:18 +0100 Subject: [PATCH 08/51] Improve and fix kernel_uname_r* variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 5c5661d..09f6ab4 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -143,18 +143,9 @@ print_rpmtemplate_per_kmodpkg () ## Build some interesting strings with kernel uname -r ## Examples: ## kernel_uname_r 3.10.0-693.2.2.el7.x86_64 - ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 ## kernel_uname_r_short 3.10.0-693.el7 - ## kernel_uname_r_rel 693 - ## kernel_uname_r_rel_plus_one 694 - ## kernel_uname_r_short_plus_one 3.10.0-694.el7 local kernel_uname_r=${1} - local kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") - local kernel_uname_r_short=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*-\)\([[:alnum:]]*\)\(\..*\)\(\.el.*\)/\1\2\4/") - local kernel_uname_r_rel=$(echo ${1} | sed -e "s/.*-//" -e "s/\..*//") - local kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 )) - local kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./") - local kernel_variant="${2:+-${2}}" + local kernel_uname_r_short=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/") if [[ -h /sbin ]] ; then echo '%global _prefix_usr '/usr @@ -192,6 +183,21 @@ EOF # second part if [[ ! "${customkernel}" ]] ; then + ## Build some interesting strings with kernel uname -r + ## Examples: + ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 + ## kernel_uname_r_dist el7 + ## kernel_uname_r_rel 693 + ## kernel_uname_r_rel_plus_one 694 + ## kernel_uname_r_short_plus_one 3.10.0-694.el7 + ## kernel_uname_r_rel_minor 2.2 + local kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") + local kernel_uname_r_dist=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//") + local kernel_uname_r_rel=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\2/" -e "s/^\.//") + local kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 )) + local kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./") + local kernel_uname_r_rel_minor=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//") + cat < Date: Fri, 1 Feb 2019 05:52:37 +0000 Subject: [PATCH 09/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 28f40d2..8cfb0f2 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 31%{?dist} +Release: 32%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Fri Feb 01 2019 Fedora Release Engineering - 1-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Wed Nov 07 2018 Nicolas Viéville - 1-31 - Update copyrights - Add BuildRequires for gcc to build kmod modules for fc29+ From 476c84d2f3f3b2fd59f5d5fb80f3b4aa41b01354 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 18 Dec 2018 08:37:14 +0100 Subject: [PATCH 10/51] Call out to akmods-ostree-post from %post We need this for silverblue, so that we can build the module in %post which is run during construction of the image. To work with previous versions of akmods we check for /usr/sbin/akmods-ostree-post before running it. kmodtool: Forward %dist if set This allows one to build .fc30 packages on .fc29. Otherwise everything of the package will be .fc30 except the .srpm that is embedded, which will be called .fc29. --- kmodtool-kmodtool | 4 ++++ kmodtool.spec | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 09f6ab4..85b90d1 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -67,6 +67,7 @@ print_akmodtemplate () %global akmod_install mkdir -p \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/; \\\ rpmbuild --define "_sourcedir %{_sourcedir}" \\\ --define "_srcrpmdir \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/" \\\ +%{?dist:--define 'dist %{dist}}' \\\ -bs --nodeps %{_specdir}/%{name}.spec ; \\\ ln -s \$(ls \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/) \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/${kmodname}-kmod.latest @@ -93,6 +94,9 @@ This package provides the akmod package for the ${kmodname} kernel modules. %posttrans -n akmod-${kmodname} nohup /usr/sbin/akmods --from-akmod-posttrans --akmod ${kmodname} &> /dev/null & +%post -n akmod-${kmodname} +[ -x /usr/sbin/akmods-ostree-post ] && /usr/sbin/akmods-ostree-post ${kmodname} %{_usrsrc}/akmods/${kmodname}-kmod-%{version}-%{release}.src.rpm + %files -n akmod-${kmodname} %defattr(-,root,root,-) %{_usrsrc}/akmods/* diff --git a/kmodtool.spec b/kmodtool.spec index 8cfb0f2..7e79a6d 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 32%{?dist} +Release: 33%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Thu Feb 28 2019 Alexander Larsson - 1-33 +- Call akmods-ostree-post to support ostree/silverblue builds - rhbz#1667014 + * Fri Feb 01 2019 Fedora Release Engineering - 1-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From b385f3e1da6e6c6dc3355fdd0dd0164e40423d6e Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Thu, 16 May 2019 19:09:11 +0200 Subject: [PATCH 11/51] Add _kmodtool_depmod_post - rhbz#1703715 Signed-off-by: Nicolas Chauvet --- kmodtool-kmodtool | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 85b90d1..67dde86 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -203,6 +203,14 @@ EOF local kernel_uname_r_rel_minor=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//") cat </dev/null ; \\\ +elif [ -f /lib/modules/${kernel_uname_r}/System.map ] ; then \\\ + %{?_prefix_usr}/sbin/depmod -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} >/dev/null ; \\\ +else \\\ + %{?_prefix_usr}/sbin/depmod -a >/dev/null ; \\\ +fi || : %if 0%{?rhel} Requires: kernel >= ${kernel_uname_r_short} @@ -210,7 +218,7 @@ Requires: kernel < ${kernel_uname_r_short_plus_one} BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config kernel-abi-whitelists %post -n kmod-${kmodname} -%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || : +%{_kmodtool_depmod_post} modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules @@ -219,7 +227,7 @@ printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules %postun -n kmod-${kmodname} -%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || : +%{_kmodtool_depmod_post} modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) rm /var/run/rpm-kmod-${kmodname}-modules @@ -229,9 +237,9 @@ Requires: kernel-uname-r = ${kernel_uname_r} BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} BuildRequires: gcc %post -n kmod-${kmodname}-${kernel_uname_r} -%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || : +%{_kmodtool_depmod_post} %postun -n kmod-${kmodname}-${kernel_uname_r} -%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || : +%{_kmodtool_depmod_post} %endif EOF else From 3d21d3cac0bfa5a2171612d7c95f035f05de536e Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Thu, 16 May 2019 20:15:07 +0200 Subject: [PATCH 12/51] Update copyright date --- kmodtool-kmodtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 67dde86..a379955 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -3,7 +3,7 @@ # kmodtool - Helper script for building kernel module RPMs # Copyright (c) 2003-2012 Ville Skyttä , # Thorsten Leemhuis -# Copyright (c) 2012-2018 Nicolas Chauvet +# Copyright (c) 2012-2019 Nicolas Chauvet # Copyright (c) 2017-2018 Nicolas Viéville # # Permission is hereby granted, free of charge, to any person obtaining From 2f667b35753c182bd9c130109a8b6cd2981a3adc Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Thu, 16 May 2019 20:16:37 +0200 Subject: [PATCH 13/51] Update changelog --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 7e79a6d..4346749 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 33%{?dist} +Release: 34%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Thu May 16 2019 Nicolas Chauvet - 1-34 +- Add _kmodtool_depmod_post - rhbz#1703715 + * Thu Feb 28 2019 Alexander Larsson - 1-33 - Call akmods-ostree-post to support ostree/silverblue builds - rhbz#1667014 From 20a2f602c9477a78c207aeea19f74242d437dfbf Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jul 2019 11:57:07 +0000 Subject: [PATCH 14/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 4346749..a10d71b 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 34%{?dist} +Release: 35%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Thu Jul 25 2019 Fedora Release Engineering - 1-35 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Thu May 16 2019 Nicolas Chauvet - 1-34 - Add _kmodtool_depmod_post - rhbz#1703715 From 91b62c78808509e4371e7484ec7c39a17f278d2c Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Thu, 10 Oct 2019 18:56:04 +0100 Subject: [PATCH 15/51] Fix naming conflict with kmod meta package --- kmodtool-kmodtool | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index a379955..b633615 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -159,7 +159,7 @@ print_rpmtemplate_per_kmodpkg () cat <= ${kernel_uname_r_short} Requires: kernel < ${kernel_uname_r_short_plus_one} BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config kernel-abi-whitelists -%post -n kmod-${kmodname} +%post -n kmod-${kmodname}-${kernel_uname_r} %{_kmodtool_depmod_post} modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules -%preun -n kmod-${kmodname} +%preun -n kmod-${kmodname}-${kernel_uname_r} rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules -%postun -n kmod-${kmodname} +%postun -n kmod-${kmodname}-${kernel_uname_r} %{_kmodtool_depmod_post} modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) @@ -246,7 +246,7 @@ EOF cat < /dev/null || : if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then @@ -254,12 +254,12 @@ if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules fi -%preun -n kmod-${kmodname} +%preun -n kmod-${kmodname}-${kernel_uname_r} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules fi -%postun -n kmod-${kmodname} +%postun -n kmod-${kmodname}-${kernel_uname_r} [[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then @@ -280,10 +280,10 @@ EOF cat < Date: Thu, 10 Oct 2019 20:22:24 +0100 Subject: [PATCH 16/51] Update changelog --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index a10d71b..b85e5a0 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Thu Oct 10 2019 Leigh Scott - 1-36 +- Fix naming conflict with kmod meta package + * Thu Jul 25 2019 Fedora Release Engineering - 1-35 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From 26e909573cdaa8578569ab8f47c234b9ae838c61 Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Fri, 11 Oct 2019 16:11:49 +0100 Subject: [PATCH 17/51] Fix package name in epel scriptlets --- kmodtool-kmodtool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index b633615..9263631 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -224,7 +224,7 @@ modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules %preun -n kmod-${kmodname}-${kernel_uname_r} -rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules +rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules %postun -n kmod-${kmodname}-${kernel_uname_r} %{_kmodtool_depmod_post} @@ -256,7 +256,7 @@ fi %preun -n kmod-${kmodname}-${kernel_uname_r} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules + rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules fi %postun -n kmod-${kmodname}-${kernel_uname_r} From e9f8c73d7e93e4fea7f40dc38e8c10a2e0f7985d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 13 Oct 2019 16:39:19 +0100 Subject: [PATCH 18/51] Fix package name in epel scriptlets --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index b85e5a0..12b6a0a 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Sun Oct 13 2019 Sérgio Basto - 1-37 +- Fix package name in epel scriptlets + * Thu Oct 10 2019 Leigh Scott - 1-36 - Fix naming conflict with kmod meta package From f96249e60140bab7e822a90a6ce710cdce3f40b6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jan 2020 07:40:38 +0000 Subject: [PATCH 19/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 12b6a0a..db36883 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 37%{?dist} +Release: 38%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Wed Jan 29 2020 Fedora Release Engineering - 1-38 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Sun Oct 13 2019 Sérgio Basto - 1-37 - Fix package name in epel scriptlets From c83c7f64f8dda9e999e555d74df12978c14944ec Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mon, 6 Jul 2020 09:15:34 -0400 Subject: [PATCH 20/51] Don't force-disable debuginfo subpackages Fedora and RHEL support generating debuginfo from kmods as long as they are built properly, so don't force-disable debuginfo subpackages. --- kmodtool-kmodtool | 1 - kmodtool.spec | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 9263631..054fa00 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -55,7 +55,6 @@ print_rpmtemplate_header() echo '%global kmodinstdir_prefix '${usr_lib_modules}/ echo '%global kmodinstdir_postfix '/extra/${kmodname}/ echo '%global kernel_versions '${kernel_versions} - echo '%global debug_package %{nil}' echo } diff --git a/kmodtool.spec b/kmodtool.spec index db36883..8ddba79 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 38%{?dist} +Release: 39%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Mon Jul 06 2020 Neal Gompa - 1-39 +- Don't force-disable debuginfo subpackages + * Wed Jan 29 2020 Fedora Release Engineering - 1-38 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 72d7d0a864929bd69beed693b938cc5f83faa61c Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mon, 6 Jul 2020 09:39:23 -0400 Subject: [PATCH 21/51] Always use /lib/modules for kmod install path The Fedora and RHEL kernels install things into /lib/modules and generally expect that to be set up that way. Let's not be inconsistent here, since it causes kmod builds to randomly fail when they get properties from the kernel makefile build system itself. --- kmodtool-kmodtool | 8 +++----- kmodtool.spec | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 054fa00..8b0ce1a 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -486,11 +486,9 @@ while [ "${1}" ] ; do esac done -if [[ -h /lib ]] ; then - usr_lib_modules=/usr/lib/modules -else - usr_lib_modules=/lib/modules -fi +# These should always be in /lib/modules +# as that's how the kernel package lays them out +usr_lib_modules=/lib/modules if [[ -e ./kmodtool-kernel-variants ]] ; then kernels_known_variants="$(cat ./kmodtool-kernel-variants)" diff --git a/kmodtool.spec b/kmodtool.spec index 8ddba79..fba8b08 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 39%{?dist} +Release: 40%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Mon Jul 06 2020 Neal Gompa - 1-40 +- Always use /lib/modules for kmod install path + * Mon Jul 06 2020 Neal Gompa - 1-39 - Don't force-disable debuginfo subpackages From 643a06527361d513bb570b6cc40c97e7c5e34f97 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jul 2020 03:32:10 +0000 Subject: [PATCH 22/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index fba8b08..075844b 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 40%{?dist} +Release: 41%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Tue Jul 28 2020 Fedora Release Engineering - 1-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Mon Jul 06 2020 Neal Gompa - 1-40 - Always use /lib/modules for kmod install path From c45f32ac60a258d96ac884f87359b9726b7a828f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 15:59:01 +0000 Subject: [PATCH 23/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 075844b..e87daba 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 41%{?dist} +Release: 42%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 1-42 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Tue Jul 28 2020 Fedora Release Engineering - 1-41 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From ca789abc9df81f5b039aefe65d85f19d5bf2ed04 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 10:14:41 +0000 Subject: [PATCH 24/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index e87daba..75805e6 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 42%{?dist} +Release: 43%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -40,6 +40,9 @@ sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ %changelog +* Thu Jul 22 2021 Fedora Release Engineering - 1-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Jan 26 2021 Fedora Release Engineering - 1-42 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From 1d832117e5d82ab0be5655b7594a3721145cec1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 20:47:11 +0200 Subject: [PATCH 25/51] Fix indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 8b0ce1a..c85f131 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -249,22 +249,22 @@ EOF [[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) - printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules + modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) + printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules fi %preun -n kmod-${kmodname}-${kernel_uname_r} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules + rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules fi %postun -n kmod-${kmodname}-${kernel_uname_r} [[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) - rm /var/run/rpm-kmod-${kmodname}-modules - printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules + modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) + rm /var/run/rpm-kmod-${kmodname}-modules + printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules fi %else %post -n kmod-${kmodname}-${kernel_uname_r} From 8fbaff07a699c25859eb325783be61784c3b1262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 21:28:51 +0200 Subject: [PATCH 26/51] Add installonlypkg(kernel-module) to allow kmod packages co-install (RHEL) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index c85f131..fa14bd0 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -154,13 +154,23 @@ print_rpmtemplate_per_kmodpkg () echo '%global _prefix_usr '/usr fi - # first part + # first part + # + # According to: + # https://github.com/rpm-software-management/yum/blob/master/yum/config.py#L780 + # https://github.com/rpm-software-management/dnf/blob/master/dnf/const.py.in#L30 + # + # and in order to be able to co-install multiples packages with the + # same name but different version on RHEL without upgrading theme, + # one has to add in package section: + # Provides: installonlypkg(kernel-module) cat <= %{?epoch:%{epoch}:}%{version} Requires(post): %{?_prefix_usr}/sbin/weak-modules From b578b49e0ad1aeb93f672e83f93085920aa08d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 21:40:04 +0200 Subject: [PATCH 27/51] Convert if statement from "[!] $variable" to "[!] -n $variable" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index fa14bd0..728654c 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -80,7 +80,7 @@ Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} EOF - if [[ ${obsolete_name} ]] ; then + if [[ -n "${obsolete_name}" ]] ; then echo "Provides: akmod-${obsolete_name} = ${obsolete_version}" echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}" fi @@ -116,7 +116,7 @@ Provides: kmod-${kmodname}-PAE = %{?epoch:%{epoch}:}%{version}-%{release Requires: akmod-${kmodname} = %{?epoch:%{epoch}:}%{version}-%{release} EOF - if [[ ${obsolete_name} ]] ; then + if [[ -n "${obsolete_name}" ]] ; then echo "Provides: kmod-${obsolete_name} = ${obsolete_version}" echo "Obsoletes: kmod-${obsolete_name} < ${obsolete_version}" fi @@ -188,14 +188,14 @@ Requires(postun): %{?_prefix_usr}/sbin/depmod %endif EOF - if [[ ${obsolete_name} ]] ; then + if [[ -n "${obsolete_name}" ]] ; then echo echo "Provides: kmod-${obsolete_name}-${kernel_uname_r} = ${obsolete_version}" echo "Obsoletes: kmod-${obsolete_name}-${kernel_uname_r} < ${obsolete_version}" fi # second part - if [[ ! "${customkernel}" ]] ; then + if [[ ! -n "${customkernel}" ]] ; then ## Build some interesting strings with kernel uname -r ## Examples: ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 @@ -322,7 +322,7 @@ Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} Requires: kmod-${kmodname}-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release} EOF - if [[ ${obsolete_name} ]] ; then + if [[ -n "${obsolete_name}" ]] ; then echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}" echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}" fi @@ -410,7 +410,7 @@ while [ "${1}" ] ; do case "${1}" in --filterfile) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide path to a filter-file together with --filterfile" >&2 elif [[ ! -e "${1}" ]] ; then error_out 2 "Filterfile ${1} not found" >&2 @@ -420,7 +420,7 @@ while [ "${1}" ] ; do ;; --kmodname) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide the name of the kmod together with --kmodname" >&2 fi # strip pending -kmod @@ -429,7 +429,7 @@ while [ "${1}" ] ; do ;; --repo) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide the name of the repo together with --repo" >&2 fi repo=${1} @@ -437,7 +437,7 @@ while [ "${1}" ] ; do ;; --for-kernels) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide the name of the kmod together with --kmodname" >&2 fi for_kernels="${1}" @@ -449,7 +449,7 @@ while [ "${1}" ] ; do ;; --obsolete-name) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide the name of the kmod to obsolte together with --obsolete-name" >&2 fi obsolete_name="${1}" @@ -457,7 +457,7 @@ while [ "${1}" ] ; do ;; --obsolete-version) shift - if [[ ! "${1}" ]] ; then + if [[ ! -n "${1}" ]] ; then error_out 2 "Please provide the version of the kmod to obsolte together with --obsolete-version" >&2 fi obsolete_version="${1}" @@ -509,18 +509,18 @@ else fi # general sanity checks -if [[ ! "${target}" ]] ; then +if [[ ! -n "${target}" ]] ; then error_out 2 "please pass target arch with --target" -elif [[ ! "${kmodname}" ]] ; then +elif [[ ! -n "${kmodname}" ]] ; then error_out 2 "please pass kmodname with --kmodname" -elif [[ ! "${kernels_known_variants}" ]] ; then +elif [[ ! -n "${kernels_known_variants}" ]] ; then error_out 2 "could not determine known variants" -elif ( [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]] ) || ( [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]] ) ; then +elif ( [[ -n "${obsolete_name}" ]] && [[ ! -n "${obsolete_version}" ]] ) || ( [[ ! -n "${obsolete_name}" ]] && [[ -n "${obsolete_version}" ]] ) ; then error_out 2 "you need to provide both --obsolete-name and --obsolete-version" fi # go -if [[ "${for_kernels}" ]] ; then +if [[ -n "${for_kernels}" ]] ; then # this is easy: print_customrpmtemplate "${for_kernels}" elif [[ "${build_kernels}" == "akmod" ]] ; then @@ -531,7 +531,7 @@ else # seems we are on out own to decide for which kernels to build # we need more sanity checks in this case - if [[ ! "${repo}" ]] ; then + if [[ ! -n "${repo}" ]] ; then error_out 2 "please provide repo name with --repo" elif ! $(which buildsys-build-${repo}-kerneldevpkgs &> /dev/null) ; then error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found" @@ -541,7 +541,7 @@ else cmdoptions="--target ${target}" # filterfile to filter list of kernels? - if [[ "${filterfile}" ]] ; then + if [[ -n "${filterfile}" ]] ; then cmdoptions="${cmdoptions} --filterfile ${filterfile}" fi @@ -551,7 +551,7 @@ else error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})" fi - if [[ "${build_kernels}" == "current" ]] && [[ ! "${noakmod}" ]] ; then + if [[ "${build_kernels}" == "current" ]] && [[ ! -n "${noakmod}" ]] ; then print_akmodtemplate fi From c843631516f0d20e0ce50f9dc46535d40571c6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 21:44:28 +0200 Subject: [PATCH 28/51] Remove unused variables and code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 9 ++++----- kmodtool.spec | 4 ---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 728654c..7711719 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -35,7 +35,6 @@ build_kernels="current" kernels_known_variants= kernel_versions= kernel_versions_to_build_for= -prefix= filterfile= target= @@ -107,7 +106,7 @@ print_akmodmeta () cat < Date: Wed, 16 Oct 2019 22:19:27 +0200 Subject: [PATCH 29/51] Force remove temporary file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 7711719..a3be03a 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -238,7 +238,7 @@ rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep %{_kmodtool_depmod_post} modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) -rm /var/run/rpm-kmod-${kmodname}-modules +rm -f /var/run/rpm-kmod-${kmodname}-modules printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules %else Requires: kernel-uname-r = ${kernel_uname_r} @@ -272,7 +272,7 @@ fi if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) - rm /var/run/rpm-kmod-${kmodname}-modules + rm -f /var/run/rpm-kmod-${kmodname}-modules printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules fi %else From 83f7c9f62321f2a1e6f3f4e7ef34703d123c95d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 22:29:21 +0200 Subject: [PATCH 30/51] Remove grep pipe after find command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index a3be03a..3e561a0 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -228,7 +228,7 @@ BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config ker %post -n kmod-${kmodname}-${kernel_uname_r} %{_kmodtool_depmod_post} -modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) +modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules %preun -n kmod-${kmodname}-${kernel_uname_r} @@ -258,7 +258,7 @@ EOF [[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') ) + modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules fi From 4852d351abeb85341ec90af552ff7e9cb0fce4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 23:01:07 +0200 Subject: [PATCH 31/51] Standardize globally kmod package names macros and kernel_uname_r variables in order to ease the build of kmod packages for non-default distribution (Fedora), for example for RHEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 272 +++++++++++++++++++++++++++------------------- 1 file changed, 163 insertions(+), 109 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 3e561a0..36cd599 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -38,6 +38,16 @@ kernel_versions_to_build_for= filterfile= target= +kernel_uname_r="" +kernel_uname_r_vanilla="" +kernel_uname_r_short="" +kernel_uname_r_wo_arch="" +kernel_uname_r_dist="" +kernel_uname_r_rel="" +kernel_uname_r_rel_plus_one="" +kernel_uname_r_short_plus_one="" +kernel_uname_r_rel_minor="" + error_out() { local errorlevel=${1} @@ -57,6 +67,84 @@ print_rpmtemplate_header() echo } +init_kernel_uname_r_vars() +{ + ## Build some interesting strings with kernel uname -r + ## Examples: + ## - Fedora and rhel: + ## kernel_uname_r 3.10.0-693.2.2.el7.x86_64 + ## kernel_uname_r_vanilla 3.10.0 + ## kernel_uname_r_short 3.10.0-693.el7 + ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 + ## kernel_uname_r_dist el7 + ## kernel_uname_r_rel 693 + ## kernel_uname_r_rel_plus_one 694 + ## kernel_uname_r_short_plus_one 3.10.0-694.el7 + ## kernel_uname_r_rel_minor 2.2 + ## + kernel_uname_r=${1} + kernel_uname_r_vanilla=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\([[:alnum:]\.]\+\|\)-\(.*\)/\1/p") + kernel_uname_r_short=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/p") + kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") + kernel_uname_r_dist=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//p") + kernel_uname_r_rel=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(.*\)/\2/" -e "s/^\.//" -e "s/[\.\-]$//p") + if $(echo "${kernel_uname_r_rel}" | grep -qE '^[0-9]+$') ; then + kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 )) + else + kernel_uname_r_rel_plus_one="" + fi + kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./") + kernel_uname_r_rel_minor=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//p") +} + +print_rpmtemplate_macros() +{ + # Defines package names macros depending on distributions (default + # is Fedora): + # - rhel_kabi is set if building for RHEL + # - kmod_pkg_name and pkg_kmod_name are the two possible forms of + # the package name used when building packages modules. First one + # uses kmod as prefix, the second one uses kmod as suffix. These + # macros allow to modify the naming schema regarding the target + # distribution (for example with suffix and prefix different from + # kmod). + # - kmod_obsolete_name same as kmod_pkg_name and pkg_kmod_name but + # for obsolete package name + # + if [[ -n ${obsolete_name} ]] ; then + echo '%global obsolete_name '${obsolete_name} + fi + cat <= %{?epoch:%{epoch}:}%{version} -Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: %{pkg_kmod_name}-common >= %{?epoch:%{epoch}:}%{version} +Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} EOF if [[ -n "${obsolete_name}" ]] ; then @@ -93,7 +181,7 @@ This package provides the akmod package for the ${kmodname} kernel modules. nohup /usr/sbin/akmods --from-akmod-posttrans --akmod ${kmodname} &> /dev/null & %post -n akmod-${kmodname} -[ -x /usr/sbin/akmods-ostree-post ] && /usr/sbin/akmods-ostree-post ${kmodname} %{_usrsrc}/akmods/${kmodname}-kmod-%{version}-%{release}.src.rpm +[ -x /usr/sbin/akmods-ostree-post ] && /usr/sbin/akmods-ostree-post ${kmodname} %{_usrsrc}/akmods/%{pkg_kmod_name}-%{version}-%{release}.src.rpm %files -n akmod-${kmodname} %defattr(-,root,root,-) @@ -105,28 +193,28 @@ print_akmodmeta () { cat <= %{?epoch:%{epoch}:}%{version} +%endif +Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: %{pkg_kmod_name}-common >= %{?epoch:%{epoch}:}%{version} +Requires(post): %{?_prefix_usr}/sbin/depmod +Requires(postun): %{?_prefix_usr}/sbin/depmod +%if %{with rhel_kabi} Requires(post): %{?_prefix_usr}/sbin/weak-modules -Requires(post): %{?_prefix_usr}/sbin/depmod Requires(postun): %{?_prefix_usr}/sbin/weak-modules -Requires(postun): %{?_prefix_usr}/sbin/depmod -%else -%package -n kmod-${kmodname}-${kernel_uname_r} -Summary: ${kmodname} kernel module(s) for ${kernel_uname_r} -Provides: kernel-modules-for-kernel = ${kernel_uname_r} -Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} -Requires(post): %{?_prefix_usr}/sbin/depmod -Requires(postun): %{?_prefix_usr}/sbin/depmod %endif EOF if [[ -n "${obsolete_name}" ]] ; then echo - echo "Provides: kmod-${obsolete_name}-${kernel_uname_r} = ${obsolete_version}" - echo "Obsoletes: kmod-${obsolete_name}-${kernel_uname_r} < ${obsolete_version}" + echo "Provides: %{kmod_obsolete_name}-${kernel_uname_r} = ${obsolete_version}" + echo "Obsoletes: %{kmod_obsolete_name}-${kernel_uname_r} < ${obsolete_version}" fi # second part if [[ ! -n "${customkernel}" ]] ; then - ## Build some interesting strings with kernel uname -r - ## Examples: - ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 - ## kernel_uname_r_dist el7 - ## kernel_uname_r_rel 693 - ## kernel_uname_r_rel_plus_one 694 - ## kernel_uname_r_short_plus_one 3.10.0-694.el7 - ## kernel_uname_r_rel_minor 2.2 - local kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") - local kernel_uname_r_dist=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//") - local kernel_uname_r_rel=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\2/" -e "s/^\.//") - local kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 )) - local kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./") - local kernel_uname_r_rel_minor=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//") - cat </dev/null ; \\\ fi || : -%if 0%{?rhel} +%if %{with rhel_kabi} Requires: kernel >= ${kernel_uname_r_short} Requires: kernel < ${kernel_uname_r_short_plus_one} BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config kernel-abi-whitelists - -%post -n kmod-${kmodname}-${kernel_uname_r} -%{_kmodtool_depmod_post} - -modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) -printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules - -%preun -n kmod-${kmodname}-${kernel_uname_r} -rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules - -%postun -n kmod-${kmodname}-${kernel_uname_r} -%{_kmodtool_depmod_post} - -modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) -rm -f /var/run/rpm-kmod-${kmodname}-modules -printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules %else Requires: kernel-uname-r = ${kernel_uname_r} BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} BuildRequires: gcc -%post -n kmod-${kmodname}-${kernel_uname_r} +%endif + +%post -n %{package_kmod_name} %{_kmodtool_depmod_post} -%postun -n kmod-${kmodname}-${kernel_uname_r} + +%if %{with rhel_kabi} +modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) +printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules +%endif + +%if %{with rhel_kabi} +%preun -n %{package_kmod_name} +rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-%{package_kmod_name}-modules +%endif + +%postun -n %{package_kmod_name} %{_kmodtool_depmod_post} + +%if %{with rhel_kabi} +modules=( \$(cat /var/run/rpm-%{package_kmod_name}-modules) ) +rm -f /var/run/rpm-%{package_kmod_name}-modules +printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules %endif EOF else cat < /dev/null || : +%if %{with rhel_kabi} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules fi +%endif -%preun -n kmod-${kmodname}-${kernel_uname_r} +%if %{with rhel_kabi} +%preun -n %{package_kmod_name} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - rpm -ql kmod-${kmodname}-${kernel_uname_r}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules + rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-%{package_kmod_name}-modules fi +%endif -%postun -n kmod-${kmodname}-${kernel_uname_r} +%postun -n %{package_kmod_name} [[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : +%if %{with rhel_kabi} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) ) - rm -f /var/run/rpm-kmod-${kmodname}-modules + modules=( \$(cat /var/run/rpm-%{package_kmod_name}-modules) ) + rm -f /var/run/rpm-%{package_kmod_name}-modules printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules fi -%else -%post -n kmod-${kmodname}-${kernel_uname_r} -[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : -%postun -n kmod-${kmodname}-${kernel_uname_r} -[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || : %endif EOF fi @@ -287,53 +348,42 @@ EOF # third part cat <= %{?epoch:%{epoch}:}%{version}-%{release} +Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: %{package_kmod_name} >= %{?epoch:%{epoch}:}%{version}-%{release} EOF if [[ -n "${obsolete_name}" ]] ; then - echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}" - echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}" + echo "Provides: %{kmod_obsolete_name}${kernel_variant} = ${obsolete_version}" + echo "Obsoletes: %{kmod_obsolete_name}${kernel_variant} < ${obsolete_version}" fi cat < Date: Wed, 16 Oct 2019 23:04:16 +0200 Subject: [PATCH 32/51] Try to fix: check if uname from Makefile is the same as kernel variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 36cd599..832ba57 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -402,14 +402,24 @@ print_customrpmtemplate () local kernel_verrelarch=${kernel%%${kernels_known_variants}} print_rpmtemplate_macros_pkg_name_version "${kernel}" print_rpmtemplate_per_kmodpkg --redhat ${kernel##${kernel_verrelarch}} - elif [[ -e "${usr_lib_modules}"/"${kernel}"/build/Makefile ]] ; then + elif [[ -e "${usr_lib_modules}"/"${kernel}"/source/Makefile ]] ; then # likely a user-build-kernel with available buildfiles - # fixme: we should check if uname from Makefile is the same as ${kernel} - - kernel_versions="${kernel_versions}${kernel}___${usr_lib_modules}/${kernel}/build/ " - print_rpmtemplate_per_kmodpkg --custom "${kernel}" + # check if uname from Makefile is the same as ${kernel} + KMF_VERSION="$(grep -m1 -e "^VERSION = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')" + KMF_PATCHLEVEL="$(grep -m1 -e "^PATCHLEVEL = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')" + KMF_SUBLEVEL="$(grep -m1 -e "^SUBLEVEL = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')" + KMF_EXTRAVERSION="$(grep -m1 -e "^EXTRAVERSION = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')" + # Bundled bonus + #KMF_NAME="$(grep -m1 -e "^NAME = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')" + if [[ "${KMF_VERSION}.${KMF_PATCHLEVEL}.${KMF_SUBLEVEL}${KMF_EXTRAVERSION}" == "${kernel}" ]] ; then + kernel_versions="${kernel_versions}${kernel}___${usr_lib_modules}/${kernel}/source/ " + print_rpmtemplate_macros_pkg_name_version "${kernel}" + print_rpmtemplate_per_kmodpkg --custom + else + error_out 2 "Kernel uname from ${usr_lib_modules}/${kernel}/source/Makefile doesn't match ${kernel} from --for-kernels argument." + fi else - error_out 2 "Don't know how to handle ${kernel} -- ${usr_lib_modules}/${kernel}/build/Makefile not found" + error_out 2 "Don't know how to handle ${kernel} -- ${usr_lib_modules}/${kernel}/source/Makefile not found" fi done From 67c73b2cf8c79acf5d9e74e0924724761e5faa29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Wed, 16 Oct 2019 23:09:22 +0200 Subject: [PATCH 33/51] Update SPEC file and changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool.spec | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 4e07cc3..1c6c705 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -1,6 +1,6 @@ Name: kmodtool Version: 1 -Release: 43%{?dist} +Release: 44%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -36,6 +36,18 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/kernel-variants %changelog +* Fri Oct 22 2021 Nicolas Viéville - 1-44 +- Fix indentation +- Add installonlypkg(kernel-module) to allow kmod packages co-install (RHEL) +- Convert if statement from "[!] $variable" to "[!] -n $variable" +- Remove unused variables and code +- Force remove temporary file +- Remove grep pipe after find command +- Standardize globally kmod package names macros and kernel_uname_r + variables in order to ease the build of kmod packages for non-default + distribution (Fedora), for example for RHEL +- Try to fix: check if uname from Makefile is the same as kernel variable + * Thu Jul 22 2021 Fedora Release Engineering - 1-43 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 1900f33c17ff4bc1011be4279ff13a7eb6a046b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Fri, 18 Oct 2019 20:05:11 +0200 Subject: [PATCH 34/51] Add signing and zipping modules methods for Fedora and RHEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-brp-kmodsign | 45 +++++++++++++++++ kmodtool-kmodtool | 34 +++++++++++-- kmodtool.spec | 25 +++++++-- macros.kmodtool | 114 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 209 insertions(+), 9 deletions(-) create mode 100644 kmodtool-brp-kmodsign create mode 100644 macros.kmodtool diff --git a/kmodtool-brp-kmodsign b/kmodtool-brp-kmodsign new file mode 100644 index 0000000..437633e --- /dev/null +++ b/kmodtool-brp-kmodsign @@ -0,0 +1,45 @@ +#! /bin/bash + +# The modules_sign target checks for corresponding .o files for every .ko that +# is signed. This doesn't work for package builds which re-use the same build +# directory for every flavour, and the .config may change between flavours. +# So instead of using this script to just sign lib/modules/$KernelVer/extra, +# sign all .ko in the buildroot. + +# This essentially duplicates the 'modules_sign' Kbuild target and runs the +# same commands for those modules. + +MODSECKEY="$1" +MODPUBKEY="$2" +KERNELSRCDIR="$4" + +MOD_DIR="$3" +SCRIPTS_SIGN_BIN="scripts/sign-file" + +if [ -z "${MODSECKEY}" ] || [ -z "${MODPUBKEY}" ] || [ -z "${MOD_DIR}" ] ; then + echo "brp-kmodsign: missing parameters" + exit 1 +fi +if [ -z "${KERNELSRCDIR}" ] ; then + KERNELSRCDIR="." +fi +if [ ! -x "${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN}" ] ; then + echo "brp-kmodsign: ${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN} not found or not executable" + exit 1 +fi + +MODULES=$(find "${MOD_DIR}" -name "*.ko") + +for MOD in ${MODULES} +do + "${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN}" sha256 "${MODSECKEY}" "${MODPUBKEY}" "${MOD}" + rm -f "${MOD}".{sig,dig} +done + +RANDOMMOD=$(find "${MOD_DIR}" -type f -name "*.ko" | sort -R | head -n 1) +if [ "~Module signature appended~" != "$(tail -c 28 ${RANDOMMOD})" ] ; then + echo "brp-kmodsign: modules are unsigned!" + exit 1 +fi + +exit 0 diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 832ba57..ac9b47f 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -294,13 +294,13 @@ BuildRequires: gcc %{_kmodtool_depmod_post} %if %{with rhel_kabi} -modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) +modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko" -o -name "*.ko.xz") ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules %endif %if %{with rhel_kabi} %preun -n %{package_kmod_name} -rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-%{package_kmod_name}-modules +rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' -e '\.ko.xz$' > /var/run/rpm-%{package_kmod_name}-modules %endif %postun -n %{package_kmod_name} @@ -320,7 +320,7 @@ EOF %if %{with rhel_kabi} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko") ) + modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko" -o -name "*.ko.xz") ) printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules fi %endif @@ -328,7 +328,7 @@ fi %if %{with rhel_kabi} %preun -n %{package_kmod_name} if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then - rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-%{package_kmod_name}-modules + rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' -e '\.ko.xz$' > /var/run/rpm-%{package_kmod_name}-modules fi %endif @@ -355,6 +355,32 @@ kernel %{kmod_for_kernel} for the %{_target_cpu} family of processors. %defattr(644,root,root,755) %dir ${usr_lib_modules}/${kernel_uname_r}/extra ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ +EOF + + ## Set global macros and update global __spec_install_post macro to + ## take in account signing and zipping macros provided in + ## /etc/rpm/macros.kmodtool file. + ## The global __spec_install_post macro is set per package build and + ## is not included in the global /etc/rpm/macros.kmodtool file to + ## avoid unwanted effects on other packages builds. + ## For further explanations see comments included in + ## /etc/rpm/macros.kmodtool file. + +# Comment from Fedora kernel.spec about this hack. FIXME candidate. +# +# Disgusting hack alert! We need to ensure we sign modules *after* all +# invocations of strip occur, which is in __debug_install_post if +# find-debuginfo.sh runs, and __os_install_post if not. +# + cat < - 1.1-1 +- Add signing module method to use with UEFI Secure Boot machines thanks + to Stanislas Leduc (#1454824) (reworked method) +- Add as well zipping module method and support for it in Fedora and RHEL + * Fri Oct 22 2021 Nicolas Viéville - 1-44 - Fix indentation - Add installonlypkg(kernel-module) to allow kmod packages co-install (RHEL) diff --git a/macros.kmodtool b/macros.kmodtool new file mode 100644 index 0000000..9dedd27 --- /dev/null +++ b/macros.kmodtool @@ -0,0 +1,114 @@ +# /etc/rpm/macros.kmodtool: kmodtool keypair sign and zip config. +# +# This file controls signing and zipping modules on the system, included +# akmods ones. +# It uses the rpm macros syntax to define global symbol imported +# directly by kmodtool while rebuilding kmods. +# +# Signing modules +# +# __kmodtool_signmodules can take one of these two values: +# 1 - Modules would be signed when rebuilding modules. +# 0 - No signed modules when rebuilding modules. +# __kmodtool_signmodules_pubkey gives path and name of the public key to +# be used to sign newly build modules. +# __kmodtool_signmodules_privkey gives path and name of the private key to +# be used to sign newly build modules. +# +# __kmodtool_signmodules* macros can be overriden by users and/or +# packagers provided that those values and their dependencies are +# manually checked. Be carefull when modifying these values. To override +# these macros please define these ones in your spec file (one +# underscore as prefix and not two): +# - _kmodtool_signmodules +# - _kmodtool_signmodules_pubkey +# - _kmodtool_signmodules_privkey +# It is also possible to uncomment one or several of the macros provided +# below: +#%%_kmodtool_signmodules 0 +#%%_kmodtool_signmodules 1 +#%%_kmodtool_signmodules_pubkey /path/to/your/public_key.der +#%%_kmodtool_signmodules_privkey /path/to/your/private_key.der +# +# Signing modules is enabled in Fedora kernels for every arches, +# even if kernels are not signed for arches other than +# %%{ix86} x86_64 aarch64. +# +# Sign modules on x86. Make sure the config files match this setting if +# more architectures are added. +%__kmodtool_signmodules %{?_kmodtool_signmodules:%{_kmodtool_signmodules}}%{!?_kmodtool_signmodules:1} + +# This is current keypair enrolled in MOK to sign modules +%__kmodtool_signmodules_pubkey %{?_kmodtool_signmodules_pubkey:%{_kmodtool_signmodules_pubkey}}%{!?_kmodtool_signmodules_pubkey:/etc/pki/akmods/certs/public_key.der} +%__kmodtool_signmodules_privkey %{?_kmodtool_signmodules_privkey:%{_kmodtool_signmodules_privkey}}%{!?_kmodtool_signmodules_privkey:/etc/pki/akmods/private/private_key.priv} + +# Define signing macros +# +%__kmodtool_modsign_cmd %{_rpmconfigdir}/brp-kmodsign +%__kmodtool_modsign_install_post \ +if [ "%{__kmodtool_signmodules}" -eq "1" ] && [ -x %{__kmodtool_modsign_cmd} ] && [ -e %{__kmodtool_signmodules_privkey} ] && [ -e %{__kmodtool_signmodules_pubkey} ] ; then\ + %{__kmodtool_modsign_cmd} %{__kmodtool_signmodules_privkey} %{__kmodtool_signmodules_pubkey} %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} /usr/src/kernels/%{__kmodtool_kernel_uname_r}\ +fi\ +%{nil} + +# Zipping modules +# +# __kmodtool_zipmodules can take one of these two values: +# 1 - Modules would be zipped when rebuilding modules. +# 0 - No zipped modules when rebuilding modules. +# +# __kmodtool_zipmodules* macros can be overriden by users and/or packagers +# provided that those values and their dependencies are manually +# checked. Be carefull when modifying these values. To override these +# macros please define these ones in your spec file (one underscore as +# prefix and not two): +# - _kmodtool_zipmodules +# It is also possible to uncomment one of the macros provided below: +#%%_kmodtool_zipmodules 0 +#%%_kmodtool_zipmodules 1 +# +# Zipping modules according to Fedora kernels sources is enabled only +# for arches %%{ix86} x86_64 aarch64. For information zipping kernel +# modules is available since rhel 7.x and fedora 21. +# Settings below conform to this directives. +# +# Zip modules on x86 x86_64 aarch64. Make sure the config files match +# this setting if more architectures are added. +%__kmodtool_zipmodules_arch_ok %( +echo %{ix86} x86_64 aarch64 | grep -qwo %{_arch} +if [ $? -eq 0 ] ; then + echo 1 +else + echo 0 +fi +) + +# Distributions where zipping is enabled by default +%__kmodtool_zipmodules_dist_ok %( +if (( %{?rhel} + 0 > 6 || %{?fedora} + 0 > 20 )) ; then + echo 1 +else + echo 0 +fi +) + +# Put arches and distributions conditions together +%__kmodtool_zipmodules_ok %( +if (( %{?__kmodtool_zipmodules_arch_ok} && %{?__kmodtool_zipmodules_dist_ok} )) ; then + echo 1 +else + echo 0 +fi +) + +# Put them all in place +%__kmodtool_zipmodules %{?_kmodtool_zipmodules:%{_kmodtool_zipmodules}}%{!?_kmodtool_zipmodules:%{?__kmodtool_zipmodules_ok}} + + +# Define zipping macros +# +%__kmodtool_modzip_install_post\ +if [ "%{__kmodtool_zipmodules}" -eq "1" ] ; then\ + find %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} -type f -name '*.ko' | xargs xz;\ +fi\ +%{nil} From 703b25c113d326409fdfa0557f5df9520951b6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Thu, 2 Dec 2021 20:52:53 +0100 Subject: [PATCH 35/51] Take care of OpenSuse distribution in kmodtool-kmodtool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index ac9b47f..b2040d8 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -41,6 +41,7 @@ target= kernel_uname_r="" kernel_uname_r_vanilla="" kernel_uname_r_short="" +kernel_uname_r_flavor="" kernel_uname_r_wo_arch="" kernel_uname_r_dist="" kernel_uname_r_rel="" @@ -75,16 +76,29 @@ init_kernel_uname_r_vars() ## kernel_uname_r 3.10.0-693.2.2.el7.x86_64 ## kernel_uname_r_vanilla 3.10.0 ## kernel_uname_r_short 3.10.0-693.el7 + ## kernel_uname_r_flavor ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 ## kernel_uname_r_dist el7 ## kernel_uname_r_rel 693 ## kernel_uname_r_rel_plus_one 694 ## kernel_uname_r_short_plus_one 3.10.0-694.el7 ## kernel_uname_r_rel_minor 2.2 + ## - Suse like: + ## kernel_uname_r 4.4.114-92.64-default.x86_64 + ## kernel_uname_r_vanilla 4.4.114 + ## kernel_uname_r_short + ## kernel_uname_r_flavor default + ## kernel_uname_r_wo_arch 4.4.114-92.64-default + ## kernel_uname_r_dist + ## kernel_uname_r_rel 92.64 + ## kernel_uname_r_rel_plus_one + ## kernel_uname_r_short_plus_one + ## kernel_uname_r_rel_minor ## kernel_uname_r=${1} kernel_uname_r_vanilla=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\([[:alnum:]\.]\+\|\)-\(.*\)/\1/p") kernel_uname_r_short=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/p") + kernel_uname_r_flavor=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)\(-\)\([[:alpha:]]*$\)/\3/p") kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") kernel_uname_r_dist=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//p") kernel_uname_r_rel=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(.*\)/\2/" -e "s/^\.//" -e "s/[\.\-]$//p") @@ -102,6 +116,7 @@ print_rpmtemplate_macros() # Defines package names macros depending on distributions (default # is Fedora): # - rhel_kabi is set if building for RHEL + # - suse_kabi is set if building for *Suse* # - kmod_pkg_name and pkg_kmod_name are the two possible forms of # the package name used when building packages modules. First one # uses kmod as prefix, the second one uses kmod as suffix. These @@ -117,12 +132,18 @@ print_rpmtemplate_macros() cat <&2 fi - # strip pending -kmod - kmodname="${1%%-kmod}" + # strip pending -kmod and -kmp + kmodname=$(echo "${1}"| sed -e "s/-kmod$//" -e "s/-kmp$//") shift ;; --repo) From 9beff26501945e86dc564713378ea392aca48d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= Date: Mon, 20 Dec 2021 13:37:36 +0100 Subject: [PATCH 36/51] Fix Take care of OpenSuse distribution in kmodtool-kmodtool rhbz#2034193 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Viéville --- kmodtool-kmodtool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index b2040d8..7cf154a 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -139,7 +139,7 @@ print_rpmtemplate_macros() %global pkg_kmod_name ${kmodname}-kmod %{?obsolete_name:%global kmod_obsolete_name kmod-%{obsolete_name}} %endif -%if %{?suse_version} +%if 0%{?suse_version} %global kmod_pkg_name ${kmodname}-kmp %global pkg_kmod_name ${kmodname}-kmp %{?obsolete_name:%global kmod_obsolete_name %{obsolete_name}-kmp} @@ -165,7 +165,7 @@ print_rpmtemplate_macros_pkg_name_version() %global kmod_for_kernel %{?with_rhel_kabi:${kernel_uname_r_short}}%{!?with_rhel_kabi:${kernel_uname_r}} %global package_kmod_name %{kmod_pkg_name}-%{kmod_for_kernel} %endif -%if %{?suse_version} +%if 0%{?suse_version} %global kmod_for_kernel ${kernel_uname_r_wo_arch} %global kmod_pkg_version %{version}_k${kernel_uname_r_vanilla} %global package_kmod_name %{kmod_pkg_name}-${kernel_uname_r_flavor} From 72fc032594d58641e7c6579ef7f344e550db5b7a Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 20 Dec 2021 15:36:42 +0100 Subject: [PATCH 37/51] Revert "Fix Take care of OpenSuse distribution in kmodtool-kmodtool rhbz#2034193" This reverts commit 9beff26501945e86dc564713378ea392aca48d45. --- kmodtool-kmodtool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index 7cf154a..b2040d8 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -139,7 +139,7 @@ print_rpmtemplate_macros() %global pkg_kmod_name ${kmodname}-kmod %{?obsolete_name:%global kmod_obsolete_name kmod-%{obsolete_name}} %endif -%if 0%{?suse_version} +%if %{?suse_version} %global kmod_pkg_name ${kmodname}-kmp %global pkg_kmod_name ${kmodname}-kmp %{?obsolete_name:%global kmod_obsolete_name %{obsolete_name}-kmp} @@ -165,7 +165,7 @@ print_rpmtemplate_macros_pkg_name_version() %global kmod_for_kernel %{?with_rhel_kabi:${kernel_uname_r_short}}%{!?with_rhel_kabi:${kernel_uname_r}} %global package_kmod_name %{kmod_pkg_name}-%{kmod_for_kernel} %endif -%if 0%{?suse_version} +%if %{?suse_version} %global kmod_for_kernel ${kernel_uname_r_wo_arch} %global kmod_pkg_version %{version}_k${kernel_uname_r_vanilla} %global package_kmod_name %{kmod_pkg_name}-${kernel_uname_r_flavor} From 93cf8a667b1eef5bf25e68eba4e8253c068e52b9 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 20 Dec 2021 15:36:49 +0100 Subject: [PATCH 38/51] Revert "Take care of OpenSuse distribution in kmodtool-kmodtool" This reverts commit 703b25c113d326409fdfa0557f5df9520951b6c3. --- kmodtool-kmodtool | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index b2040d8..ac9b47f 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -41,7 +41,6 @@ target= kernel_uname_r="" kernel_uname_r_vanilla="" kernel_uname_r_short="" -kernel_uname_r_flavor="" kernel_uname_r_wo_arch="" kernel_uname_r_dist="" kernel_uname_r_rel="" @@ -76,29 +75,16 @@ init_kernel_uname_r_vars() ## kernel_uname_r 3.10.0-693.2.2.el7.x86_64 ## kernel_uname_r_vanilla 3.10.0 ## kernel_uname_r_short 3.10.0-693.el7 - ## kernel_uname_r_flavor ## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7 ## kernel_uname_r_dist el7 ## kernel_uname_r_rel 693 ## kernel_uname_r_rel_plus_one 694 ## kernel_uname_r_short_plus_one 3.10.0-694.el7 ## kernel_uname_r_rel_minor 2.2 - ## - Suse like: - ## kernel_uname_r 4.4.114-92.64-default.x86_64 - ## kernel_uname_r_vanilla 4.4.114 - ## kernel_uname_r_short - ## kernel_uname_r_flavor default - ## kernel_uname_r_wo_arch 4.4.114-92.64-default - ## kernel_uname_r_dist - ## kernel_uname_r_rel 92.64 - ## kernel_uname_r_rel_plus_one - ## kernel_uname_r_short_plus_one - ## kernel_uname_r_rel_minor ## kernel_uname_r=${1} kernel_uname_r_vanilla=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\([[:alnum:]\.]\+\|\)-\(.*\)/\1/p") kernel_uname_r_short=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/p") - kernel_uname_r_flavor=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)\(-\)\([[:alpha:]]*$\)/\3/p") kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//") kernel_uname_r_dist=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//p") kernel_uname_r_rel=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(.*\)/\2/" -e "s/^\.//" -e "s/[\.\-]$//p") @@ -116,7 +102,6 @@ print_rpmtemplate_macros() # Defines package names macros depending on distributions (default # is Fedora): # - rhel_kabi is set if building for RHEL - # - suse_kabi is set if building for *Suse* # - kmod_pkg_name and pkg_kmod_name are the two possible forms of # the package name used when building packages modules. First one # uses kmod as prefix, the second one uses kmod as suffix. These @@ -132,18 +117,12 @@ print_rpmtemplate_macros() cat <&2 fi - # strip pending -kmod and -kmp - kmodname=$(echo "${1}"| sed -e "s/-kmod$//" -e "s/-kmp$//") + # strip pending -kmod + kmodname="${1%%-kmod}" shift ;; --repo) From b7b636d9c62a597b7ad1258bebe15be5ce364c70 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 20 Dec 2021 15:38:24 +0100 Subject: [PATCH 39/51] Update changelog --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 55dea33..8a90a3c 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Mon Dec 20 2021 Nicolas Chauvet - 1.1-2 +- Revert suse commit in kmodtool + * Fri Oct 22 2021 Nicolas Viéville - 1.1-1 - Add signing module method to use with UEFI Secure Boot machines thanks to Stanislas Leduc (#1454824) (reworked method) From 2220f8d290984a8793a0aef98d88de5c88ca251b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 15:00:40 +0000 Subject: [PATCH 40/51] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 8a90a3c..1bc5cce 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 1.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Mon Dec 20 2021 Nicolas Chauvet - 1.1-2 - Revert suse commit in kmodtool From 138b7e74e683f6b354883f9fc9f0aeca76826fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 3 Apr 2022 07:34:59 +0100 Subject: [PATCH 41/51] kernel-abi-whitelists is not needed and break builds on el9 --- kmodtool-kmodtool | 2 +- kmodtool.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index ac9b47f..de659e1 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -283,7 +283,7 @@ fi || : %if %{with rhel_kabi} Requires: kernel >= ${kernel_uname_r_short} Requires: kernel < ${kernel_uname_r_short_plus_one} -BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config kernel-abi-whitelists +BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config %else Requires: kernel-uname-r = ${kernel_uname_r} BuildRequires: kernel-devel-uname-r = ${kernel_uname_r} diff --git a/kmodtool.spec b/kmodtool.spec index 1bc5cce..97219ac 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Sun Apr 03 2022 Sérgio Basto - 1.1-4 +- kernel-abi-whitelists is not needed and break builds on el9 + * Thu Jan 20 2022 Fedora Release Engineering - 1.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 7f1eac8d7a2b1cb210c5a0b3f44dfc1cffc234c5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 16:27:31 +0000 Subject: [PATCH 42/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 97219ac..ca6d2ec 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 1.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Sun Apr 03 2022 Sérgio Basto - 1.1-4 - kernel-abi-whitelists is not needed and break builds on el9 From 2de108424109b60034b7fb45e7f8faf6dd5879c0 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Thu, 12 Jan 2023 01:28:22 -0500 Subject: [PATCH 43/51] Fix usage output on unrecognized argument --- kmodtool-kmodtool | 2 +- kmodtool.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kmodtool-kmodtool b/kmodtool-kmodtool index de659e1..4a93e35 100644 --- a/kmodtool-kmodtool +++ b/kmodtool-kmodtool @@ -578,7 +578,7 @@ while [ "${1}" ] ; do ;; *) echo "Error: Unknown option '${1}'." >&2 - usage >&2 + myprog_help >&2 exit 2 ;; esac diff --git a/kmodtool.spec b/kmodtool.spec index ca6d2ec..9ea6ac7 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jan 12 2023 FeRD (Frank Dana) - 1.1-6 +- Fix usage output on unrecognized argument + * Thu Jul 21 2022 Fedora Release Engineering - 1.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 474076d6f19baa0ddb60f93070bf20a904ef57f5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 14:58:21 +0000 Subject: [PATCH 44/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 9ea6ac7..5191705 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 1.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Thu Jan 12 2023 FeRD (Frank Dana) - 1.1-6 - Fix usage output on unrecognized argument From d3f79a681f4b5d3890437142a4bfc202fe3bbf2f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 09:23:07 +0000 Subject: [PATCH 45/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 5191705..0612237 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 1.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Thu Jan 19 2023 Fedora Release Engineering - 1.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 5aadb92d21ff6bebcee67e8de4faaca53a7a56e8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 01:07:17 +0000 Subject: [PATCH 46/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 0612237..35c96ea 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 1.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Thu Jul 20 2023 Fedora Release Engineering - 1.1-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 2cd63319b0807bef55252ef3b472f661b98569eb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 00:43:05 +0000 Subject: [PATCH 47/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 35c96ea..32f9b89 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 1.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 1.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 99f961acbcc40e6b1844b1fdf48b46f6bf75bc83 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 12:29:17 +0000 Subject: [PATCH 48/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 32f9b89..2499e62 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 1.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Thu Jan 25 2024 Fedora Release Engineering - 1.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 5a91c4b4b19eea0644e024f7089d383778788f9e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 09:36:10 +0000 Subject: [PATCH 49/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 2499e62..89672a5 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 1.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Jul 18 2024 Fedora Release Engineering - 1.1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 85465af0fcd08715fa1ab076fcf7a473e787f43c Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Thu, 6 Mar 2025 10:09:00 +0000 Subject: [PATCH 50/51] Use fedora compression flags --- kmodtool.spec | 5 ++++- macros.kmodtool | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kmodtool.spec b/kmodtool.spec index 89672a5..617a76c 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Mar 06 2025 Leigh Scott - 1.1-13 +- Use fedora compression flags + * Fri Jan 17 2025 Fedora Release Engineering - 1.1-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/macros.kmodtool b/macros.kmodtool index 9dedd27..46c6034 100644 --- a/macros.kmodtool +++ b/macros.kmodtool @@ -109,6 +109,6 @@ fi # %__kmodtool_modzip_install_post\ if [ "%{__kmodtool_zipmodules}" -eq "1" ] ; then\ - find %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} -type f -name '*.ko' | xargs xz;\ + find %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} -type f -name '*.ko' | xargs xz --compress --check=crc32 --lzma2=dict=1MiB;\ fi\ %{nil} From a9a2e93c7c07ada19d4d16fa73300e223cd411f7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 18:51:05 +0000 Subject: [PATCH 51/51] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- kmodtool.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmodtool.spec b/kmodtool.spec index 617a76c..ce40307 100644 --- a/kmodtool.spec +++ b/kmodtool.spec @@ -3,7 +3,7 @@ Name: kmodtool Version: 1.1 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Tool for building kmod packages License: MIT URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2 @@ -46,6 +46,9 @@ install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/ %{_rpmmacrodir}/macros.kmodtool %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 1.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Thu Mar 06 2025 Leigh Scott - 1.1-13 - Use fedora compression flags