diff mbox series

[1/5,v2] package/pkg-cargo: allow packages to define download environment

Message ID 9354_1644422930_6203E712_9354_383_11_2d5b77c2a90cf722e007a5bf3ed4227d2bd1fda6.1644422916.git.yann.morin@orange.com
State Changes Requested
Headers show
Series [1/5,v2] package/pkg-cargo: allow packages to define download environment | expand

Commit Message

Yann E. MORIN Feb. 9, 2022, 4:08 p.m. UTC
From: "Yann E. MORIN" <yann.morin@orange.com>

Currently, the cargo infrastructure forcibly sets the package _DL_ENV
variable, instead of appending to it, which prevents packages from
providing their own download environment variables.

We fix that by using an append-assignment.

Note: when introduced, that variable was explicitly not documented, and
is supposed to only be used by packages infrastructures. However, that
variable exists, and it can be (ab)used by br2-external packages (most
probably to ill effects, but heh!). We anyway leave it undocumented,
like _ROOTFS_PRE_CMD_HOOKS.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/pkg-cargo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Petazzoni Feb. 9, 2022, 7:50 p.m. UTC | #1
On Wed, 9 Feb 2022 17:08:43 +0100
<yann.morin@orange.com> wrote:

> From: "Yann E. MORIN" <yann.morin@orange.com>
> 
> Currently, the cargo infrastructure forcibly sets the package _DL_ENV
> variable, instead of appending to it, which prevents packages from
> providing their own download environment variables.
> 
> We fix that by using an append-assignment.
> 
> Note: when introduced, that variable was explicitly not documented, and
> is supposed to only be used by packages infrastructures. However, that
> variable exists, and it can be (ab)used by br2-external packages (most
> probably to ill effects, but heh!). We anyway leave it undocumented,
> like _ROOTFS_PRE_CMD_HOOKS.
> 
> Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Thomas Petazzoni Feb. 9, 2022, 7:52 p.m. UTC | #2
On Wed, 9 Feb 2022 17:08:43 +0100
<yann.morin@orange.com> wrote:

>  $(2)_DOWNLOAD_POST_PROCESS = cargo
> -$(2)_DL_ENV = CARGO_HOME=$$(HOST_DIR)/share/cargo
> +$(2)_DL_ENV += CARGO_HOME=$$(HOST_DIR)/share/cargo

But, but, then, how is:

PYTHON_CRYPTOGRAPHY_DL_ENV = \
        BR_CARGO_MANIFEST_PATH=src/rust/Cargo.toml

currently working?

Thomas
Yann E. MORIN Feb. 9, 2022, 8:55 p.m. UTC | #3
Thomas, All,

On 2022-02-09 20:52 +0100, Thomas Petazzoni via buildroot spake thusly:
> On Wed, 9 Feb 2022 17:08:43 +0100
> <yann.morin@orange.com> wrote:
> >  $(2)_DOWNLOAD_POST_PROCESS = cargo
> > -$(2)_DL_ENV = CARGO_HOME=$$(HOST_DIR)/share/cargo
> > +$(2)_DL_ENV += CARGO_HOME=$$(HOST_DIR)/share/cargo
> 
> But, but, then, how is:
> 
> PYTHON_CRYPTOGRAPHY_DL_ENV = \
>         BR_CARGO_MANIFEST_PATH=src/rust/Cargo.toml
> 
> currently working?

Because, its the name implies, it is a python-package, not a
cargo-package.

Yeah, I got puzzled too. ;-)

Regards,
Yann E. MORIN.
Thomas Petazzoni Feb. 9, 2022, 9:48 p.m. UTC | #4
On Wed, 9 Feb 2022 21:55:27 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> > But, but, then, how is:
> > 
> > PYTHON_CRYPTOGRAPHY_DL_ENV = \
> >         BR_CARGO_MANIFEST_PATH=src/rust/Cargo.toml
> > 
> > currently working?  
> 
> Because, its the name implies, it is a python-package, not a
> cargo-package.
> 
> Yeah, I got puzzled too. ;-)

Aah, yes. Indeed. A python-package that builds Rust stuff. I wonder how
it's possible for me to forget this, after having spent so many hours
on this particular package! :-)

Thomas
diff mbox series

Patch

diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index e74a8358bc..66bea513e0 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -69,7 +69,7 @@  define inner-cargo-package
 $(2)_DOWNLOAD_DEPENDENCIES += host-rustc
 
 $(2)_DOWNLOAD_POST_PROCESS = cargo
-$(2)_DL_ENV = CARGO_HOME=$$(HOST_DIR)/share/cargo
+$(2)_DL_ENV += CARGO_HOME=$$(HOST_DIR)/share/cargo
 
 # Due to vendoring, it is pretty likely that not all licenses are
 # listed in <pkg>_LICENSE.