Mailing List Archive

[PATCH 5/7] eclass/dotnet-pkg.eclass: add dotnet-pkg_force-compat
Signed-off-by: Maciej Bar? <xgqt@gentoo.org>
---
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
Re: [PATCH 5/7] eclass/dotnet-pkg.eclass: add dotnet-pkg_force-compat [ In reply to ]
>>>>> On Sat, 03 Feb 2024, Maciej Bar? wrote:

> +dotnet-pkg_force-compat() {
> + if [[ -z "${DOTNET_PKG_COMPAT}" ]] ; then

Quotes are not needed.