Compare commits

..

67 commits

Author SHA1 Message Date
Zamir SUN
2ce6b84eca Bump to 34.2-3 to build and run new gating
Signed-off-by: Zamir SUN <sztsian@gmail.com>
2025-08-13 15:14:36 +08:00
Zamir SUN
91014e42d6 Tests: Remove tests.yml STI entrypoint to make tmt work
Signed-off-by: Zamir SUN <sztsian@gmail.com>
2025-08-13 15:11:51 +08:00
Zamir SUN
b4bcf63353 Tests: Fix fmf files for gating
Signed-off-by: Zamir SUN <sztsian@gmail.com>
2025-08-13 15:11:26 +08:00
Ziqian SUN (Zamir)
b64bf8be07 Convert gating to restraint and tmt
Signed-off-by: Ziqian SUN (Zamir) <zsun@redhat.com>
2025-08-12 15:07:16 +08:00
Fedora Release Engineering
d1dc8b58a8 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 18:50:59 +00:00
Josh Boyer
c41da9ae87 New upstream v34.2
Resolves: rhbz#2355680
2025-03-31 07:42:58 -04:00
Josh Boyer
bd7db8fb02 New upstream v34.1
Resolves: rhbz#2350269
2025-03-08 13:05:24 -05:00
Josh Boyer
56b12983a2 Last changes for -34 2025-02-24 13:16:51 -05:00
Josh Boyer
46456317d7 Add gtk-doc BR 2025-02-24 12:26:43 -05:00
Josh Boyer
c6eaf81e4c New upstream release 2025-02-24 12:13:48 -05:00
Fedora Release Engineering
35b0189855 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 09:35:58 +00:00
Zbigniew Jędrzejewski-Szmek
26240b4bb3 Rebuilt for the bin-sbin merge (2nd attempt)
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin
2025-01-12 14:32:51 +01:00
Peter Robinson
0a2caa79e2 cleanup gitignore 2024-10-28 16:09:50 +00:00
Eugene Syromiatnikov
de9195aa3e New upstream v33
* .gitignore: Add /kmod-33.tar.xz,
* kmod-tip.patch: Remove.
* kmod.spec (Version): Bump to 33.
(Release): Reset to 1.
(Patch1): Remove.
(BuildRequires): Remove libxslt and docbook-style-xsl, add scdoc;
upstream switched to scdoc-based man pages in commt v33~46.
(%install): Remove symlinks installed by make install since v32~3.
(%files): kmod.pc is moved to %{_datadir} and is moved to be a part
of the main package and not kmod-devel, as it should be;  TODO file
has been removed in v33~2.
(%chanelog): Add a record.
* sources: Replace the kmod-31.tar.xz with kmod-33.tar.xz.

Resolves: rhbz#2268030
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-08-15 20:40:57 +02:00
Eugene Syromiatnikov
73d6e056b5 kmod.spec: fix a typo in date in changelog entry
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-08-12 16:11:02 +02:00
Eugene Syromiatnikov
5baad98a23 weak-modules: use a proper program for dumping symvers
Previously it was assumed that symvers is in gzip format, which
is no longer the case, so zcat was used.  Dispatch based on the symvers
file extension.

References: RHEL-39388
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2024-08-12 16:08:35 +02:00
Fedora Release Engineering
486394f8b7 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 12:29:07 +00:00
Zbigniew Jędrzejewski-Szmek
7648e1a704 Prepare for bin-sbin merge
https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin

Create symlinks use 'ln --relative' so that we don't get /usr/bin/foo → ../bin/bar,
but instead /usr/bin/foo → bar.

Create compat provides for the old file locations to satisfy Requires in other
packages.
2024-04-11 10:49:19 +02:00
Fedora Release Engineering
bac67d1d74 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 00:42:55 +00:00
Fedora Release Engineering
b335496724 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 01:06:54 +00:00
Eugene Syromiatnikov
c63e20debb kmod.spec: update the License in an attempt to comply with the new policy
* kmod.spec (Release): Bump to 3.
(License): Update to include all licenses mentioned in the sources,
add a comment that lists files for each license.
(%package libs): Remove the License tag.
(%changelog): Add "migrated to SPDX license" mention.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2023-12-01 18:30:54 +01:00
Josh Boyer
2d51006e98 Add upstream patches to enable SHA3 support
New upstream v31
Resolves: rhbz#2241394
2023-11-09 11:39:43 -05:00
Josh Boyer
15b926cdb7 New upstream v31
Resolves: rhbz#2241394
2023-11-09 09:01:37 -05:00
Fedora Release Engineering
389eca78ce Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 09:22:57 +00:00
Eugene Syromiatnikov
b215525d80 packaging: bump up version, 30-5
- Add symvers.xz support to weak-modules

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2023-05-09 09:54:35 +02:00
Eugene Syromiatnikov
2f9252cb9e weak-modules: add symvers.xz support
Check for symvers.xz support in addition to symvers.gz,
due to unnanounced unilateral change[1][2] in the kernel packaging.

[1] 2644665657
[2] https://src.fedoraproject.org/rpms/kernel/c/2db77a072a997c00ee63ddf38b79766699094f1c?branch=rawhide

* weak-modules (make_kernel_file_names): Interpret all arguments after
the second as a list of suffixes, iterate over them
(find_kernel_file): Switch print and suffix arguments, interpret all
argument after print as suffixes, pass them to make_kernel_file_names.
(find_symvers_file): Update the order of arguments in the
find_kernel_file call, add .xz suffix in addition to .gz.
(find_systemmap_file): Update the order of arguments in the
find_kernel_file call.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
References: https://bugzilla.redhat.com/show_bug.cgi?id=2192895
2023-05-09 09:11:45 +02:00
Fedora Release Engineering
351c275048 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 14:58:10 +00:00
Florian Weimer
5a0a5922f1 Port configure script to C99
Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
2022-12-17 18:20:55 +01:00
Fedora Release Engineering
35cb0afc6a Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 16:27:22 +00:00
Stewart Smith
73532e3bda Move zlib, xz, and zstd to bcond
This allows experiments to be run with reducing the size of the
initramfs by having fewer bulky shared libraries in it, and also makes
it easier for downstream distributions to make different configuration
choices.

We keep the defaults the same, building *with* all of these in order to
not change what is practically being built in Fedora.

Signed-off-by: Stewart Smith <trawets@amazon.com>
2022-06-27 19:38:16 -04:00
Yauheni Kaliuta
095680a70d New upstream release (v30)
- README was removed in order to keep only README.md. Update the spec.
- Resolves: rhbz#2102796

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2022-07-04 15:53:07 +03:00
Fedora Release Engineering
22122f8f4f - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 15:00:31 +00:00
Sahana Prasad
7b3a5b1282 Rebuilt with OpenSSL 3.0.0 2021-09-14 19:05:21 +02:00
Yauheni Kaliuta
43ea30869b sources: update again
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-11 10:29:45 +03:00
Yauheni Kaliuta
d00681e454 depmod.dist.conf: commit to git
koji still complains. Commit it to git like weak-modules.

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-11 10:25:12 +03:00
Yauheni Kaliuta
be3d947ed1 sources: updated depmod.conf.dist
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-11 10:18:42 +03:00
Yauheni Kaliuta
2e0ab6c0a5 sources: updated kmod-29.tar.xz
koji complained, that the file is not found.

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-11 10:07:49 +03:00
Yauheni Kaliuta
37c97fb6a8 fedpkg new-source: commit modified files
.gitignore
sources

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-11 09:53:59 +03:00
Yauheni Kaliuta
f4aad01fe7 packaging: bump up version, 29-5
- kmod.spec: enable debug
- weak-modules: compare_initramfs_modules: exit on pushd/popd failures
- weak-modules: split modules into array with read -a
- Add default config file, /etc/depmod.d/dist.conf

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-10 16:14:30 +03:00
Yauheni Kaliuta
0b10b0482b kmod.spec: enable debug
The debug messages pretty often are useful to find configuration
problems on customers systems. They are seen only with extra verbose
command line switches so should not affect performance a lot.

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-10 16:09:15 +03:00
Yauheni Kaliuta
2679f21c98 weak-modules: compare_initramfs_modules: exit on pushd/popd failures
Coverity reports warning
`warning[SC2164]: Use 'popd ... || exit' or 'popd ... || return' in case popd fails.`

This cannot happen in case of weak-modules, but makes no harm.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2021-08-10 16:03:41 +03:00
Yauheni Kaliuta
50733019f1 weak-modules: split modules into array with read -a
Coverity reports warning for splitting mods=($i)
`Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.`

Even if it can not cause problems for weak-modules case where the
list is coming from modules.dep, use the recommended read -a method.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2021-08-10 16:03:34 +03:00
Yauheni Kaliuta
35bc85d1e4 Add default config file, /etc/depmod.d/dist.conf
External modules packaging depends on the search order provided by
RHEL default config which is missing now from CentOS Stream.

Add and install the file.

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2021-08-10 13:04:55 +03:00
Fedora Release Engineering
6aa03ba354 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 10:14:32 +00:00
Neal Gompa
a81e15debb Fix conditional to only install weak-modules for RHEL
Generally speaking, weak-modules is going to be of no use to anyone,
since the stabilized kABI is a unique property that only exists
with the Red Hat Enterprise Linux distribution kernel.

To avoid issues with downstreams, flip the conditional so that it
is explicit that this is only useful for RHEL.
2021-06-08 06:45:19 -04:00
Neal Gompa
59975932b8 Move the conditional the top to clarify its scope
This conditional impacts the whole spec, and generally these things
are at the top of the spec to make it clear and avoid random scoping
issues at spec parse time.
2021-06-08 06:27:02 -04:00
Justin M. Forbes
629ab3ccc2
Rebuild for weak-modules drop in Fedora
Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2021-05-25 07:37:32 -05:00
Justin M. Forbes
43ae298bc9
Remove weak-modules from kmod in Fedora
Fedora does not support CONFIG_MODVERSIONS, as we have no guarantee of
KABI.  With this in mind, the weak-modules script adds no benefit to
Fedora, but it can cause serious issues with update times on major
kernel rebases, and with dkms.  This patch removes the script from
Fedora, but leaves it in place for ELN/CentOS/RHEL, etc.

Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2021-05-24 12:46:42 -05:00
Josh Boyer
7c1c60b960 New upstream v29
Resolves: rhbz#1962980
2021-05-21 08:31:17 -04:00
Robert Scheck
93a23f7391 Spec file cleanup
- Updated URL to current (shorter URL and HTTPS)
- Removed superfluous slash for %{_mandir} path
- Removed superfluous /sbin (only %{_sbindir} is used)
- Preserve timestamp when installing weak-modules(1)
2021-01-30 23:47:20 +01:00
Fedora Release Engineering
406582dd73 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 15:58:53 +00:00
Josh Boyer
393f16a127 New upstream v28
Enable zstd support
Resolves: rhbz#1913949
2021-01-07 19:31:43 -05:00
Tom Stellard
b6296f9ad3 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-04 22:48:43 +00:00
Fedora Release Engineering
bddd48bb1f - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 03:32:01 +00:00
Yauheni Kaliuta
2a32527449 fix crash on fseek/ftell of stdout, try 2 (27-2)
- add 0001-depmod-do-not-output-.bin-to-stdout.patch
  Resolves: rhbz#1808430

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2020-03-25 14:04:16 +02:00
Yauheni Kaliuta
176e965223 Revert "fix crash on fseek/ftell of stdout (27-2)"
This reverts commit f1da57f289.

The commit is broken

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2020-03-25 10:02:38 +02:00
Yauheni Kaliuta
f1da57f289 fix crash on fseek/ftell of stdout (27-2)
- add 0001-depmod-do-not-output-.bin-to-stdout.patch
  Resolves: rhbz#1808430

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2020-03-25 09:55:48 +02:00
Peter Robinson
1988940ee7 v27 2020-02-20 11:35:04 +00:00
Peter Robinson
ed503860f1 minor spec cleanups and modernisation 2020-01-22 17:45:25 +00:00
Yauheni Kaliuta
afdb88d8b3 packaging: bump up version, 26-5
- weak-modules: sync with RHEL

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2020-01-20 18:58:12 +02:00
Yauheni Kaliuta
933fad99cb weak-modules: Sync with RHEL
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2020-01-20 18:56:21 +02:00
Laura Abbott
b006530fb5 weak-modules: Sync with RHEL
Signed-off-by: Laura Abbott <labbott@redhat.com>
2019-11-01 09:22:38 -04:00
Fedora Release Engineering
2c61399a4a - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 11:56:57 +00:00
Yauheni Kaliuta
df015fd4dc packaging: bump up version, 26-3
- weak-modules: sync with RHEL

Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2019-02-25 18:48:22 +02:00
Yauheni Kaliuta
559b043f51 weak-modules: sync with RHEL
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2019-02-25 15:10:47 +02:00
Yauheni Kaliuta
434a6d5d65 add PKCS7/openssl support (rhbz 1320921)
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2019-02-24 19:48:49 +02:00
Yauheni Kaliuta
b159b7c148 Update to version 26 (rhbz 1673749)
Signed-off-by: Yauheni Kaliuta <ykaliuta@fedoraproject.org>
2019-02-24 19:11:20 +02:00
15 changed files with 424 additions and 229 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

21
.gitignore vendored
View file

@ -1,20 +1 @@
/kmod-7.tar.xz
/kmod-8.tar.xz
/kmod-9.tar.xz
/kmod-10.tar.xz
/kmod-11.tar.xz
/kmod-12.tar.xz
/kmod-13.tar.xz
/kmod-14.tar.xz
/kmod-15.tar.xz
/kmod-16.tar.xz
/kmod-17.tar.xz
/kmod-18.tar.xz
/kmod-19.tar.xz
/kmod-20.tar.xz
/kmod-21.tar.xz
/kmod-22.tar.xz
/kmod-23.tar.xz
/kmod-24.tar.xz
/kmod-25.tar.xz
/kmod-26.tar.xz
/kmod-*.tar.xz

6
depmod.conf.dist Normal file
View file

@ -0,0 +1,6 @@
#
# depmod.conf
#
# override default search ordering for kmod packaging
search updates extra built-in weak-updates

267
kmod.spec
View file

@ -1,25 +1,105 @@
# Fedora does not support CONFIG_MODVERSIONS. Without kabi support
# weak-modules is useless at best, and can be actively harmful.
# Since RHEL *does* support this and offers kabi support,
# turn it on there by default.
%if 0%{?rhel}
%bcond_without weak_modules
%bcond_without dist_conf
%else
%bcond_with weak_modules
%bcond_with dist_conf
%endif
%bcond_without zlib
%bcond_without xz
%bcond_without zstd
Name: kmod
Version: 26
Version: 34.2
Release: 3%{?dist}
Summary: Linux kernel module management utilities
License: GPLv2+
URL: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
# https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis
# GPL-2.0-or-later:
# build-aux/compile
# build-aux/depcomp
# build-aux/ltmain.sh
# build-aux/ltmain.sh
# build-aux/missing
# build-aux/py-compile
# build-aux/test-driver
# m4/attributes.m4
# m4/features.m4
# tools
# GPL-3.0-or-later:
# build-aux/config.guess
# build-aux/config.sub
# build-aux/git-version-gen
# libkmod/docs/gtk-doc.make
# m4/gtk-doc.m4
# FSFUL:
# configure
# FSFULLRWD:
# aclocal.m4
# libkmod/docs/Makefile.in
# m4/libtool.m4
# m4/lt~obsolete.m4
# m4/ltoptions.m4
# m4/ltsugar.m4
# m4/ltversion.m4
# Makefile.in
# LGPL-2.1-only:
# libkmod/python/kmod/error.py
# libkmod/python/kmod/__init__.py
# libkmod/python/kmod/version.py
# libkmod/python/kmod/version.py.in
# LGPL-2.1-or-later:
# config.h.in (no explicit license, the one in COPYING is assumed)
# libkmod
# man (no explicit license, the one in COPYING is assumed)
# shared
# shell-completion/bash/kmod
# testsuite
# X11:
# build-aux/install-sh
License: GPL-2.0-or-later AND GPL-3.0-or-later AND FSFUL AND FSFULLRWD AND LGPL-2.1-only AND LGPL-2.1-or-later AND X11
URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz
Source1: weak-modules
Source2: depmod.conf.dist
Exclusiveos: Linux
BuildRequires: gcc
BuildRequires: chrpath
%if %{with zlib}
BuildRequires: zlib-devel
%endif
%if %{with xz}
BuildRequires: xz-devel
BuildRequires: libxslt
%endif
BuildRequires: scdoc gtk-doc
BuildRequires: openssl-devel
BuildRequires: make automake libtool
%if %{with zstd}
BuildRequires: libzstd-devel
%endif
Provides: module-init-tools = 4.0-1
Obsoletes: module-init-tools < 4.0-1
Provides: /sbin/modprobe
%if "%{_sbindir}" == "%{_bindir}"
# Compat symlinks for Requires in other packages.
# We rely on filesystem to create the symlinks for us.
Requires: filesystem(unmerged-sbin-symlinks)
Provides: /usr/sbin/modprobe
Provides: /usr/sbin/modinfo
Provides: /usr/sbin/insmod
Provides: /usr/sbin/rmmod
Provides: /usr/sbin/lsmod
Provides: /usr/sbin/depmod
%endif
%description
The kmod package provides various programs needed for automatic
loading and unloading of modules under 2.6, 3.x, and later kernels, as well
@ -28,7 +108,6 @@ examples of loaded and unloaded modules.
%package libs
Summary: Libraries to handle kernel module loading and unloading
License: LGPLv2+
%description libs
The kmod-libs package provides runtime libraries for any application that
@ -43,37 +122,45 @@ The kmod-devel package provides header files used for development of
applications that wish to load or unload Linux kernel modules.
%prep
%setup -q
%autosetup -p1
%build
export V=1
autoreconf --install
%configure \
--with-openssl \
%if %{with zlib}
--with-zlib \
--with-xz
make %{?_smp_mflags}
%endif
%if %{with xz}
--with-xz \
%endif
%if %{with zstd}
--with-zstd \
%endif
--enable-debug
%{make_build} V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT
pushd $RPM_BUILD_ROOT/%{_mandir}/man5
%{make_install}
pushd $RPM_BUILD_ROOT%{_mandir}/man5
ln -s modprobe.d.5.gz modprobe.conf.5.gz
popd
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modprobe
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modinfo
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/insmod
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/rmmod
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/depmod
ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/lsmod
find %{buildroot} -type f -name "*.la" -delete
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d
mkdir -p $RPM_BUILD_ROOT/sbin
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
%if %{with weak_modules}
install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
%endif
%if %{with dist_conf}
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf
%endif
%files
%dir %{_sysconfdir}/depmod.d
@ -86,14 +173,23 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
%{_sbindir}/rmmod
%{_sbindir}/lsmod
%{_sbindir}/depmod
%if %{with weak_modules}
%{_sbindir}/weak-modules
%endif
%{_datadir}/bash-completion/
%attr(0644,root,root) %{_mandir}/man5/*.5*
%{_datadir}/fish/vendor_functions.d/*
%{_datadir}/zsh/site-functions/*
%if %{with dist_conf}
%{_sysconfdir}/depmod.d/dist.conf
%endif
%{_datadir}/pkgconfig/kmod.pc
%attr(0644,root,root) %{_mandir}/man5/mod*.d*.5*
%attr(0644,root,root) %{_mandir}/man5/depmod.d.5*
%{_mandir}/man5/modprobe.conf.5*
%attr(0644,root,root) %{_mandir}/man8/*.8*
%doc NEWS README TODO
%doc NEWS README.md
%files libs
%{!?_licensedir:%global license %%doc}
%license COPYING
%{_libdir}/libkmod.so.*
@ -103,6 +199,129 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
%{_libdir}/libkmod.so
%changelog
* Wed Aug 13 2025 Zamir SUN <zsun@fedoraproject.org> - 34.2-3
- Rebuild to switch gating to TMT.
- Resolves: rhbz#2382934
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 34.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Mon Mar 31 2025 Josh Boyer <jwboyer@fedoraproject.org> - 34.2-1
- New upstream v34.2
- Resolves: rhbz#2355680
* Sat Mar 08 2025 Josh Boyer <jwboyer@fedoraproject.org> - 34.1-1
- New upstream v34.1
- Resolves: rhbz#2350269
* Mon Feb 24 2025 Josh Boyer <jwboyer@fedoraproject.org>
- New upstream v34
- Resolves: rhbz#2347049
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 33-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 33-2
- Rebuilt for the bin-sbin merge (2nd attempt)
* Thu Aug 15 2024 Eugene Syromiatnikov <esyr@redhat.com> - 33-1
- New upstream v33
- Resolves: rhbz#2268030
* Mon Aug 12 2024 Eugene Syromiatnikov <esyr@redhat.com> - 31-8
- weak-modules: use either zcat or xzcat based on symvers file extension
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 31-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu Apr 11 2024 Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl> - 31-6
- Prepare for %%_bindir==%%_sbindir
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 31-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 31-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Dec 01 2023 Eugene Syromiatnikov <esyr@redhat.com> - 31-3
- migrated to SPDX license
* Thu Nov 09 2023 Josh Boyer <jwboyer@fedoraproject.org> - 31-2
- Add upstream patches to enable SHA3 support
- New upstream v31
- Resolves: rhbz#2241394
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 30-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue May 09 2023 Eugene Syromiatnikov <esyr@redhat.com> - 30-5
- Add symvers.xz support to weak-modules
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 30-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sat Dec 17 2022 Florian Weimer <fweimer@redhat.com> - 30-3
- Port configure script to C99
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 30-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jul 4 2022 Yauheni Kaliuta <ykaliuta@redhat.com> - 30-1
- New upstream v30
- Resolves: rhbz#2102796
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 29-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 29-6
- Rebuilt with OpenSSL 3.0.0
* Tue Aug 10 2021 Yauheni Kaliuta <ykaliuta@redhat.com> - 29-5
- kmod.spec: enable debug
- weak-modules: compare_initramfs_modules: exit on pushd/popd failures
- weak-modules: split modules into array with read -a
- Add default config file, /etc/depmod.d/dist.conf
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 29-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jun 08 2021 Neal Gompa <ngompa13@gmail.com> - 29-3
- Fix conditional to only install weak-modules for RHEL
* Tue May 25 2021 Justin M. Forbes <jforbes@fedoraproject.org> - 29-2
- Rebuild for weak-modules drop in Fedora
* Mon May 24 2021 Justin M. Forbes <jforbes@fedoraproject.org>
- Remove weak-modules for Fedora as it causes problems.
* Fri May 14 2021 Josh Boyer <jwboyer@fedoraproject.org> - 29-1
- New upstream v29
- Resolves: rhbz#1962980
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 07 2021 Josh Boyer <jwboyer@fedoraproject.org> - 28-1
- New upstream v28
- Enable zstd support
- Resolves: rhbz#1913949
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 27-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Mar 25 2020 Yauheni Kaliuta <ykaliuta@fedoraproject.org> - 27-2
- add 0001-depmod-do-not-output-.bin-to-stdout.patch
Resolves: rhbz#1808430
* Thu Feb 20 2020 Peter Robinson <pbrobinson@fedoraproject.org> - 27-1
- New upstream v27
* Mon Jan 20 2020 Yauheni Kaliuta <ykaliuta@fedoraproject.org> - 26-5
- weak-modules: sync with RHEL
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 26-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 25 2019 Yauheni Kaliuta <yauheni.kaliuta@redhat.com> - 26-3
- weak-modules: sync with RHEL

View file

@ -1 +1 @@
SHA512 (kmod-26.tar.xz) = 3ca276c6fc13c2dd2220ec528b8dc4ab4edee5d2b22e16b6f945c552e51f74342c01c33a53740e6af8c893d42bd4d6f629cd8fa6e15ef8bd8da30cb003ef0865
SHA512 (kmod-34.2.tar.xz) = 0e095c45ad61a6c61ce1ad61b9aa10cf5040e688b749f9a933b0e7d12de493c58027a5068b459cbbce05576fc564a22b83a3dbef1e6511b2a3e27034c88afd33

View file

@ -1,46 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/libkmod
# Description: Test if libkmod working ok
# Author: Susant Sahani<susant@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/libkmod
export TESTVERSION=1.0
OBJS = test-libkmod.c
CFLAG = -Wall -g3
CC = gcc
LIBS = -lkmod -lcmocka
test-libkmod:${OBJ}
${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS} ${LIBS}
run: test-libkmod
./runtest.sh
clean:
-rm -f test-libkmod
.c.o:
${CC} ${CFLAGS} ${INCLUDES} -c $<
CC = gcc
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Susant Sahani<susant@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test libkmod works ok" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: libkmod" >> $(METADATA)
@echo "Requires: libkmod libkmod-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -Fedora 29" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
test: bash ./runtest.sh
framework: beakerlib
duration: 15m

14
tests/libkmod/metadata Normal file
View file

@ -0,0 +1,14 @@
[General]
name=libkmod gating test
owner=Susant Sahani <susant@redhat.com>
description=libkmod gating test
license=GPLv2
confidential=no
destructive=no
[restraint]
entry_point=./runtest.sh
max_time=15m
use_pty=false
dependencies=gcc,make,libcmocka-devel,kmod-devel

View file

@ -18,6 +18,7 @@ rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertExists "$IPIP"
rlRun "gcc -o test-libkmod test-libkmod.c -lkmod -lcmocka"
rlRun "cp test-libkmod /usr/bin/"
rlPhaseEnd

10
tests/plan.fmf Normal file
View file

@ -0,0 +1,10 @@
prepare:
how: install
package:
- libcmocka-devel
- make
- gcc
discover:
how: fmf
execute:
how: tmt

View file

@ -1,79 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of general/kmod/sanity
# Description: kmod test
#
# 2016-07-31
# Author: Chunyu Hu <chuhu@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TENV=_env
ifeq ($(PKG_TOP_DIR),)
export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \
[ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
export _TOP_DIR := $(shell p=$$PWD; while :; do \
[ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
-include $(PKG_TOP_DIR)/env.mk
endif
include $(TENV)
ifeq ($(_TOP_DIR),)
_TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE)
endif
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(TENV) $(METADATA) _env runtest.sh Makefile PURPOSE lib.sh
.PHONY: all install download clean
run: $(FILES) build
( set +o posix; . /usr/bin/rhts_environment.sh; \
. /usr/share/beakerlib/beakerlib.sh; \
. runtest.sh )
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -fr *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Chunyu Hu <chuhu@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: kmod kernel module check from kernel modules tools">> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "RunFor: kernel" >> $(METADATA)
@echo "Requires: kernel" >> $(METADATA)
@echo "Requires: sysstat perf trace-cmd" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME) python rpm wget" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

12
tests/sanity/metadata Normal file
View file

@ -0,0 +1,12 @@
[General]
name=kmod gating test
owner=Ziqian SUN <zsun@redhat.com>
description=kmod gating test
license=GPLv2
confidential=no
destructive=no
[restraint]
entry_point=./runtest.sh
max_time=15m
use_pty=false

3
tests/sanity/sanity.fmf Normal file
View file

@ -0,0 +1,3 @@
test: bash ./runtest.sh
framework: beakerlib
duration: 15m

View file

@ -1,18 +0,0 @@
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-beakerlib
tests:
- sanity
- libkmod
required_packages:
- kernel
- perf
- sysstat
- trace-cmd
- kmod
- kmod-devel
- gcc
- libcmocka
- libcmocka-devel

View file

@ -3,15 +3,6 @@
# weak-modules - determine which modules are kABI compatible with installed
# kernels and set up the symlinks in /lib/*/weak-updates.
#
# This is an updated version of the script which doesn't support
# multiple installation of the same out-of-tree module (stored in the
# 'extra' subdirectory) for multiple kernels. This assumption is
# supposed to be verified at the rpm level of the packages delivering
# these modules. There are some checks for this assumption, however we
# really don't solve this situation. This limitation allows for a much
# simpler version of the script. Previous version tried to work in this
# case but was incorrect in some cases.
unset LANG LC_ALL LC_COLLATE
tmpdir=$(mktemp -td ${0##*/}.XXXXXX)
@ -32,6 +23,14 @@ declare -A weak_modules_before
declare -A groups
declare -A grouped_modules
# output of validate_weak_links, one iteration
# short_name -> path
declare -A compatible_modules
# state for update_modules_for_krel (needed for add_kernel case)
# short_name -> path
declare -A installed_modules
# doit:
# A wrapper used whenever we're going to perform a real operation.
doit() {
@ -180,24 +179,24 @@ compare_initramfs_modules() {
mkdir "$tmpdir/new_initramfs"
decompress_initramfs "$old_initramfs" "$tmpdir/old_initramfs.img"
pushd "$tmpdir/old_initramfs" >/dev/null
pushd "$tmpdir/old_initramfs" >/dev/null || exit
cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null
rm "$tmpdir/old_initramfs.img"
n=0; for i in `list_module_files|sort`; do
old_initramfs_modules[n]="$i"
n=$((n+1))
done
popd >/dev/null
popd >/dev/null || exit
decompress_initramfs "$new_initramfs" "$tmpdir/new_initramfs.img"
pushd "$tmpdir/new_initramfs" >/dev/null
pushd "$tmpdir/new_initramfs" >/dev/null || exit
cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null
rm "$tmpdir/new_initramfs.img"
n=0; for i in `list_module_files|sort`; do
new_initramfs_modules[n]="$i"
n=$((n+1))
done
popd >/dev/null
popd >/dev/null || exit
# Compare the length and contents of the arrays
if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \
@ -468,11 +467,34 @@ prepare_sandbox() {
#config
echo "search external extra built-in weak-updates" >"$conf"
echo "external $krel $dir" >>"$conf"
echo "external * $dir" >>"$conf"
depmod="$depmod_orig -C $conf"
}
# discard_installed:
# remove installed_modules[] from modules[]
discard_installed()
{
local short_name
for m in "${!modules[@]}"; do
short_name="$(module_short_name "${modules[$m]}")"
[[ -z "${installed_modules[$short_name]}" ]] && continue
unset "modules[$m]"
done
}
# update_installed:
# add compatible_modules[] to installed_modules[]
update_installed()
{
for m in "${!compatible_modules[@]}"; do
installed_modules[$m]="${compatible_modules[$m]}"
done
}
# finish_sandbox:
# restore global state after sandboxing
@ -498,26 +520,31 @@ finish_sandbox() {
# Auxiliary functions to find symvers file
make_kernel_file_names() {
local krel="$1"
local file="$2"
local suffix="$3"
shift
local file="$1"
shift
echo "${BASEDIR}/boot/${file}-${krel}${suffix}"
echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}"
for suffix in "$@"; do
echo "${BASEDIR}/boot/${file}-${krel}${suffix}"
echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}"
done
}
find_kernel_file() {
local krel="$1"
local file="$2"
local suffix="$3"
local print="$4"
shift
local file="$1"
shift
local print="$1"
shift
local i
if [[ "$print" != "" ]]; then
make_kernel_file_names "$krel" "$file" "$suffix"
make_kernel_file_names "$krel" "$file" "$@"
return 0
fi
for i in $(make_kernel_file_names "$krel" "$file" "$suffix"); do
for i in $(make_kernel_file_names "$krel" "$file" "$@"); do
if [[ -r "$i" ]]; then
echo "$i"
return 0
@ -541,7 +568,7 @@ find_symvers_file() {
local krel="$1"
local print="$2"
find_kernel_file "$krel" symvers .gz "$print"
find_kernel_file "$krel" symvers "$print" .xz .gz
}
# find_systemmap_file:
@ -551,7 +578,7 @@ find_systemmap_file() {
local print="$2"
local no_suffix=""
find_kernel_file "$krel" System.map "$no_suffix" "$print"
find_kernel_file "$krel" System.map "$print" "$no_suffix"
}
#### Main logic
@ -568,6 +595,7 @@ find_systemmap_file() {
# the given kernel)
# - check the state after validation to produce needed messages
# and trigger initrd regeneration if the list changed.
#
update_modules_for_krel() {
local krel="$1"
local func="$2"
@ -579,12 +607,24 @@ update_modules_for_krel() {
global_link_state_save $krel
# remove already installed from modules[]
discard_installed
# do not run heavy validation procedure if no modules to install
if [[ "${#modules[@]}" -eq 0 ]]; then
finish_sandbox $krel
return
fi
$func $krel
if ! validate_weak_links $krel && [[ -z "$force_update" ]]; then
global_link_state_restore $krel
fi
# add compatible to installed
update_installed
global_link_state_announce_changes $krel
finish_sandbox $krel
@ -600,12 +640,16 @@ update_modules() {
local func="$1"
local force_update="$2"
local module_krel
declare -a saved_modules
read_modules_list || exit 1
[[ ${#modules[@]} -gt 0 ]] || return
saved_modules=("${modules[@]}")
for krel in $(find_installed_kernels); do
update_modules_for_krel $krel $func $force_update
modules=("${saved_modules[@]}")
installed_modules=()
done
for module in "${modules[@]}"; do
@ -630,7 +674,7 @@ add_weak_links() {
module_krel="$(krel_of_module $module)"
case "$module" in
/lib/modules/$krel/*)
$BASEDIR/lib/modules/$krel/*)
# Module already installed to the current kernel
continue ;;
esac
@ -698,6 +742,7 @@ remove_weak_links() {
#
# Returns 0 (success) if proposal is fine or
# 1 (false) if some incompatible symlinks were removed
# initializes global hashmap compatible_modules with all the valid ones
validate_weak_links() {
local krel="$1"
local basedir=${BASEDIR:+-b $BASEDIR}
@ -713,14 +758,21 @@ validate_weak_links() {
# to return to caller that original proposal is not valid
# here 0 is true, 1 is false, since it will be the return code
local is_configuration_valid=0
local cat_prog
tmp=$(mktemp -p $tmpdir)
compatible_modules=()
if ! [[ -e $tmpdir/symvers-$krel ]]; then
local symvers_path=$(find_symvers_file "$krel")
[[ -n "$symvers_path" ]] || return
zcat "$symvers_path" > $tmpdir/symvers-$krel
cat_prog="cat"
case "$symvers" in
*.gz) cat_prog="zcat" ;;
*.xz) cat_prog="xzcat" ;;
esac
"$cat_prog" "$symvers_path" > $tmpdir/symvers-$krel
fi
while ((is_updates_changed)); do
@ -779,6 +831,9 @@ validate_weak_links() {
module_krel=$(krel_of_module $target)
if [[ "$module" == "$target" ]]; then
short_name="$(module_short_name "$module")"
compatible_modules+=([$short_name]="$module")
pr_verbose "Module ${module##*/} from kernel $module_krel is compatible with kernel $krel"
fi
done
@ -877,9 +932,12 @@ add_modules() {
# do_make_groups:
# Takes tmp file which contains preprocessed modules.dep
# output (or modules.dep)
#
# reads modules.dep format information from stdin
# produces groups associative array
# the group is a maximum subset of modules having at least a link
#
# more fine tuned extra filtering.
do_make_groups()
{
local tmp="$1"
@ -888,7 +946,9 @@ do_make_groups()
declare -a mods
while read i; do
mods=($i)
read -a mods <<< "$i"
echo "${mods[0]}" |grep -q "extra/" || continue
# if the module already met, then its dependencies already counted
module_group="${grouped_modules[${mods[0]}]}"
@ -898,6 +958,8 @@ do_make_groups()
group_name="${mods[0]}"
for mod in "${mods[@]}"; do
echo "$mod" |grep -q "extra/" || continue
# if there is already such group,
# it is a subset of the one being created
# due to depmod output
@ -915,26 +977,32 @@ do_make_groups()
# preprocess output for make_groups
# depmod -n produces also aliases, so it cuts them off
# also it removes colon after the first module
filter_depmod_deps()
cut_depmod_deps()
{
awk 'BEGIN { pr = 1 } /^#/{ pr = 0 } pr == 1 {sub(":",""); print $0}'
}
# make_abs_path:
# filter_extra_absoluted:
# Takes kernel version
# makes full path from the relative module path
# (produced by depmod for in-kernel-dir modules)
make_abs_path()
# filter only extra/ modules
filter_extra_absoluted()
{
local kver="$1"
local mod
declare -a mods
while read i; do
mods=($i)
# skip non-extra. The check is not perfect, but ok
# to speed up handling in general cases
echo "$i" |grep -q "extra/" || continue
read -a mods <<< "$i"
for j in "${!mods[@]}"; do
mod="${mods[$j]}"
[[ ${mod:0:1} == "/" ]] || mod="/lib/modules/$kver/$mod"
[[ ${mod:0:1} == "/" ]] || mod="$BASEDIR/lib/modules/$kver/$mod"
mods[$j]="$mod"
done
echo "${mods[@]}"
@ -942,20 +1010,20 @@ make_abs_path()
}
# make_groups:
# takes krel and a file with the list of modules,
# takes k -- kernel version, we are installing extras from
# prepares and feeds to do_make_groups
# to create the module groups (global)
make_groups()
{
local krel="$1"
local tmp1="$2"
local k="$1"
local tmp2=$(mktemp -p $tmpdir)
local basedir=${BASEDIR:+-b $BASEDIR}
groups=()
grouped_modules=()
$depmod -n $krel $(cat $tmp1) 2>/dev/null |
filter_depmod_deps | make_abs_path $krel > $tmp2
$depmod -n $basedir $k 2>/dev/null |
cut_depmod_deps | filter_extra_absoluted $k > $tmp2
do_make_groups $tmp2
@ -966,6 +1034,7 @@ add_kernel() {
local krel=${1:-$(uname -r)}
local tmp
local no_force_update=""
local num
tmp=$(mktemp -p $tmpdir)
@ -975,17 +1044,36 @@ add_kernel() {
exit 1
fi
for k in $(find_kernels_with_extra | rpmsort); do
for k in $(find_kernels_with_extra | rpmsort -r); do
[[ "$krel" == "$k" ]] && continue
find_modules $k extra > $tmp
is_empty_file "$tmp" || make_groups $krel $tmp
is_empty_file "$tmp" || make_groups $k
# reuse tmp
# optimization, check independent modules in one run.
# first try groups with one element in each.
# it means independent modules, so we can safely remove
# incompatible links
# some cut and paste here
echo > $tmp
for g in "${groups[@]}"; do
num="$(echo "$g" | wc -w)"
[ "$num" -gt 1 ] && continue
printf '%s\n' $g >> $tmp
done
# to avoid subshell, see the read_modules_list comment
read_modules_list < $tmp
update_modules_for_krel $krel add_weak_links force_update
for g in "${groups[@]}"; do
num="$(echo "$g" | wc -w)"
[ "$num" -eq 1 ] && continue
printf '%s\n' $g > $tmp
# to avoid subshell, see the read_modules_list comment
read_modules_list < $tmp
update_modules_for_krel $krel add_weak_links $no_force_update
done