Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-07 Thread Kent Fredric
On Fri,  6 Dec 2019 12:09:31 -0800
Georgy Yakovlev  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.


pgpDgKtQkdfkU.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-07 Thread Sergei Trofimovich
On Fri, 06 Dec 2019 16:16:32 -0800
Georgy Yakovlev  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  wrote:  
> > > Default output just prints crate name.
> > > With -vv we can see all cargo options and rustc args.
> > > 
> > > Signed-off-by: Georgy Yakovlev 
> > > ---  
> > 
> > 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



Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-07 Thread Haelwenn (lanodan) Monnier
[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  wrote:
> > > Default output just prints crate name.
> > > With -vv we can see all cargo options and rustc args.
> > > 
> > > Signed-off-by: Georgy Yakovlev 
> > > ---
> > 
> > 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).



Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-06 Thread 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  wrote:
> > Default output just prints crate name.
> > With -vv we can see all cargo options and rustc args.
> > 
> > Signed-off-by: Georgy Yakovlev 
> > ---
> 
> 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.




signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-06 Thread Sergei Trofimovich
On Fri,  6 Dec 2019 12:09:31 -0800
Georgy Yakovlev  wrote:

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

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



[gentoo-dev] [PATCH] cargo.eclass: use verbose cargo invocations

2019-12-06 Thread Georgy Yakovlev
Default output just prints crate name.
With -vv we can see all cargo options and rustc args.

Signed-off-by: Georgy Yakovlev 
---
 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