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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C1F82158534 for ; Fri, 23 Aug 2024 19:25:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EB4C6E2A2B; Fri, 23 Aug 2024 19:25:46 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CFA3EE2A2B for ; Fri, 23 Aug 2024 19:25:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E4160342FAB for ; Fri, 23 Aug 2024 19:25:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7DAA318EB for ; Fri, 23 Aug 2024 19:25:44 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1724441140.e290c3c78b7acb59393f46d1d15175d6dbfc77da.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/kernel-build.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: e290c3c78b7acb59393f46d1d15175d6dbfc77da X-VCS-Branch: master Date: Fri, 23 Aug 2024 19:25:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 45250eff-0cd5-45ba-943f-5ea0b8b33819 X-Archives-Hash: 5fc8d87ba2cc7764c72fed291ccc3b28 commit: e290c3c78b7acb59393f46d1d15175d6dbfc77da Author: Michał Górny gentoo org> AuthorDate: Wed Aug 21 15:19:07 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Fri Aug 23 19:25:40 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e290c3c7 kernel-build.eclass: Apply savedconfig on top of merged configs Move applying savedconfig from src_configure() into kernel-build_merge_configs(), in order to make it possible to override saved config options. Previously, the saved config would unconditionally overwrite everything, which could be between inconvenient and plain broken (particularly if savedconfig contained signing key paths referring to ${T}). The new logic applies saved config via merge method, on top of the default config along with ebuild and eclass overrides. However, MODULES_SIGN_KEY* and user config snippets do override saved config for convenience. Closes: https://bugs.gentoo.org/938130 Signed-off-by: Michał Górny gentoo.org> eclass/kernel-build.eclass | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index c4f3db0028a9..1eac9433b65c 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -167,8 +167,8 @@ kernel-build_pkg_setup() { # @FUNCTION: kernel-build_src_configure # @DESCRIPTION: -# Prepare the toolchain for building the kernel, get the default .config -# or restore savedconfig, and get build tree configured for modprep. +# Prepare the toolchain for building the kernel, get the .config file, +# and get build tree configured for modprep. kernel-build_src_configure() { debug-print-function ${FUNCNAME} "${@}" @@ -243,7 +243,6 @@ kernel-build_src_configure() { MAKEARGS+=( KBZIP2="lbzip2" ) fi - restore_config .config [[ -f .config ]] || die "Ebuild error: please copy default config into .config" if [[ -z "${KV_LOCALVERSION}" ]]; then @@ -594,11 +593,15 @@ kernel-build_pkg_postinst() { # @FUNCTION: kernel-build_merge_configs # @USAGE: [distro.config...] # @DESCRIPTION: -# Merge the config files specified as arguments (if any) into -# the '.config' file in the current directory, then merge -# any user-supplied configs from ${BROOT}/etc/kernel/config.d/*.config. -# The '.config' file must exist already and contain the base -# configuration. +# Merge kernel config files. The following is merged onto the '.config' +# file in the current directory, in order: +# +# 1. Config files specified as arguments. +# 2. Default module signing and compression configuration +# (if applicable). +# 3. Config saved via USE=savedconfig (if applicable). +# 4. Module signing key specified via MODULES_SIGN_KEY* variables. +# 5. User-supplied configs from ${BROOT}/etc/kernel/config.d/*.config. kernel-build_merge_configs() { debug-print-function ${FUNCNAME} "${@}" @@ -631,7 +634,7 @@ kernel-build_merge_configs() { fi if [[ ${MODULES_SIGN_KEY} == pkcs11:* || -r ${MODULES_SIGN_KEY} ]]; then echo "CONFIG_MODULE_SIG_KEY=\"${MODULES_SIGN_KEY}\"" \ - >> "${WORKDIR}/modules-sign.config" + >> "${WORKDIR}/modules-sign-key.config" elif [[ -n ${MODULES_SIGN_KEY} ]]; then die "MODULES_SIGN_KEY=${MODULES_SIGN_KEY} not found or not readable!" fi @@ -650,6 +653,15 @@ kernel-build_merge_configs() { merge_configs+=( "${WORKDIR}/module-compress.config" ) fi + restore_config "${WORKDIR}/savedconfig.config" + if [[ -f ${WORKDIR}/savedconfig.config ]]; then + merge_configs+=( "${WORKDIR}/savedconfig.config" ) + fi + + if [[ ${KERNEL_IUSE_MODULES_SIGN} ]] && use modules-sign; then + merge_configs+=( "${WORKDIR}/modules-sign-key.config" ) + fi + if [[ ${#user_configs[@]} -gt 0 ]]; then elog "User config files are being applied:" local x