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 5EB6615815E for ; Sat, 3 Feb 2024 16:25:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 16A8D2BC073; Sat, 3 Feb 2024 16:24:41 +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 C45762BC070 for ; Sat, 3 Feb 2024 16:24:40 +0000 (UTC) From: =?UTF-8?q?Maciej=20Bar=C4=87?= To: gentoo-dev@lists.gentoo.org Cc: dotnet@gentoo.org, =?UTF-8?q?Maciej=20Bar=C4=87?= Subject: [gentoo-dev] [PATCH 6/7] eclass/dotnet-pkg-base.eclass: set DOTNET_ROOT Date: Sat, 3 Feb 2024 17:24:17 +0100 Message-ID: <20240203162422.91906-6-xgqt@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240203162422.91906-1-xgqt@gentoo.org> References: <20240203162422.91906-1-xgqt@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: dc288c04-1250-402d-9156-808dd60e66e4 X-Archives-Hash: 3b4f9d5c2e37ba11bd86b98b5dc17707 Signed-off-by: Maciej Barć --- eclass/dotnet-pkg-base.eclass | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/eclass/dotnet-pkg-base.eclass b/eclass/dotnet-pkg-base.eclass index e4b275f81..5f3bde340 100644 --- a/eclass/dotnet-pkg-base.eclass +++ b/eclass/dotnet-pkg-base.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: dotnet-pkg-base.eclass @@ -228,28 +228,27 @@ dotnet-pkg-base_get-runtime() { # # Used by "dotnet-pkg_pkg_setup" from the "dotnet-pkg" eclass. dotnet-pkg-base_setup() { - local dotnet_compat_impl - local dotnet_compat_impl_path - for dotnet_compat_impl in dotnet{,-bin}-${DOTNET_PKG_COMPAT} ; do - dotnet_compat_impl_path="$(type -P "${dotnet_compat_impl}")" + local -a impl_dirs=( + "${EPREFIX}/usr/$(get_libdir)/dotnet-sdk-${DOTNET_PKG_COMPAT}" + "${EPREFIX}/opt/dotnet-sdk-bin-${DOTNET_PKG_COMPAT}" + ) + local impl_exe + + local impl_dir + for impl_dir in "${impl_dirs[@]}" ; do + impl_exe="${impl_dir}/dotnet" + + if [[ -d "${impl_dir}" ]] && [[ -x "${impl_exe}" ]] ; then + DOTNET_PKG_EXECUTABLE="${impl_exe}" + DOTNET_ROOT="${impl_dir}" - if [[ -n ${dotnet_compat_impl_path} ]] ; then - DOTNET_PKG_EXECUTABLE="${dotnet_compat_impl}" break fi done - # Link "DOTNET_PKG_EXECUTABLE" to "dotnet" only for the package build. - local dotnet_spoof_path="${T}/dotnet_spoof/${DOTNET_PKG_COMPAT}" - mkdir -p "${dotnet_spoof_path}" || die - ln -s "${dotnet_compat_impl_path}" "${dotnet_spoof_path}/dotnet" || die - export PATH="${dotnet_spoof_path}:${PATH}" - - einfo "Using dotnet SDK \"${DOTNET_PKG_EXECUTABLE}\" from \"${dotnet_compat_impl_path}\"." - - # The picked "DOTNET_PKG_EXECUTABLE" should set "DOTNET_ROOT" internally - # and not rely upon this environment variable. - unset DOTNET_ROOT + einfo "Setting .NET SDK \"DOTNET_ROOT\" to \"${DOTNET_ROOT}\"" + export DOTNET_ROOT + export PATH="${DOTNET_ROOT}:${PATH}" DOTNET_PKG_RUNTIME="$(dotnet-pkg-base_get-runtime)" DOTNET_PKG_CONFIGURATION="$(dotnet-pkg-base_get-configuration)" -- 2.43.0