Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] linux-info.eclass: Support for not checking for a running kernel version or an installed version
Date: Thu, 11 Aug 2022 22:39:20
Message-Id: 6e0f0122-616a-c39b-1a0a-92c7ab0db0c7@gentoo.org
1 This goes along with not checking for a .config.
2 This change was requested to have the ability to not check for either a running or installed kernel
3
4
5 Signed-off-by: Mike Pagano <mpagano@g.o>
6 ---
7 eclass/linux-info.eclass | 18 ++++++++++++++++++
8 1 file changed, 18 insertions(+)
9
10 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
11 index 8925f83b6..82bc7fe53 100644
12 --- a/eclass/linux-info.eclass
13 +++ b/eclass/linux-info.eclass
14 @@ -140,6 +140,16 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
15 # A read-only variable. It's a string containing the kernel object directory, will be KV_DIR unless
16 # KBUILD_OUTPUT is used. This should be used for referencing .config.
17
18 +
19 +# @ECLASS_VARIABLE: SKIP_KERNEL_CHECK
20 +# @USER_VARIABLE
21 +# @DEFAULT_UNSET
22 +# @DESCRIPTION:
23 +# Do not check for kernel sources or a running kernel version
24 +# Main use-case is for chroots
25 +# This is a user flag and should under _no circumstances_ be set in the ebuild.
26 +: ${SKIP_KERNEL_CHECK:=""}
27 +
28 # And to ensure all the weirdness with crosscompile
29 inherit toolchain-funcs
30 [[ ${EAPI:-0} == [0123456] ]] && inherit eapi7-ver
31 @@ -339,6 +349,9 @@ linux_config_path() {
32 # This function verifies that the current kernel is configured (it checks against the existence of .config)
33 # otherwise it dies.
34 require_configured_kernel() {
35 +
36 + [[ -n ${SKIP_KERNEL_CHECK} ]] && return
37 +
38 if ! use kernel_linux; then
39 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild"
40 fi
41 @@ -489,6 +502,8 @@ get_version() {
42
43 local tmplocal
44
45 + [[ -n ${SKIP_KERNEL_CHECK} ]] && return
46 +
47 # no need to execute this twice assuming KV_FULL is populated.
48 # we can force by unsetting KV_FULL
49 [ -n "${KV_FULL}" ] && return 0
50 @@ -697,6 +712,9 @@ check_kernel_built() {
51 fi
52
53 # if we haven't determined the version yet, we need to
54 +
55 + [[ -n ${SKIP_KERNEL_CHECK} ]] && return
56 +
57 require_configured_kernel
58
59 local versionh_path
60 --
61 2.35.1
62
63
64
65 --
66 Mike Pagano
67 Gentoo Developer - Kernel Project
68 Gentoo Sources - Lead
69 E-Mail : mpagano@g.o
70 GnuPG FP : 52CC A0B0 F631 0B17 0142 F83F 92A6 DBEC 81F2 B137
71 Public Key : http://http://pgp.mit.edu/pks/lookup?search=0x92A6DBEC81F2B137&op=index

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature