Commit Graph

13 Commits

Author SHA1 Message Date
Eugene Syromiatnikov
1208dd48a6 Add zstd kmod compression support
* brp-kmod-restore-perms: Add chech for "$RPM_BUILD_ROOT/$path.zst".
* find-provides.ksyms: Add "\.zst" to the kernel module path matching
regular expression; process kernel module with zstd if its file name
ends with "zst".
* find-requires.ksyms: Likewise.
* firmware.prov: Add "\.zst" to the kernel module path matching
regular expression.
* kmodtool (%post, %preun): Likewise.
* modalias.prov: Likewise.
* modalias.attr (%__modalias_path): Add "ko\.zst" to the kernel module
path matching regular expression.
* provided_ksyms.attr (%__provided_ksyms_path): Likewise.
* required_ksyms.attr (%__required_ksyms_path): Likewise.
* kmod.attr (%__kmod_path): Add ".*\.ko\.zst" to the kernel module path
matching regular expression.
(strip_compress_sfx): Strip "\.zst" suffix, if present.

Resolves: #1942537
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:44:20 +01:00
Eugene Syromiatnikov
4fcfdefddb Switch kmodtool-generated spec to internal dependency generator
It leads to some regressions in requires generation precision, though,
as it is no longer possible to exclude requires that are satisfied
by other kmods in the package.  And calling a script on each file (instead
of calling it on the whole file list at once) does not make things faster,
either (so much for "sanity and benefit").

* find-provides.ksyms: Check for "$@" as well.
* find-requires.ksyms: Likewise.
* kernel-srpm-macros.spec (Source104, Source105, Source106): New
attribute files.
(%install): Install provided_ksyms.attr, required_ksyms.attr,
and modalias.attr into "%{buildroot}%{_fileattrsdir}".
(%files -n kernel-rpm-macros): Add provided_ksyms.attr,
required_ksyms.attr, and modalias.attr.
kmodtool: Remove "%global _use_internal_dependency_generator 0".
macros.kmp: Remove %__find_provides and %__find_requires.
* modalias.attr: New file.
* provided_ksyms.attr: Likewise.
* required_ksyms.attr: Likewise.

Resolves: #1942072
Resolves: #1942563
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:44:04 +01:00
Eugene Syromiatnikov
54f4c6637e kmodtool: call weak-modules for compressed kmods too
* kmodtool (%post, %preun): Add "(\.gz|\.bz2|\.xz)?" to the kernel module
path matching regular expression.

Resolves: #1942537
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:38:10 +01:00
Eugene Syromiatnikov
bbee85c732 kmodtool: bump revision
* kmodtool (myver): Change revision to "rhel9", may be useful
for external users.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:38:10 +01:00
Eugene Syromiatnikov
a83ea7823d kmodtool: add "kernel${dashvariant}-modules" Provides
Providing "kernel-modules" with "${verrel}${dotvariant}" looks strange,
as it differs from the package and version that are actualy used for
flavored kernels.

* kmodtool (get_rpmtemplate): Add "kernel${dashvariant}-modules >= ${verrel}"
Provides to the generated spec.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
6a73d7992a kmodtool, macros.kmp: support "+" for the kernel variant in uname
A patch[1] to the kernel spec file changed the separator that is used
for kernel flavor designation from "." to "+", which broke kmodtool and
%kernel_module_package in multiple places.  Try to accomodate it by
accepting both "+" and "." during parsing, and guessing which one should
be used for kernel osurce path generation.

PS. It looks like the analogous breakage was before, when it was changed
from "-" to ".". May be we should start support it back again as well.

[1] https://lists.fedoraproject.org/pipermail/kernel/2013-June/004262.html

* kmodtool (get_verrel, get_variant): Accept both "." and "+" as separators.
(get_variant_char, print_variant_char, print_kernel_source): New functions.
(get_filelist): Convert "+%1" in file list to $dotvariant, in addition
to ".%1" and "-%1".
(get_rpmtemplate): Determine a char that is used as a variant separator.
Use it in $dotvariant.
(usage): Mention "veriant_char" and "kernel_source" commands.
* macros.kmp (%kernel_module_package): Use "kernel_source" command in
"%kernel_source" definition when non-default variant is used; fall back
to ls-based heuristics when it is not available (for example, when a
version of kmodtool that doesn't support this command is used).

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
b4645cd8aa kmodtool: enquote $@ usage
* kmodtool: Put $@ instances into quotes as otherwise arguments
will undergo word splitting.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
a4aed2feef kmodtool, macros.kmp: update list of build requirements
The following packages are added:
 - kernel-abi-stablelists is used by find-requires.ksym in order to
   provide information regarding kABI symbol usage. It's purely
   informational and optional, however.
 - redhat-rpm-config and kernel-rpm-macros are added since the generted
   spec files use macros from these packages.
 - elfutils-libelf-devel is used during kmod build for ORC metadata
   generation (used by kernel for stack unwinding).
 - kmod programs are used by find-requires.ksyms and find-proivides.ksyms
   for parsing *.ko files during dependency generation.

* kmodtool (get_rpm_template): Update the list of generated
BuildRequires.
* macros.kmp (%kernel_module_package_buildreqs): Update the list of
default BuildRequires.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
9d55967f9e kmodtool: add "zfcpdump" to the list of known kernel variants
In RHEL 9, there's a s390x-specific "zfcpdump" kernel variant (which
replaces previous "kdump¨ variant). Add it to the list of the known
kernel variants.

* kmodtool (knownvariants): Add "zfcpdump".

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
ae5f1cd645 kmodtool: update dependencies, weak-modules path
Add Requires(post) and Requires(postun) on weak-modules, use
/usr/sbin/weak-modules path, add relevant build requirements.

* kmodtool (get_rpmtemplate): Add weak-modules to Requires(post),
Requires(postun). Prefix path to weak-modules with /usr.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
2a946ba85a Re-add redhat-rpm-config-9.1.0-fix-depmod-path.patch to RHEL 9
Apply contents of redhat-rpm-config-9.1.0-fix-depmod-path.patch from
RHEL 7 branch.

Commit message from the original commit:

    commit 98a159714814bfa24cb912eb3eb4c50186006ca4
    Author: Weiping Pan <wpan@redhat.com>
    Date:   Sun Sep 22 10:53:10 2013 +0800

        fix depmod path

        Since after kmod 5.1, depmod is in /usr/sbin/ instead of /sbin/,
        we have to follow it.
        kmod dis-git commit d398533b871d(version 5).

        Resolves: #1002618

        Signed-off-by: Weiping Pan <wpan@redhat.com>

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Eugene Syromiatnikov
581680855a Re-add contents of redhat-rpm-config-9.1.0-kmod-kabi.patch to RHEL 9
Apply redhat-rpm-config-9.1.0-kmod-kabi.patch from RHEL 7 branch.

Applied only changes to kmodtool and macros (now macros.kmp), as all
others are applied already. macros.kmp also had a merge conflict due to
commits f41a8a73aa6f ("Fix kernel_source macro to match the directory
that kernel sources are installed in") and d95e9bc7b618 ("Fix directory
name mismatch in kernel_source macro (#648996)") being applied already.

Commit message from the original commit:

    commit 29b4b765391b8f11ae64708e86ac3f7475c62661
    Author: Panu Matilainen <pmatilai@redhat.com>
    Date:   Tue Jul 9 09:57:29 2013 +0300

        - Re-add various kABI-related bits (Jon Masters)
        - Allow kmod building against z-stream kernels (Jiri Benc)

Resolves: #1971748
Resolves: #2002887
Resolves: #2015909
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:33:11 +01:00
Michal Domonkos
33b5f1bcf4 Adopt kernel-rpm-macros subpackage from redhat-rpm-config
This has been done in CentOS Stream already:
https://gitlab.com/redhat/centos-stream/rpms/kernel-srpm-macros/-/merge_requests/1
2021-06-03 17:21:53 +02:00