public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
@ 2019-12-06 20:09 Georgy Yakovlev
  2019-12-06 23:44 ` Sergei Trofimovich
  2019-12-07  9:56 ` Kent Fredric
  0 siblings, 2 replies; 6+ messages in thread
From: Georgy Yakovlev @ 2019-12-06 20:09 UTC (permalink / raw
  To: gentoo-dev; +Cc: Georgy Yakovlev

Default output just prints crate name.
With -vv we can see all cargo options and rustc args.

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
---
 eclass/cargo.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 5b6d1f050f1..13dd5c355fb 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -146,7 +146,7 @@ cargo_src_compile() {
 
 	export CARGO_HOME="${ECARGO_HOME}"
 
-	cargo build -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
+	cargo build -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
 		|| die "cargo build failed"
 }
 
@@ -156,7 +156,7 @@ cargo_src_compile() {
 cargo_src_install() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	cargo install -j $(makeopts_jobs) --root="${ED}/usr" $(usex debug --debug "") "$@" \
+	cargo install -vv -j $(makeopts_jobs) --root="${ED}/usr" $(usex debug --debug "") "$@" \
 		|| die "cargo install failed"
 	rm -f "${ED}/usr/.crates.toml"
 
@@ -169,7 +169,7 @@ cargo_src_install() {
 cargo_src_test() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	cargo test -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
+	cargo test -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
 		|| die "cargo test failed"
 }
 
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
  2019-12-06 20:09 [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations Georgy Yakovlev
@ 2019-12-06 23:44 ` Sergei Trofimovich
  2019-12-07  0:16   ` Georgy Yakovlev
  2019-12-07  9:56 ` Kent Fredric
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Trofimovich @ 2019-12-06 23:44 UTC (permalink / raw
  To: gentoo-dev

On Fri,  6 Dec 2019 12:09:31 -0800
Georgy Yakovlev <gyakovlev@gentoo.org> wrote:

> Default output just prints crate name.
> With -vv we can see all cargo options and rustc args.
> 
> Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
> ---

Looks good!

I had to do an equivalent locally at least a few times.

While at it I also suggest adding equivalent of
econf's/emake's ${EXTRA_ECONF} and ${EXTRA_EMAKE}
to allow users to inject arbitrary stuff. For example
to sneak in '-Z' options globally.

Say, ${CARGO_BUILD_EXTRA},  ${CARGO_INSTALL_EXTRA},
${CARGO_TEST_EXTRA}.

>  eclass/cargo.eclass | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
> index 5b6d1f050f1..13dd5c355fb 100644
> --- a/eclass/cargo.eclass
> +++ b/eclass/cargo.eclass
> @@ -146,7 +146,7 @@ cargo_src_compile() {
>  
>  	export CARGO_HOME="${ECARGO_HOME}"
>  
> -	cargo build -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
> +	cargo build -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
>  		|| die "cargo build failed"
>  }
>  
> @@ -156,7 +156,7 @@ cargo_src_compile() {
>  cargo_src_install() {
>  	debug-print-function ${FUNCNAME} "$@"
>  
> -	cargo install -j $(makeopts_jobs) --root="${ED}/usr" $(usex debug --debug "") "$@" \
> +	cargo install -vv -j $(makeopts_jobs) --root="${ED}/usr" $(usex debug --debug "") "$@" \
>  		|| die "cargo install failed"
>  	rm -f "${ED}/usr/.crates.toml"
>  
> @@ -169,7 +169,7 @@ cargo_src_install() {
>  cargo_src_test() {
>  	debug-print-function ${FUNCNAME} "$@"
>  
> -	cargo test -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
> +	cargo test -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \
>  		|| die "cargo test failed"
>  }
>  
> -- 
> 2.23.0
> 
> 


-- 

  Sergei


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
  2019-12-06 23:44 ` Sergei Trofimovich
@ 2019-12-07  0:16   ` Georgy Yakovlev
  2019-12-07  8:46     ` Haelwenn (lanodan) Monnier
  2019-12-07  8:59     ` Sergei Trofimovich
  0 siblings, 2 replies; 6+ messages in thread
From: Georgy Yakovlev @ 2019-12-07  0:16 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

On Friday, December 6, 2019 3:44:38 PM PST Sergei Trofimovich wrote:
> On Fri,  6 Dec 2019 12:09:31 -0800
> 
> Georgy Yakovlev <gyakovlev@gentoo.org> wrote:
> > Default output just prints crate name.
> > With -vv we can see all cargo options and rustc args.
> > 
> > Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
> > ---
> 
> Looks good!
> 
> I had to do an equivalent locally at least a few times.
Pushed!
> 
> While at it I also suggest adding equivalent of
> econf's/emake's ${EXTRA_ECONF} and ${EXTRA_EMAKE}
> to allow users to inject arbitrary stuff. For example
> to sneak in '-Z' options globally.
> 
> Say, ${CARGO_BUILD_EXTRA},  ${CARGO_INSTALL_EXTRA},
> ${CARGO_TEST_EXTRA}.
> 

Yeah, it's on my to-do list for this eclass.
1 question tho, should it come after "$@" or before? Do you use it?
I know cargo can be picky about order and some ebuilds rely on passing params 
in phase funcs.



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
  2019-12-07  0:16   ` Georgy Yakovlev
@ 2019-12-07  8:46     ` Haelwenn (lanodan) Monnier
  2019-12-07  8:59     ` Sergei Trofimovich
  1 sibling, 0 replies; 6+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2019-12-07  8:46 UTC (permalink / raw
  To: gentoo-dev

[2019-12-06 16:16:32-0800] Georgy Yakovlev:
> On Friday, December 6, 2019 3:44:38 PM PST Sergei Trofimovich wrote:
> > On Fri,  6 Dec 2019 12:09:31 -0800
> > Georgy Yakovlev <gyakovlev@gentoo.org> wrote:
> > > Default output just prints crate name.
> > > With -vv we can see all cargo options and rustc args.
> > > 
> > > Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
> > > ---
> > 
> > While at it I also suggest adding equivalent of
> > econf's/emake's ${EXTRA_ECONF} and ${EXTRA_EMAKE}
> > to allow users to inject arbitrary stuff. For example
> > to sneak in '-Z' options globally.
> > 
> > Say, ${CARGO_BUILD_EXTRA},  ${CARGO_INSTALL_EXTRA},
> > ${CARGO_TEST_EXTRA}.
> > 
> 
> Yeah, it's on my to-do list for this eclass.
> 1 question tho, should it come after "$@" or before? Do you use it?
> I know cargo can be picky about order and some ebuilds rely on passing params 
> in phase funcs.

I think it should go after `cargo {build,install,test}` and before any 
non-option argument, similar to how POSIX getopt(3) behaves (but that GNU 
breaks without setting POSIXLY_CORRECT=1).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
  2019-12-07  0:16   ` Georgy Yakovlev
  2019-12-07  8:46     ` Haelwenn (lanodan) Monnier
@ 2019-12-07  8:59     ` Sergei Trofimovich
  1 sibling, 0 replies; 6+ messages in thread
From: Sergei Trofimovich @ 2019-12-07  8:59 UTC (permalink / raw
  Cc: gentoo-dev

On Fri, 06 Dec 2019 16:16:32 -0800
Georgy Yakovlev <gyakovlev@gentoo.org> wrote:

> On Friday, December 6, 2019 3:44:38 PM PST Sergei Trofimovich wrote:
> > On Fri,  6 Dec 2019 12:09:31 -0800
> > 
> > Georgy Yakovlev <gyakovlev@gentoo.org> wrote:  
> > > Default output just prints crate name.
> > > With -vv we can see all cargo options and rustc args.
> > > 
> > > Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
> > > ---  
> > 
> > Looks good!
> > 
> > I had to do an equivalent locally at least a few times.  
> Pushed!
> > 
> > While at it I also suggest adding equivalent of
> > econf's/emake's ${EXTRA_ECONF} and ${EXTRA_EMAKE}
> > to allow users to inject arbitrary stuff. For example
> > to sneak in '-Z' options globally.
> > 
> > Say, ${CARGO_BUILD_EXTRA},  ${CARGO_INSTALL_EXTRA},
> > ${CARGO_TEST_EXTRA}.
> >   
> 
> Yeah, it's on my to-do list for this eclass.
> 1 question tho, should it come after "$@" or before? Do you use it?
> I know cargo can be picky about order and some ebuilds rely on passing params 
> in phase funcs.

I don't use it frequently for carge.eclass but use it extensively for
./configure and haskell-cabal.eclass. I'd say variables are designed to
override everything else (eclass defaults and ebuild values) and thus
should come after "$@":
    econf() { ... "$@" "${EXTRA_ECONF[@]}" }
    ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}

-- 

  Sergei


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations
  2019-12-06 20:09 [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations Georgy Yakovlev
  2019-12-06 23:44 ` Sergei Trofimovich
@ 2019-12-07  9:56 ` Kent Fredric
  1 sibling, 0 replies; 6+ messages in thread
From: Kent Fredric @ 2019-12-07  9:56 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

On Fri,  6 Dec 2019 12:09:31 -0800
Georgy Yakovlev <gyakovlev@gentoo.org> wrote:

> Default output just prints crate name.
> With -vv we can see all cargo options and rustc args.

On the overlay with rust-crate.eclass, I've not found the verbose
output very helpful for anything.

I would probably ask for a knob to tweak that disabled this.



...

ECARGO_OPTS=(
   -j $(makeopts_jobs)
   "${ECARGO_OPTS[@]}"
)
if [ "${ECARGO_VERBOSE:-1}" == 1 ]; then
  ECARGO_OPTS+=( -vv )
fi

...

cargo build "${ECARGO_OPTS[@]}" ... 


or something along those lines.

I've also (often) had to invoke stuff like:

src_test() {
   RUSTFLAGS="${RUSTFLAGS} --cap-lints warn" rust-crate_src_test
}

Because well, upstream.

But I'm not entirely fond of that syntax.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-07  9:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-06 20:09 [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations Georgy Yakovlev
2019-12-06 23:44 ` Sergei Trofimovich
2019-12-07  0:16   ` Georgy Yakovlev
2019-12-07  8:46     ` Haelwenn (lanodan) Monnier
2019-12-07  8:59     ` Sergei Trofimovich
2019-12-07  9:56 ` Kent Fredric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox