(dist-)kernel-{install,utils}.eclass: fix finding config during cleanup

The source symlink does not exist on all systems.

If we can't find any config at all then there will be no preferred suffix
which means we fall back to the old '-nt' based cleaning.

Closes: https://bugs.gentoo.org/937569
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/38016
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
This commit is contained in:
Andrew Ammerlaan
2024-08-08 18:44:27 +02:00
parent a2db294c0a
commit c75b6bf3c8
2 changed files with 16 additions and 4 deletions
+15 -3
View File
@@ -160,7 +160,7 @@ dist-kernel_PV_to_KV() {
}
# @FUNCTION: dist-kernel_get_module_suffix
# @USAGE: <kernel_dir>
# @USAGE: <kernel_config>
# @DESCRIPTION:
# Returns the suffix for kernel modules based on the CONFIG_MODULES_COMPESS_*
# setting in the kernel config and USE=modules-compress.
@@ -169,7 +169,7 @@ dist-kernel_get_module_suffix() {
[[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments"
local config=${1}/.config
local config=${1}
if ! in_iuse modules-compress || ! use modules-compress; then
echo .ko
@@ -198,7 +198,19 @@ dist-kernel_compressed_module_cleanup() {
[[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments"
local path=${1}
local preferred=$(dist-kernel_get_module_suffix "${path}/source")
local config_path=/usr/src/linux-${KV_FULL}/.config
local option
for option in config source/.config build/.config; do
if [[ -f ${path}/${option} ]]; then
config_path=${path}/${option}
break
fi
done
local preferred=
[[ -f ${config_path} ]] && preferred=$(dist-kernel_get_module_suffix "${config_path}")
local basename suffix
while read -r basename; do
+1 -1
View File
@@ -769,7 +769,7 @@ kernel-install_compress_modules() {
if [[ -z ${KV_FULL} ]]; then
KV_FULL=${PV}${KV_LOCALVERSION}
fi
local suffix=$(dist-kernel_get_module_suffix "${ED}/usr/src/linux-${KV_FULL}")
local suffix=$(dist-kernel_get_module_suffix "${ED}/usr/src/linux-${KV_FULL}/.config")
local compress=()
# Options taken from linux-mod-r1.eclass.
# We don't instruct the compressor to parallelize because it applies