From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B7C28159C9B for ; Thu, 8 Aug 2024 16:45:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D5B1BE2A37; Thu, 8 Aug 2024 16:45:03 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8BA1CE2A26 for ; Thu, 8 Aug 2024 16:45:03 +0000 (UTC) From: Andrew Ammerlaan To: gentoo-dev@lists.gentoo.org Cc: Andrew Ammerlaan Subject: [gentoo-dev] [PATCH] (dist-)kernel-{install,utils}.eclass: fix finding config during cleanup Date: Thu, 8 Aug 2024 18:44:55 +0200 Message-ID: <20240808164455.512247-1-andrewammerlaan@gentoo.org> X-Mailer: git-send-email 2.45.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: a308c272-5626-4727-b81c-517585bbf6a0 X-Archives-Hash: e030707faf8770028819bd198c7967e0 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 --- eclass/dist-kernel-utils.eclass | 18 +++++++++++++++--- eclass/kernel-install.eclass | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 0b0eb0ec8818..bb058d488a13 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -160,7 +160,7 @@ dist-kernel_PV_to_KV() { } # @FUNCTION: dist-kernel_get_module_suffix -# @USAGE: +# @USAGE: # @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 diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index c64dd673084b..496e258815d2 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -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 -- 2.45.2