• [gentoo-dev] [PATCH 1/2] kernel-build.eclass: Apply savedconfig on top

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Thu Aug 22 07:30:02 2024
    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 <mgorny@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 @@