• [gentoo-dev] [PATCH 1/4] dist-kernel-utils.eclass: fix module cleanup w

    From Andrew Ammerlaan@21:1/5 to All on Tue Aug 6 21:10:01 2024
    When installing a binpkg -nt is not a good check because the modules in the binpkg we are installing may actually be older then what we have in root.

    Instead introduce a new function dist-kernel_get_module_suffix to find the desired compression based on USE=modules-sign and the kernel config. Then, remove only those files that do not match our desired compression.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/dist-kernel-utils.eclass | 59 +++++++++++++++++++++++++++------
    1 file changed, 49 insertions(+), 10 deletions(-)

    diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 4bc3fab44aae..0b0eb0ec8818 100644
    --- a/eclass/dist-kernel-utils.eclass
    +++ b/eclass/dist-kernel-utils.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2020-2023 Gentoo Authors
    +# Copyright 2020-2024 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: dist-kernel-utils.eclass
    @@ -159,6 +159,35 @@ dist-kernel_PV_to_KV() {
    echo "${kv}"
    }

    +# @FUNCTION: dist-kernel_get_module_suffix
    +# @USAGE: <kernel_dir>
    +# @DESCRIPTION:
    +# Returns the suffix for kernel modules based on the CONFIG_MODULES_COMPESS_* +# setting in the kernel config and USE=modules-compress. +dist-kernel_get_module_suffix() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments"
    +
    + local config=${1}/.config
    +
    + if ! in_iuse m