public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH] linux-mod-r1.eclass: warn if KV does not match virtual/dist-kernel
Date: Tue, 30 Jan 2024 12:07:44 +0100	[thread overview]
Message-ID: <7acfff74-c267-4215-9913-55dd0aab0b20@gentoo.org> (raw)

 From 3a3a69379650af341fa318d8f2d1533885b52d0e Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Date: Mon, 29 Jan 2024 10:58:11 +0100
Subject: [PATCH] linux-mod-r1.eclass: warn if KV does not match
  virtual/dist-kernel

We have no mechanism to ensure that we build the kernel modules for
the same kernel version as the version we will record in the 
virtual/dist-kernel
subslot dependency. This does not fix this problem, but it does add a 
warning
to ensure users are aware that, for example, built binpkgs are going to have
wrong dependency metadata.

Bug: https://bugs.gentoo.org/923025
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
  eclass/linux-mod-r1.eclass | 20 +++++++++++++++++++-
  1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass
index 67a4b64eb4815..8d384c2b30c88 100644
--- a/eclass/linux-mod-r1.eclass
+++ b/eclass/linux-mod-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2

  # @ECLASS: linux-mod-r1.eclass
@@ -650,6 +650,24 @@ _modules_prepare_kernel() {
  	fi

  	linux-info_pkg_setup
+
+	if use dist-kernel &&
+		! has_version "~virtual/dist-kernel-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+	then
+		ewarn
+		ewarn "The kernel modules in ${CATEGORY}/${PN} are being built for"
+		ewarn "kernel version ${KV_FULL}. But this does not match the"
+		ewarn "installed version of virtual/dist-kernel."
+		ewarn
+		ewarn "If this is not intentional, the problem may be corrected by"
+		ewarn "using \"eselect kernel\" to set the default kernel version to"
+		ewarn "the same version as the installed version of virtual/dist-kernel."
+		ewarn
+		ewarn "If the distribution kernel is being downgraded, ensure that"
+		ewarn "virtual/dist-kernel is also downgraded to the same version"
+		ewarn "before rebuilding external kernel modules."
+		ewarn
+	fi
  }

  # @FUNCTION: _modules_prepare_sign


             reply	other threads:[~2024-01-30 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 11:07 Andrew Ammerlaan [this message]
2024-01-30 22:41 ` [gentoo-dev] [PATCH] linux-mod-r1.eclass: warn if KV does not match virtual/dist-kernel Mike Pagano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7acfff74-c267-4215-9913-55dd0aab0b20@gentoo.org \
    --to=andrewammerlaan@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox