diff options
author | Maciej Barć <xgqt@gentoo.org> | 2024-02-03 14:46:22 +0100 |
---|---|---|
committer | Maciej Barć <xgqt@gentoo.org> | 2024-02-10 17:24:45 +0100 |
commit | a3351216a9ac8433912d91b53259d1c470186227 (patch) | |
tree | f8d1e8af2abb1c8e782c892412349e6cd66d7b96 /eclass | |
parent | eclass/dotnet-pkg-base.eclass: dotnet-pkg-base_test - remove directory magic (diff) | |
download | gentoo-a3351216a9ac8433912d91b53259d1c470186227.tar.gz gentoo-a3351216a9ac8433912d91b53259d1c470186227.tar.bz2 gentoo-a3351216a9ac8433912d91b53259d1c470186227.zip |
eclass/dotnet-pkg*: add dotnet-pkg_remove-bad
add new eclass feature that allows to remove projects from .NET
solution files,
the functions modified:
dotnet-pkg-base_sln-remove, dotnet-pkg_remove-bad, dotnet-pkg_src_prepare
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/dotnet-pkg-base.eclass | 15 | ||||
-rw-r--r-- | eclass/dotnet-pkg.eclass | 42 |
2 files changed, 55 insertions, 2 deletions
diff --git a/eclass/dotnet-pkg-base.eclass b/eclass/dotnet-pkg-base.eclass index ff93c1db9636..beefd1efd2da 100644 --- a/eclass/dotnet-pkg-base.eclass +++ b/eclass/dotnet-pkg-base.eclass @@ -310,6 +310,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: diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 9d78f463be77..94f5c5a280f7 100644 --- a/eclass/dotnet-pkg.eclass +++ b/eclass/dotnet-pkg.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.eclass @@ -48,6 +48,24 @@ inherit dotnet-pkg-base RDEPEND+=" ${DOTNET_PKG_RDEPS} " BDEPEND+=" ${DOTNET_PKG_BDEPS} " +# @ECLASS_VARIABLE: DOTNET_PKG_BAD_PROJECTS +# @DESCRIPTION: +# List of projects to remove from all found solution (".sln") files. +# The projects are removed in the "dotnet-pkg_src_prepare" function. +# +# This variable should be set after inheriting "dotnet-pkg.eclass". +# +# Default value is an empty array. +# +# Example: +# @CODE +# DOTNET_PKG_BAD_PROJECTS=( "${S}/BrokenTests" ) +# DOTNET_PKG_PROJECTS=( "${S}/DotnetProject" ) +# @CODE +# +# For more info see: "dotnet-pkg_remove-bad" function. +DOTNET_PKG_BAD_PROJECTS=() + # @ECLASS_VARIABLE: DOTNET_PKG_PROJECTS # @DEFAULT_UNSET # @DESCRIPTION: @@ -161,14 +179,34 @@ dotnet-pkg_src_unpack() { nuget_unpack-non-nuget-archives } +# @FUNCTION: dotnet-pkg_remove-bad +# @USAGE: <solution> +# @DESCRIPTION: +# Remove all projects specified by "DOTNET_PKG_BAD_PROJECTS" from a given +# solution file. +# +# Used by "dotnet-pkg_src_prepare". +dotnet-pkg_remove-bad() { + debug-print-function "${FUNCNAME[0]}" "${@}" + + [[ -z ${1} ]] && die "${FUNCNAME[0]}: no solution file specified" + + local bad_project + for bad_project in "${DOTNET_PKG_BAD_PROJECTS[@]}" ; do + nonfatal dotnet-pkg-base_sln-remove "${1}" "${bad_project}" + done +} + # @FUNCTION: dotnet-pkg_src_prepare # @DESCRIPTION: # Default "src_prepare" for the "dotnet-pkg" eclass. # Prepare the package sources. # -# Run "dotnet-pkg-base_remove-global-json". +# Run "dotnet-pkg-base_remove-global-json" +# and "dotnet-pkg-base_remove-bad" for each found solution file. dotnet-pkg_src_prepare() { dotnet-pkg-base_remove-global-json + dotnet-pkg-base_foreach-solution "$(pwd)" dotnet-pkg_remove-bad default } |