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 F2C5C15815E for ; Sat, 3 Feb 2024 16:25:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DA8962BC05A; Sat, 3 Feb 2024 16:24:38 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 93CAA2BC057 for ; Sat, 3 Feb 2024 16:24:38 +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 4/7] eclass/dotnet-pkg*: add dotnet-pkg_remove-bad Date: Sat, 3 Feb 2024 17:24:15 +0100 Message-ID: <20240203162422.91906-4-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: 618df7b9-2f02-4d67-8ee6-59feb6801854 X-Archives-Hash: 63e31b9a7e554f0fd8b2a625345c5835 Signed-off-by: Maciej Barć --- eclass/dotnet-pkg-base.eclass | 15 +++++++++++++ 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 94cb8c0e0..e4b275f81 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: +# @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: ... # @DESCRIPTION: diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 9d78f463b..94f5c5a28 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: +# @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 } -- 2.43.0