diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-02-10 17:34:25 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-02-10 17:34:25 +0000 |
commit | 0bb42730e8fc9c8e571f12e3189c6c6f8d532c24 (patch) | |
tree | cba6032fbed30be2b0764494607c3ec9dda0c18a /eclass/dotnet-pkg-base.eclass | |
parent | cc901a8ce7c6bfe97e3b4f048619693d360ae348 (diff) |
gentoo auto-resync : 10:02:2024 - 17:34:25
Diffstat (limited to 'eclass/dotnet-pkg-base.eclass')
-rw-r--r-- | eclass/dotnet-pkg-base.eclass | 124 |
1 files changed, 80 insertions, 44 deletions
diff --git a/eclass/dotnet-pkg-base.eclass b/eclass/dotnet-pkg-base.eclass index 1a9d311208e2..a2d95f15a2fb 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 @@ -68,13 +68,19 @@ if [[ ${CATEGORY}/${PN} != dev-dotnet/dotnet-runtime-nugets ]] ; then die "${ECLASS}: DOTNET_PKG_COMPAT not set" fi - DOTNET_PKG_RDEPS+=" virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} " - DOTNET_PKG_BDEPS+=" ${DOTNET_PKG_RDEPS} " + DOTNET_PKG_RDEPS+=" + virtual/dotnet-sdk:${DOTNET_PKG_COMPAT} + " + DOTNET_PKG_BDEPS+=" + ${DOTNET_PKG_RDEPS} + " # Special package "dev-dotnet/csharp-gentoodotnetinfo" used for information # gathering, example for usage see the "dotnet-pkg-base_info" function. if [[ ${CATEGORY}/${PN} != dev-dotnet/csharp-gentoodotnetinfo ]] ; then - DOTNET_PKG_BDEPS+=" dev-dotnet/csharp-gentoodotnetinfo " + DOTNET_PKG_BDEPS+=" + dev-dotnet/csharp-gentoodotnetinfo + " fi IUSE+=" debug " @@ -222,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)" @@ -304,6 +309,21 @@ dotnet-pkg-base_info() { fi } +# @FUNCTION: dotnet-pkg-base_sln-remove +# @USAGE: <solution> <project> +# @DESCRIPTION: +# Remove a project from a given solution file. +# +# Used by "dotnet-pkg_remove-bad" from the "dotnet-pkg" eclass. +dotnet-pkg-base_sln-remove() { + debug-print-function "${FUNCNAME[0]}" "${@}" + + [[ -z ${1} ]] && die "${FUNCNAME[0]}: no solution file specified" + [[ -z ${2} ]] && die "${FUNCNAME[0]}: no project file specified" + + edotnet sln "${1}" remove "${2}" +} + # @FUNCTION: dotnet-pkg-base_foreach-solution # @USAGE: <directory> <args> ... # @DESCRIPTION: @@ -354,7 +374,7 @@ dotnet-pkg-base_restore() { edotnet restore "${restore_args[@]}" } -# @FUNCTION: dotnet-pkg-base_restore_tools +# @FUNCTION: dotnet-pkg-base_restore-tools # @USAGE: [config-file] [args] ... # @DESCRIPTION: # Restore dotnet tools for a project in the current directory. @@ -364,7 +384,7 @@ dotnet-pkg-base_restore() { # # Additionally any number of "args" maybe be given, they are appended to # the "dotnet" command invocation. -dotnet-pkg-base_restore_tools() { +dotnet-pkg-base_restore-tools() { debug-print-function "${FUNCNAME[0]}" "${@}" local -a tool_restore_args=( @@ -381,6 +401,14 @@ dotnet-pkg-base_restore_tools() { edotnet tool restore "${tool_restore_args[@]}" } +# @FUNCTION: dotnet-pkg-base_restore_tools +# @USAGE: [config-file] [args] ... +# @DESCRIPTION: +# DEPRECATED, use "dotnet-pkg-base_restore-tools" instead. +dotnet-pkg-base_restore_tools() { + dotnet-pkg-base_restore-tools "${@}" +} + # @FUNCTION: dotnet-pkg-base_build # @USAGE: [args] ... # @DESCRIPTION: @@ -388,8 +416,8 @@ dotnet-pkg-base_restore_tools() { # Build is performed in current directory unless a different directory is # passed via "args". # -# Additionally any number of "args" maybe be given, they are appended to -# the "dotnet" command invocation. +# Any number of "args" maybe be given, they are appended to the "dotnet" +# command invocation. # # Used by "dotnet-pkg_src_compile" from the "dotnet-pkg" eclass. dotnet-pkg-base_build() { @@ -420,27 +448,19 @@ dotnet-pkg-base_build() { } # @FUNCTION: dotnet-pkg-base_test -# @USAGE: [directory] [args] ... +# @USAGE: [args] ... # @DESCRIPTION: # Test the package using "dotnet test" in a specified directory. +# Test is performed in current directory unless a different directory is +# passed via "args". # -# Optional "directory" argument defaults to the current directory path. -# -# Additionally any number of "args" maybe be given, they are appended to -# the "dotnet" command invocation. +# Any number of "args" maybe be given, they are appended to the "dotnet" +# command invocation. # # Used by "dotnet-pkg_src_test" from the "dotnet-pkg" eclass. dotnet-pkg-base_test() { debug-print-function "${FUNCNAME[0]}" "${@}" - local directory - if [[ -n "${1}" ]] ; then - directory="${1}" - shift - else - directory="$(pwd)" - fi - local -a test_args=( --configuration "${DOTNET_PKG_CONFIGURATION}" --no-restore @@ -448,7 +468,7 @@ dotnet-pkg-base_test() { "${@}" ) - edotnet test "${test_args[@]}" "${directory}" + edotnet test "${test_args[@]}" } # @FUNCTION: dotnet-pkg-base_install @@ -482,7 +502,7 @@ dotnet-pkg-base_launcherinto() { _DOTNET_PKG_LAUNCHERDEST="${1}" } -# @FUNCTION: dotnet-pkg-base_append_launchervar +# @FUNCTION: dotnet-pkg-base_append-launchervar # @USAGE: <variable-setting> # @DESCRIPTION: # Appends a given variable setting to the "_DOTNET_PKG_LAUNCHERVARS". @@ -498,7 +518,7 @@ dotnet-pkg-base_launcherinto() { # @CODE # # For more info see the "_DOTNET_PKG_LAUNCHERVARS" variable. -dotnet-pkg-base_append_launchervar() { +dotnet-pkg-base_append-launchervar() { debug-print-function "${FUNCNAME[0]}" "${@}" [[ -z ${1} ]] && die "${FUNCNAME[0]}: no variable setting specified" @@ -506,6 +526,14 @@ dotnet-pkg-base_append_launchervar() { _DOTNET_PKG_LAUNCHERVARS+=( "${1}" ) } +# @FUNCTION: dotnet-pkg-base_append_launchervar +# @USAGE: <variable-setting> +# @DESCRIPTION: +# DEPRECATED, use "dotnet-pkg-base_append-launchervar" instead. +dotnet-pkg-base_append_launchervar() { + dotnet-pkg-base_append-launchervar "${@}" +} + # @FUNCTION: dotnet-pkg-base_dolauncher # @USAGE: <executable-path> [filename] # @DESCRIPTION: @@ -573,7 +601,7 @@ dotnet-pkg-base_dolauncher() { doexe "${executable_target}" } -# @FUNCTION: dotnet-pkg-base_dolauncher_portable +# @FUNCTION: dotnet-pkg-base_dolauncher-portable # @USAGE: <dll-path> <filename> # @DESCRIPTION: # Make a wrapper script to launch a .NET DLL file built from a .NET package. @@ -584,12 +612,12 @@ dotnet-pkg-base_dolauncher() { # # Example: # @CODE -# dotnet-pkg-base_dolauncher_portable \ +# dotnet-pkg-base_dolauncher-portable \ # /usr/share/${P}/GentooDotnetInfo.dll gentoo-dotnet-info # @CODE # # The path is prepended by "EPREFIX". -dotnet-pkg-base_dolauncher_portable() { +dotnet-pkg-base_dolauncher-portable() { debug-print-function "${FUNCNAME[0]}" "${@}" local dll_path="${1}" @@ -615,4 +643,12 @@ dotnet-pkg-base_dolauncher_portable() { doexe "${executable_target}" } +# @FUNCTION: dotnet-pkg-base_dolauncher_portable +# @USAGE: <dll-path> <filename> +# @DESCRIPTION: +# DEPRECATED, use "dotnet-pkg-base_dolauncher-portable" instead. +dotnet-pkg-base_dolauncher_portable() { + dotnet-pkg-base_dolauncher-portable "${@}" +} + fi |