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 A96A815800A for ; Sun, 16 Jul 2023 13:44:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6FFC1E08DB; Sun, 16 Jul 2023 13:44:41 +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 2A877E0877 for ; Sun, 16 Jul 2023 13:44:41 +0000 (UTC) Message-ID: Date: Sun, 16 Jul 2023 15:44:35 +0200 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass Content-Language: en-US, pl-PL To: Sam James , gentoo-dev@lists.gentoo.org Cc: Anna , dotnet References: <20230716123830.78932-1-xgqt@gentoo.org> <87v8ekrpi6.fsf@gentoo.org> From: =?UTF-8?Q?Maciej_Bar=c4=87?= In-Reply-To: <87v8ekrpi6.fsf@gentoo.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Archives-Salt: 12a0d81a-a36c-43e6-99ce-ccb357ce19fa X-Archives-Hash: f20c226a363aa3b7d53757d0a1429320 >> +# @ECLASS_VARIABLE: SYSTEM_NUGETS >> +# @DESCRIPTION: >> +# Location of the system NuGet packages directory. >> +SYSTEM_NUGETS=/opt/dotnet-nugets >> + > > Not to bikeshed too hard, but wonder if this should be another > directory. > Given what this is used for I think it is fitting. >> +# @ECLASS_VARIABLE: NUGET_APIS >> +# @DESCRIPTION: >> +# NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads. >> +# Set or append to this variable post-inherit, but before calling >> +# the "nuget_uris" function, preferably just before "SRC_URI". > > Is there a reason we don't just mandate this per-inherit? Feels like > it'd be cleaner there. > Lots of repetitions, only necessary in special cases, like pwsh from-source ebuild. >> +# Example: >> +# @CODE >> +# NUGETS=" >> +# ImGui.NET-1.87.2 >> +# Config.Net-4.19.0 >> +# " >> +# >> +# inherit dotnet-pkg >> +# >> +# ... >> +# >> +# SRC_URI+=" $(nuget_uris) " >> +# @CODE > > Can we use the approach we're doing w/ cargo.eclass, so this isn't > the default option? (i.e. set a global variable instead). > I believe my and navi work predates that cargo.eclass mechanism. I stray away from rust pkgs and was not aware of it. I doubt I will have time to check it out. Can you explain the better approach? >> + local nuget_name="$(basename "${1}")" > > You should be able to do this with pure bash. > Yup :) W dniu 16.07.2023 o 14:43, Sam James pisze: > > Maciej Barć writes: > >> Bug: https://bugs.gentoo.org/900597 >> Bug: https://github.com/gentoo/gentoo/pull/29309 >> Signed-off-by: Maciej Barć >> --- > > First, thank you to you & navi for working on this. It's long overdue. > > Left some small comments below. > >> eclass/nuget.eclass | 192 ++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 192 insertions(+) >> create mode 100644 eclass/nuget.eclass >> >> diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass >> new file mode 100644 >> index 0000000000..cbc9bae4a1 >> --- /dev/null >> +++ b/eclass/nuget.eclass >> @@ -0,0 +1,192 @@ >> +# Copyright 1999-2023 Gentoo Authors >> +# Distributed under the terms of the GNU General Public License v2 >> + >> +# @ECLASS: nuget.eclass >> +# @MAINTAINER: >> +# Gentoo Dotnet project >> +# @AUTHOR: >> +# Anna Figueiredo Gomes >> +# Maciej Barć >> +# @SUPPORTED_EAPIS: 7 8 >> +# @BLURB: common functions and variables for handling .NET NuGets >> +# @DESCRIPTION: >> +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files. >> +# >> +# This eclass does not export any phase functions, for that see >> +# the "dotnet-pkg" eclass. >> + >> +case "${EAPI}" in >> + 7 | 8 ) >> + : >> + ;; >> + * ) >> + die "${ECLASS}: EAPI ${EAPI} unsupported." >> + ;; >> +esac >> + >> +if [[ -z ${_NUGET_ECLASS} ]] ; then >> +_NUGET_ECLASS=1 >> + >> +# @ECLASS_VARIABLE: SYSTEM_NUGETS >> +# @DESCRIPTION: >> +# Location of the system NuGet packages directory. >> +SYSTEM_NUGETS=/opt/dotnet-nugets >> + > > Not to bikeshed too hard, but wonder if this should be another > directory. > >> +# @ECLASS_VARIABLE: NUGET_APIS >> +# @DESCRIPTION: >> +# NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads. >> +# Set or append to this variable post-inherit, but before calling >> +# the "nuget_uris" function, preferably just before "SRC_URI". > > Is there a reason we don't just mandate this per-inherit? Feels like > it'd be cleaner there. > >> +# >> +# Example: >> +# @CODE >> +# SRC_URI="https://example.com/example.tar.xz" >> +# NUGET_APIS+=( "https://api.nuget.org/v3-flatcontainer" ) >> +# SRC_URI+=" $(nuget_uris) " >> +# @CODE >> +NUGET_APIS=( "https://api.nuget.org/v3-flatcontainer" ) >> + >> +# @ECLASS_VARIABLE: NUGET_PACKAGES >> +# @DEFAULT_UNSET >> +# @PRE_INHERIT >> +# @DESCRIPTION: >> +# Path from where NuGets will be restored from. >> +# Defaults to ${T}/nugets for use with "nuget_uris" but may be set to a custom >> +# location to, for example, restore NuGets extracted form a prepared archive. >> +# Do not set this variable in conjunction with non-empty "NUGETS". >> +if [[ "${NUGETS}" ]] || [[ ! "${NUGET_PACKAGES}" ]] ; then >> + NUGET_PACKAGES="${T}"/nugets >> +fi >> +export NUGET_PACKAGES >> + >> +# @ECLASS_VARIABLE: NUGETS >> +# @DEFAULT_UNSET >> +# @PRE_INHERIT >> +# @DESCRIPTION: >> +# String containing all NuGet packages that need to be downloaded. >> +# Used by "nuget_uris". >> +# >> +# Example: >> +# @CODE >> +# NUGETS=" >> +# ImGui.NET-1.87.2 >> +# Config.Net-4.19.0 >> +# " >> +# >> +# inherit dotnet-pkg >> +# >> +# ... >> +# >> +# SRC_URI+=" $(nuget_uris) " >> +# @CODE > > Can we use the approach we're doing w/ cargo.eclass, so this isn't > the default option? (i.e. set a global variable instead). > >> [...] >> +# @FUNCTION: nuget_link >> +# @USAGE: >> +# @DESCRIPTION: >> +# Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES" >> +# directory. >> +# >> +# Example: >> +# @CODE >> +# nuget_link "${DISTDIR}"/pkg.0.nupkg >> +# @CODE >> +# >> +# This function is used inside "dotnet-pkg_src_unpack" >> +# from the "dotnet-pkg" eclass. >> +nuget_link() { >> + [[ ! "${1}" ]] && die "${FUNCNAME}: no nuget path given" >> + >> + mkdir -p "${NUGET_PACKAGES}" || die >> + >> + local nuget_name="$(basename "${1}")" > > You should be able to do this with pure bash. > >> [...] > > best, > sam -- Have a great day! ~ Maciej XGQT Barć xgqt@gentoo.org Gentoo Linux developer (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt 9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C