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 0879F158089 for ; Thu, 5 Oct 2023 19:11:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9470D2BC0A6; Thu, 5 Oct 2023 19:11:09 +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 33CA32BC01A for ; Thu, 5 Oct 2023 19:11:09 +0000 (UTC) From: =?UTF-8?q?Maciej=20Bar=C4=87?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Maciej=20Bar=C4=87?= Subject: [gentoo-dev] [PATCH 1/4] eclass/dotnet-pkg*: remove unnecessary auto-append of project dir Date: Thu, 5 Oct 2023 21:10:15 +0200 Message-ID: <20231005191025.12504-1-xgqt@gentoo.org> X-Mailer: git-send-email 2.41.0 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: 4c12ad03-114f-42c6-b9a1-66a2e85dff10 X-Archives-Hash: 72ee8db2427849ae2911361c6eaf15d7 Also reorder dotnet-pkg-base_foreach-solution argument positions. Signed-off-by: Maciej Barć --- eclass/dotnet-pkg-base.eclass | 56 ++++++++++++++--------------------- eclass/dotnet-pkg.eclass | 6 ++-- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/eclass/dotnet-pkg-base.eclass b/eclass/dotnet-pkg-base.eclass index c7f2e031d..e2659a829 100644 --- a/eclass/dotnet-pkg-base.eclass +++ b/eclass/dotnet-pkg-base.eclass @@ -305,35 +305,37 @@ dotnet-pkg-base_info() { } # @FUNCTION: dotnet-pkg-base_foreach-solution -# @USAGE: [directory] +# @USAGE: ... # @DESCRIPTION: # Execute a function for each solution file (.sln) in a specified directory. # This function may yield no real results because solutions are discovered # automatically. # -# Optional "directory" argument defaults to the current directory path. -# -# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass. +# Used by "dotnet-pkg_src_configure" and "dotnet-pkg_src_test" from +# the "dotnet-pkg" eclass. dotnet-pkg-base_foreach-solution() { debug-print-function "${FUNCNAME[0]}" "${@}" + local directory="${1}" + shift + local dotnet_solution local dotnet_solution_name while read -r dotnet_solution ; do dotnet_solution_name="$(basename "${dotnet_solution}")" - ebegin "Running \"${1}\" for solution: \"${dotnet_solution_name}\"" - "${1}" "${dotnet_solution}" + ebegin "Running \"${@}\" for solution: \"${dotnet_solution_name}\"" + "${@}" "${dotnet_solution}" eend $? "${FUNCNAME[0]}: failed for solution: \"${dotnet_solution}\"" || die - done < <(find "${2:-.}" -maxdepth 1 -type f -name "*.sln") + done < <(find "${directory}" -maxdepth 1 -type f -name "*.sln") } # @FUNCTION: dotnet-pkg-base_restore -# @USAGE: [directory] [args] ... +# @USAGE: [args] ... # @DESCRIPTION: -# Restore the package using "dotnet restore" in a specified directory. -# -# Optional "directory" argument defaults to the current directory path. +# Restore the package using "dotnet restore". +# Restore 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. @@ -342,14 +344,6 @@ dotnet-pkg-base_foreach-solution() { dotnet-pkg-base_restore() { debug-print-function "${FUNCNAME[0]}" "${@}" - local directory - if [[ "${1}" ]] ; then - directory="${1}" - shift - else - directory="$(pwd)" - fi - local -a restore_args=( --runtime "${DOTNET_PKG_RUNTIME}" --source "${NUGET_PACKAGES}" @@ -357,7 +351,7 @@ dotnet-pkg-base_restore() { "${@}" ) - edotnet restore "${restore_args[@]}" "${directory}" + edotnet restore "${restore_args[@]}" } # @FUNCTION: dotnet-pkg-base_restore_tools @@ -388,11 +382,11 @@ dotnet-pkg-base_restore_tools() { } # @FUNCTION: dotnet-pkg-base_build -# @USAGE: [directory] [args] ... +# @USAGE: [args] ... # @DESCRIPTION: # Build the package using "dotnet build" in a specified directory. -# -# Optional "directory" argument defaults to the current directory path. +# 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. @@ -401,14 +395,6 @@ dotnet-pkg-base_restore_tools() { dotnet-pkg-base_build() { debug-print-function "${FUNCNAME[0]}" "${@}" - local directory - if [[ "${1}" ]] ; then - directory="${1}" - shift - else - directory="$(pwd)" - fi - local -a build_args=( --configuration "${DOTNET_PKG_CONFIGURATION}" --no-restore @@ -416,7 +402,6 @@ dotnet-pkg-base_build() { --output "${DOTNET_PKG_OUTPUT}" --runtime "${DOTNET_PKG_RUNTIME}" -maxCpuCount:$(makeopts_jobs) - "${@}" ) if ! use debug ; then @@ -426,7 +411,12 @@ dotnet-pkg-base_build() { ) fi - edotnet build "${build_args[@]}" "${directory}" + # And append "args" at the end. + build_args+=( + "${@}" + ) + + edotnet build "${build_args[@]}" } # @FUNCTION: dotnet-pkg-base_test diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass index 05886af85..201daf1ec 100644 --- a/eclass/dotnet-pkg.eclass +++ b/eclass/dotnet-pkg.eclass @@ -194,7 +194,9 @@ dotnet-pkg_src_configure() { dotnet-pkg_foreach-project \ dotnet-pkg-base_restore "${DOTNET_PKG_RESTORE_EXTRA_ARGS[@]}" - dotnet-pkg-base_foreach-solution dotnet-pkg-base_restore "$(pwd)" + dotnet-pkg-base_foreach-solution \ + "$(pwd)" \ + dotnet-pkg-base_restore "${DOTNET_PKG_RESTORE_EXTRA_ARGS[@]}" } # @FUNCTION: dotnet-pkg_src_compile @@ -223,7 +225,7 @@ dotnet-pkg_src_compile() { # will execute wrong or incomplete test suite. Maintainers should inspect if # any and/or correct tests are ran. dotnet-pkg_src_test() { - dotnet-pkg-base_foreach-solution dotnet-pkg-base_test "$(pwd)" + dotnet-pkg-base_foreach-solution "$(pwd)" dotnet-pkg-base_test } # @FUNCTION: dotnet-pkg_src_install -- 2.41.0