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 2F8A315800A for ; Sun, 16 Jul 2023 12:48:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A89EE0891; Sun, 16 Jul 2023 12:48:43 +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 91492E081A for ; Sun, 16 Jul 2023 12:48:42 +0000 (UTC) References: <20230716123830.78932-1-xgqt@gentoo.org> User-agent: mu4e 1.10.4; emacs 29.0.92 From: Sam James To: gentoo-dev@lists.gentoo.org Cc: Maciej =?utf-8?Q?Bar=C4=87?= , Anna , dotnet Subject: Re: [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass Date: Sun, 16 Jul 2023 13:43:53 +0100 In-reply-to: <20230716123830.78932-1-xgqt@gentoo.org> Message-ID: <87v8ekrpi6.fsf@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: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Archives-Salt: 02853b2f-2b67-416d-874d-39cd49f4f642 X-Archives-Hash: a4a55bf3a3dfc01f70046f8daa91273f --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Maciej Bar=C4=87 writes: > Bug: https://bugs.gentoo.org/900597 > Bug: https://github.com/gentoo/gentoo/pull/29309 > Signed-off-by: Maciej Bar=C4=87 > --- 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=C4=87 > +# @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" f= iles. > +# > +# 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=3D1 > + > +# @ECLASS_VARIABLE: SYSTEM_NUGETS > +# @DESCRIPTION: > +# Location of the system NuGet packages directory. > +SYSTEM_NUGETS=3D/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=3D"https://example.com/example.tar.xz" > +# NUGET_APIS+=3D( "https://api.nuget.org/v3-flatcontainer" ) > +# SRC_URI+=3D" $(nuget_uris) " > +# @CODE > +NUGET_APIS=3D( "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 arc= hive. > +# Do not set this variable in conjunction with non-empty "NUGETS". > +if [[ "${NUGETS}" ]] || [[ ! "${NUGET_PACKAGES}" ]] ; then > + NUGET_PACKAGES=3D"${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=3D" > +# ImGui.NET-1.87.2 > +# Config.Net-4.19.0 > +# " > +# > +# inherit dotnet-pkg > +# > +# ... > +# > +# SRC_URI+=3D" $(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=3D"$(basename "${1}")" You should be able to do this with pure bash. > [...] best, sam --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOQEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZLPnIV8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZDmCAEA7dtxWJtuAo25L6via0MYn6Eo98mKAiu4wkY7 mT1W2iwA+OiFz7o/GmhA/aAFlSaE011RJLfgPVd6wkIHu9Vk+Ao= =+vxB -----END PGP SIGNATURE----- --=-=-=--