Commit Graph

9 Commits

Author SHA1 Message Date
Denys Vlasenko
653ec7d086 modalias.prov: use "local" builtin rather than "declare"
While (in this case) their effect is the same,
many more people know that "local" makes variables function-local,
than that "declare" in bash does the same. I didn't know.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2023-05-05 17:40:03 +02:00
Denys Vlasenko
510e0c8261 modalias.prov: make sort locale-independent with LC_ALL=C
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2023-05-05 17:35:42 +02:00
Denys Vlasenko
6a6920aed2 modalias.prov: use "command" rather than "which" to check existence of commands
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2023-05-05 17:34:05 +02:00
Denys Vlasenko
9d75b962fc modalias.prov: fix spurious exitcode of 1 on reaching EOF
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2023-05-03 11:30:18 +02:00
Eugene Syromiatnikov
f218d75450 modalias.prov: stricter module aliase/version mangling
* modalias.prov: Replace everyithing that is not "0-9a-zA-Z.:"
in a kernel module version with underscores;  replace everything
that is not "][0-9a-zA-Z.:*_?/-" in a kernel module alias with
underscores.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:44:20 +01:00
Eugene Syromiatnikov
52ba5a74f2 modalias.prov: change interpreter to /bin/bash -efu
* modalias.prov: Chnge interpreter from "/bin/sh" to "/bin/bash" because
it uses bashisms;  add "-efu" flags to keep things in check; initialise
is_kernel_package variable; check for presence of /sbin/modinfo, sed,
and sort.
(combine_modaliases): Initialise the "variants" and "pos" variables.

Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:44:20 +01:00
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
ce2a205fbd modalias.prov: process compressed kmods
* modalias.prov: Add "(\.gz|\.bz2|\.xz)?" to the end of the module path
matching regular expression, use "$@" instead of $*.

Resolves: #1942537
Resolves: #2024117
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2021-11-18 16:38:10 +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