Part of
https://github.com/gentoo/gentoo/pull/37327
From ec4e55ae9fd7cc6a4833981040f051ad2a3df15b Mon Sep 17 00:00:00 2001
From: James Calligeros <
jcalligeros99@gmail.com>
Date: Sat, 29 Jun 2024 03:44:38 +0000
Subject: [PATCH] kernel-build.eclass: check that KV_FULL matches the kernel
release
We want to ensure all our installed directories are consistent and
match the kernel's own idea of its release version. Do an extra
sanity check to ensure that KV_FULL is indeed what it is supposed
to be, and bail out if it isn't.
Signed-off-by: James Calligeros <
jcalligeros99@gmail.com>
---
eclass/kernel-build.eclass | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 408837c4c57a7..6658435b92587 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -235,14 +235,22 @@ kernel-build_src_configure() {
cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die
# Now that we have a release file, set KV_FULL
+ local relfile=${WORKDIR}/build/include/config/kernel.release
if [[ -z ${KV_FULL} ]]; then
- local relfile=${WORKDIR}/build/include/config/kernel.release
KV_FULL=$(<"${relfile}") || die
fi
# Make sure we are about to build the correct kernel
if [[ ${PV} != *9999 ]]; then
local expected_ver=$(dist-kernel_PV_to_KV "${PV}")
+ local expected_rel=$(<"${relfile}")
+
+ if [[ ${KV_FULL} != ${expected_rel} ]]; then
+ eerror "KV_FULL mismatch!"
+ eerror "KV_FULL: ${KV_FULL}"
+ eerror "Expected: ${expected_rel}"
+ die "KV_FULL mism