From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 241F31581D3 for ; Fri, 17 May 2024 23:05:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9AC61E2A4E; Fri, 17 May 2024 23:05:38 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6F410E2A4D for ; Fri, 17 May 2024 23:05:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F37EF33BE26 for ; Fri, 17 May 2024 23:05:36 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 196971AA6 for ; Fri, 17 May 2024 23:05:35 +0000 (UTC) From: "Ionen Wolkens" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ionen Wolkens" Message-ID: <1715987019.166cfd020d65a3c4189a0897fa2dc11fa503211f.ionen@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/linux-mod-r1.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ionen X-VCS-Committer-Name: Ionen Wolkens X-VCS-Revision: 166cfd020d65a3c4189a0897fa2dc11fa503211f X-VCS-Branch: master Date: Fri, 17 May 2024 23:05:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 790ec74b-ad7c-4220-a06e-e52d5815384a X-Archives-Hash: 5189c22120600a44cc4cf5ac9490139b commit: 166cfd020d65a3c4189a0897fa2dc11fa503211f Author: Ionen Wolkens gentoo org> AuthorDate: Fri May 17 21:55:03 2024 +0000 Commit: Ionen Wolkens gentoo org> CommitDate: Fri May 17 23:03:39 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=166cfd02 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 gentoo.org> eclass/linux-mod-r1.eclass | 47 ++++++++++++++++++++++++---------------------- 1 file 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