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 5DF1315815E for ; Sat, 3 Feb 2024 16:25:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 168B62BC067; Sat, 3 Feb 2024 16:24:40 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BE87F2BC064 for ; Sat, 3 Feb 2024 16:24:39 +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 5/7] eclass/dotnet-pkg.eclass: add dotnet-pkg_force-compat Date: Sat, 3 Feb 2024 17:24:16 +0100 Message-ID: <20240203162422.91906-5-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: cf292de6-010e-4ae5-8a2d-6349c11244da X-Archives-Hash: 9428282ad185a8a5e4a8af955f7e5b34 Signed-off-by: Maciej Barć --- eclass/dotnet-pkg.eclass | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 94f5c5a28..3647eb399 100644 --- a/eclass/dotnet-pkg.eclass +++ b/eclass/dotnet-pkg.eclass @@ -156,6 +156,29 @@ DOTNET_PKG_BUILD_EXTRA_ARGS=() # For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_test". DOTNET_PKG_TEST_EXTRA_ARGS=() +# @FUNCTION: dotnet-pkg_force-compat +# @DESCRIPTION: +# This function appends special options to all "DOTNET_PKG_*_EXTRA_ARGS" +# variables in an attempt to force compatibility to the picked +# "DOTNET_PKG_COMPAT" .NET SDK version. +# +# Call this function post-inherit. +dotnet-pkg_force-compat() { + if [[ -z "${DOTNET_PKG_COMPAT}" ]] ; then + die "DOTNET_PKG_COMPAT is not set" + fi + + local -a force_extra_args=( + -p:RollForward=Major + -p:TargetFramework="net${DOTNET_PKG_COMPAT}" + -p:TargetFrameworks="net${DOTNET_PKG_COMPAT}" + ) + + DOTNET_PKG_RESTORE_EXTRA_ARGS+=( "${force_extra_args[@]}" ) + DOTNET_PKG_BUILD_EXTRA_ARGS+=( "${force_extra_args[@]}" ) + DOTNET_PKG_TEST_EXTRA_ARGS+=( "${force_extra_args[@]}" ) +} + # @FUNCTION: dotnet-pkg_pkg_setup # @DESCRIPTION: # Default "pkg_setup" for the "dotnet-pkg" eclass. -- 2.43.0