summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-05-17 17:55:03 -0400
committerIonen Wolkens <ionen@gentoo.org>2024-05-17 19:03:39 -0400
commit166cfd020d65a3c4189a0897fa2dc11fa503211f (patch)
treeecdbed1707bd06ada26883c455258addcec86b64 /eclass/linux-mod-r1.eclass
parentlinux-mod-r1.eclass: update depmod.d comment (diff)
downloadgentoo-166cfd020d65a3c4189a0897fa2dc11fa503211f.tar.gz
gentoo-166cfd020d65a3c4189a0897fa2dc11fa503211f.tar.bz2
gentoo-166cfd020d65a3c4189a0897fa2dc11fa503211f.zip
linux-mod-r1.eclass: minor style & misc adjustments
No real functional changes: * fix indent for dist-kernel_reinstall_initramfs * explicit return 0 to avoid returning a failure, not that return codes should ever be checked for that function * use printf %q for LD path in case of unlikely spaces * move dist-kernel version sanity check inside _modules_sanity_kernelversion which fits and is called from the same function the check was in (also document it) Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass/linux-mod-r1.eclass')
-rw-r--r--eclass/linux-mod-r1.eclass47
1 files changed, 25 insertions, 22 deletions
diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass
index 6d35a7068bfb..43c5a7d7b140 100644
--- a/eclass/linux-mod-r1.eclass
+++ b/eclass/linux-mod-r1.eclass
@@ -499,7 +499,7 @@ linux-mod-r1_pkg_postinst() {
if [[ -z ${ROOT} && ${MODULES_INITRAMFS_IUSE} ]] &&
use dist-kernel && use ${MODULES_INITRAMFS_IUSE#+}
then
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
fi
if has_version virtual/dist-kernel && ! use dist-kernel; then
@@ -695,24 +695,6 @@ _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
@@ -857,7 +839,7 @@ _modules_prepare_toolchain() {
# can work but raises concerns about breaking packages that may use these
if linux_chkconfig_present LTO_CLANG_THIN && tc-ld-is-lld; then
KERNEL_LD=${T}/linux-mod-r1_ld.lld
- printf '#!/usr/bin/env sh\nexec %s "${@}" --thinlto-cache-dir=\n' \
+ printf '#!/usr/bin/env sh\nexec %q "${@}" --thinlto-cache-dir=\n' \
"${LD}" > "${KERNEL_LD}" || die
chmod +x -- "${KERNEL_LD}" || die
fi
@@ -899,7 +881,7 @@ _modules_prepare_toolchain() {
# If enabled in the kernel configuration, this compresses the given
# modules using the same format.
_modules_process_compress() {
- use modules-compress || return
+ use modules-compress || return 0
local -a compress
if linux_chkconfig_present MODULE_COMPRESS_XZ; then
@@ -1144,7 +1126,10 @@ _modules_sanity_kernelbuilt() {
# @DESCRIPTION:
# Prints a warning if the kernel version is greater than to
# MODULES_KERNEL_MAX (while only considering same amount of version
-# components), or aborts if it is less than MODULES_KERNEL_MIN
+# components), or aborts if it is less than MODULES_KERNEL_MIN.
+#
+# With USE=dist-kernel, also warn if virtual/dist-kernel is of a
+# different version than the one being built against.
_modules_sanity_kernelversion() {
local kv=${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}
@@ -1194,6 +1179,24 @@ _modules_sanity_kernelversion() {
ewarn
fi
fi
+
+ 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_sanity_modversion