public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: orbea <orbea@riseup.net>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] cargo.eclass: add CARGO_TOML_DIR
Date: Wed, 24 Jan 2024 10:59:45 -0800	[thread overview]
Message-ID: <20240124105945.0bfe1396@Akita> (raw)
In-Reply-To: <20240123114313.6b51a617@Akita>

On Tue, 23 Jan 2024 11:43:13 -0800
orbea <orbea@riseup.net> wrote:

> On Tue, 23 Jan 2024 17:48:25 +0100
> Michał Górny <mgorny@gentoo.org> wrote:
> 
> > On Tue, 2024-01-23 at 06:13 -0800, orbea wrote:  
> > > On Tue, 23 Jan 2024 04:48:02 +0100
> > > Michał Górny <mgorny@gentoo.org> wrote:
> > >     
> > > > On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:    
> > > > > This is required when cargo_live_src_unpack needs to be find a
> > > > > Cargo.toml file in a directory other than ${S}
> > > > > 
> > > > > Signed-off-by: orbea <orbea@riseup.net>
> > > > > ---
> > > > >  eclass/cargo.eclass | 11 ++++++++++-
> > > > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
> > > > > index 3bdbb5e3ec64..692623382c56 100644
> > > > > --- a/eclass/cargo.eclass
> > > > > +++ b/eclass/cargo.eclass
> > > > > @@ -116,6 +116,15 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
> > > > >  # other src_functions of this eclass.
> > > > >  # Note that cargo_gen_config is automatically called by
> > > > > cargo_src_unpack. 
> > > > > +# @ECLASS_VARIABLE: CARGO_TOML_DIR
> > > > > +# @DEFAULT_UNSET
> > > > > +# @DESCRIPTION:
> > > > > +# Optional variable containing the directory path to the
> > > > > Cargo.toml file. +# Should be defined before calling
> > > > > cargo_live_src_unpack. +#
> > > > > +# This is required for live ebuilds when Cargo.toml in a
> > > > > directory other +# than ${S}.
> > > > > +
> > > > >  # @ECLASS_VARIABLE: myfeatures
> > > > >  # @DEFAULT_UNSET
> > > > >  # @DESCRIPTION:
> > > > > @@ -403,7 +412,7 @@ cargo_live_src_unpack() {
> > > > >  		umask "${EVCS_UMASK}" || die "Bad options to
> > > > > umask: ${EVCS_UMASK}" fi
> > > > >  
> > > > > -	pushd "${S}" > /dev/null || die
> > > > > +	pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die
> > > > >  
> > > > 
> > > > Please respect the current variable style.    
> > > 
> > > Sorry for being dense, but could you elaborate what you mean?
> > >     
> > 
> > You changed '${S}' to '$S' which goes against the established style.
> >   
> 
> Thanks for spelling that out, I corrected the patch.
> 
> -------------
> 
> This is required when cargo_live_src_unpack needs to be find a
> Cargo.toml file in a directory other than ${S}. This may happen in
> cases where the package has a rust component within a subdirectory
> where the program otherwise use another language.
> 
> Signed-off-by: orbea <orbea@riseup.net>
> ---
>  eclass/cargo.eclass | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
> index 3bdbb5e3ec64..f88b3b82d8ed 100644
> --- a/eclass/cargo.eclass
> +++ b/eclass/cargo.eclass
> @@ -116,6 +116,15 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
>  # other src_functions of this eclass.
>  # Note that cargo_gen_config is automatically called by
> cargo_src_unpack. 
> +# @ECLASS_VARIABLE: CARGO_TOML_DIR
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Optional variable containing the directory path to the Cargo.toml
> file. +# Should be defined before calling cargo_live_src_unpack.
> +#
> +# This is required for live ebuilds when Cargo.toml in a directory
> other +# than ${S}.
> +
>  # @ECLASS_VARIABLE: myfeatures
>  # @DEFAULT_UNSET
>  # @DESCRIPTION:
> @@ -403,7 +412,7 @@ cargo_live_src_unpack() {
>  		umask "${EVCS_UMASK}" || die "Bad options to umask:
> ${EVCS_UMASK}" fi
>  
> -	pushd "${S}" > /dev/null || die
> +	pushd "${CARGO_TOML_DIR:-${S}}" > /dev/null || die
>  
>  	# Respect user settings before cargo_gen_config is called.
>  	if [[ ! ${CARGO_TERM_COLOR} ]]; then

On second thought maybe this patch is not necessary? A trivial
workaround is to just set ${S} for cargo_live_src_unpack, for example...

  S="${S}"/path/to/rust/dir \
  cargo_live_src_unpack

Would this be something that is future proof or is it better to have a
dedicated variable to handle it?



  reply	other threads:[~2024-01-24 18:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 16:14 [gentoo-dev] [PATCH] profiles: workaround sandbox bug with getcwd() configure test (gl_cv_func_getcwd_path_max) Sam James
2024-01-22 16:35 ` David Seifert
2024-01-22 16:45 ` [gentoo-dev] " Arsen Arsenović
2024-01-23  3:32 ` [gentoo-dev] [PATCH] cargo.eclass: add CARGO_TOML_DIR orbea
2024-01-23  3:48   ` Michał Górny
2024-01-23 14:13     ` orbea
2024-01-23 16:48       ` Michał Górny
2024-01-23 19:43         ` orbea
2024-01-24 18:59           ` orbea [this message]
2024-01-23  4:06   ` Eli Schwartz
2024-01-23 14:11     ` orbea

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=20240124105945.0bfe1396@Akita \
    --to=orbea@riseup.net \
    --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