• [gentoo-dev] [PATCH 3/4] kernel-install.eclass: Account for PV/KV misma

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Oct 26 13:40:02 2022
    Do not assume PV and kernel version must always match. Use PV for
    kernel install directory (i.e. /usr/src/linux) but get the release
    from the kernel build directory for the module directory. Update
    preinst version check to account for live ebuilds.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/kernel-install.eclass | 67 ++++++++++++++++++++++--------------
    1 file changed, 41 insertions(+), 26 deletions(-)

    diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
    index dc77cb514b1a..9aece24bbff5 100644
    --- a/eclass/kernel-install.eclass
    +++ b/eclass/kernel-install.eclass
    @@ -403,24 +403,34 @@ kernel-install_src_test() {
    kernel-install_pkg_preinst() {
    debug-print-function ${FUNCNAME} "${@}"

    - local ver="${PV}${KV_LOCALVERSION}"
    - local kdir="${ED}/usr/src/linux-${ver}"
    - local relfile="${kdir}/include/config/kernel.release"
    - [[ ! -d ${kdir} ]] && die "Kernel directory ${kdir} not installed!"
    - [[ ! -f ${relfile} ]] && die "Release file ${relfile} not installed!"
    - local release="$(<"${relfile}")"
    - if [[ ${release} != ${PV}* ]]; then
    - eerror "Kernel release mismatch!"
    - eerror " expected (PV): ${PV}*"
    - eerror " found: ${release}"
    - eerror "Please verify that you are applying the correct patches."
    - die "Kernel release mismatch