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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D8E56158041 for ; Tue, 12 Mar 2024 00:38:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27728E2A02; Tue, 12 Mar 2024 00:38:45 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9BBCE2A02 for ; Tue, 12 Mar 2024 00:38:44 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0B251342FFD for ; Tue, 12 Mar 2024 00:38:44 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 75191FCB for ; Tue, 12 Mar 2024 00:38:42 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1710203907.f51cd5b64c14ddfb83488a12d538c66a4a309376.floppym@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/linux-info.eclass X-VCS-Directories: eclass/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: f51cd5b64c14ddfb83488a12d538c66a4a309376 X-VCS-Branch: master Date: Tue, 12 Mar 2024 00:38:42 +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: 92d553eb-38ea-4b0e-b499-fd88301a43db X-Archives-Hash: 43d950319ac45de66c1805451abaa55c commit: f51cd5b64c14ddfb83488a12d538c66a4a309376 Author: Mike Gilbert gentoo org> AuthorDate: Sat Mar 9 19:16:26 2024 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Tue Mar 12 00:38:27 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f51cd5b6 linux-info.eclass: improve binpkg handling When installing a binpkg, Portage will restore the ebuild environment from when the binpkg was built. The stored values for KV_* may be different from the values that would be detected on the current system. To work around this, unset some key variables in linux-info_get_any_version when MERGE_TYPE == binary. Also, only look for the running kernel version: we can't possibly need a full kernel source tree when installing a package that has already been compiled. This gives a nice speedup as well. Closes: https://bugs.gentoo.org/926063 Signed-off-by: Mike Gilbert gentoo.org> eclass/linux-info.eclass | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass index d0a3c96e6b05..864594f607ca 100644 --- a/eclass/linux-info.eclass +++ b/eclass/linux-info.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: linux-info.eclass @@ -696,11 +696,17 @@ linux-info_get_any_version() { die "${FUNCNAME}() called on non-Linux system, please fix the ebuild" fi - if ! get_version; then + if [[ ${MERGE_TYPE} == binary && -z ${LINUX_INFO_BINARY_RESET} ]]; then + unset KV_FULL _LINUX_CONFIG_EXISTS_DONE KV_OUT_DIR + LINUX_INFO_BINARY_RESET=1 + fi + + if [[ ${MERGE_TYPE} != binary ]] && ! get_version; then ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version" - if ! get_running_version; then - die "Unable to determine any Linux Kernel version, please report a bug" - fi + fi + + if [[ -z ${KV_FULL} ]] && ! get_running_version; then + die "Unable to determine any Linux Kernel version, please report a bug" fi }