mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-06 00:48:18 -07:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user