public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass
Date: Mon, 31 Jul 2023 07:08:09 +0200	[thread overview]
Message-ID: <bb20d326eb2575335b602a48981a9dac632e2d93.camel@gentoo.org> (raw)
In-Reply-To: <78e35eff-3e7b-8458-e705-61032bb15c6e@gentoo.org>

On Sun, 2023-07-30 at 22:01 +0200, Maciej Barć wrote:
> > > +# @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
> > > +
> > > +# @FUNCTION: nuget_uris
> > > +# @USAGE: <nuget...>
> > > +# @DESCRIPTION:
> > > +# Generates the URIs to put in SRC_URI to help fetch dependencies.
> > > +# If no arguments provided, uses the "NUGETS" variable.
> > 
> > Sounds like you're copying the old, horribly slow cargo.eclass API.
> > Don't do that, unless you have to.  Prefer variable-setting approach
> > used by modern cargo.eclass.
> > 
> 
> Please elaborate.
> 
> Maybe such mechanisms could be extracted into standalone eclass? I do 
> not know cargo, rust nor how it is used in Gentoo.
> 

Calling subshells in global scope is a very bad idea, and it is
completely unnecessary in the most common case when NUGETS are defined
prior to inherit and URIs are inserted into top-level SRC_URI.

Just look at cargo.eclass.

> > > +# @FUNCTION: nuget_link
> > > +# @USAGE: <nuget-path>
> > > +# @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="${1##*/}"
> > > +
> > > +	if [[ -f "${NUGET_PACKAGES}"/${nuget_name} ]] ; then
> > > +		ewarn "${FUNCNAME}: ${nuget_name} already exists"
> > 
> > What does that mean?  What is the user supposed to do about it?  Is it
> > normal?  If it's normal, then why are you warning about it?  If it isn't
> > normal, then why isn't this fatal?
> 
> This can happen if NuGets copied from SYSTEM_NUGETS are overwritten by 
> ones specified in ebuild.
> 
> This might be desired by ebuild author.
> 
> We need to have this logged, I think ewarn is appropriate.

ewarn is a warning for the end user.  The end user doesn't benefit from
being warned for "ebuild is doing something that might be wrong, or
might be perfectly fine, ignore this".

-- 
Best regards,
Michał Górny



  reply	other threads:[~2023-07-31  5:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 14:26 [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass Maciej Barć
2023-07-30 14:26 ` [gentoo-dev] [PATCH 2/7] eclass/dotnet-pkg-utils.eclass: " Maciej Barć
2023-07-30 19:34   ` Michał Górny
2023-07-30 20:04     ` Maciej Barć
2023-07-31  5:09       ` Michał Górny
2023-07-30 14:26 ` [gentoo-dev] [PATCH 3/7] eclass/dotnet-pkg.eclass: " Maciej Barć
2023-07-31  9:20   ` Thomas Bracht Laumann Jespersen
2023-07-30 14:26 ` [gentoo-dev] [PATCH 4/7] dev-dotnet/dotnet-runtime-nugets: new package Maciej Barć
2023-07-30 14:26 ` [gentoo-dev] [PATCH 5/7] app-eselect/eselect-dotnet: " Maciej Barć
2023-07-30 14:26 ` [gentoo-dev] [PATCH 6/7] dev-dotnet/dotnet-sdk-bin: update packaging mechanism Maciej Barć
2023-07-30 14:26 ` [gentoo-dev] [PATCH 7/7] dev-dotnet/dotnet-sdk-bin: drop old Maciej Barć
2023-07-30 19:30 ` [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass Michał Górny
2023-07-30 20:01   ` Maciej Barć
2023-07-31  5:08     ` Michał Górny [this message]
2023-07-30 20:19   ` Florian Schmaus
2023-07-31  5:02     ` Michał Górny
2023-07-31  7:53       ` Florian Schmaus
2023-07-31  9:32         ` Sam James
2023-07-31 10:49           ` Florian Schmaus
2023-07-31 11:39             ` Sam James
2023-07-31 13:53             ` Michał Górny
2023-07-31 14:20               ` Florian Schmaus
  -- strict thread matches above, loose matches on Subject: below --
2023-07-16 12:38 Maciej Barć
2023-07-16 12:43 ` Sam James
2023-07-16 13:44   ` Maciej Barć
2023-07-16 13:40 ` Ulrich Mueller
2023-07-16 13:47   ` Maciej Barć

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb20d326eb2575335b602a48981a9dac632e2d93.camel@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox