Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Moritz Bitsch <moritz@h6t.eu>,
	James Hilliard <james.hilliard1@gmail.com>,
	Buildroot List <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH next 2/2] package/pkg-cargo: move CARGO_HOME into DL_DIR
Date: Sun, 6 Nov 2022 16:03:30 +0100	[thread overview]
Message-ID: <20221106150330.GY3918838@scaer> (raw)
In-Reply-To: <20221103224539.692322-2-thomas.petazzoni@bootlin.com>

Thomas, All,

On 2022-11-03 23:45 +0100, Thomas Petazzoni via buildroot spake thusly:
> CARGO_HOME is where Cargo stores its downloaded artefacts. See
> https://doc.rust-lang.org/cargo/reference/environment-variables.html:
> 
>   CARGO_HOME — Cargo maintains a local cache of the registry index and
>   of git checkouts of crates. By default these are stored under
>   $HOME/.cargo (%USERPROFILE%\.cargo on Windows), but this variable
>   overrides the location of this directory. Once a crate is cached it
>   is not removed by the clean command. For more details refer to the
>   guide.
> 
> We currently make it point to $(HOST_DIR)/share/cargo, but this has a
> number of drawbacks:
> 
>  (1) It is not shared between Buildroot builds. Each Buildroot build
>      will re-download the crates index, and the crates themselves,
>      unless of course the final vendored tarball is already there.
> 
>  (2) With BR2_PER_PACKAGE_DIRECTORIES=y, it is even worse: CARGO_HOME
>      is not even shared between packages, as $(HOST_DIR)/share/cargo
>      is per package. So each package in the build that needs vendoring
>      of Cargo crates will download the crates index and the crates in
>      its own CARGO_HOME location.
> 
> To solve this, this commit moves CARGO_HOME into $(DL_DIR), so that it
> is shared between builds and packages.
> 
> Even though not the best/most authoritative source,
> https://github.com/rust-lang/cargo/issues/6930 indicates that there is
> a lock when accessing CARGO_HOME, because a user even complains that
> this lock has even become more coarse-grained than it used to be
> (which for us is fine, it just means that two Cargo fetch operations
> from two different packages will be serialized, not a big deal).
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/pkg-cargo.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
> index 5923725f5e..c3d1e34309 100644
> --- a/package/pkg-cargo.mk
> +++ b/package/pkg-cargo.mk
> @@ -20,7 +20,7 @@
>  #
>  ################################################################################
>  
> -BR_CARGO_HOME = $(HOST_DIR)/share/cargo
> +BR_CARGO_HOME = $(DL_DIR)/.cargo

I am not a fan of dot-directories, because they get hidden, especially
since BR2_DL_DIR can be set in the environment and point to a long-lived
directory.

Instead, I would just call it 'cargo-home'. If that's OK, we can change
when applying...

Regards,
Yann E. MORIN.

>  PKG_COMMON_CARGO_ENV = \
>  	CARGO_HOME=$(BR_CARGO_HOME)
> -- 
> 2.38.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-11-06 15:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 22:45 [Buildroot] [PATCH next 1/2] package/pkg-cargo: provide a single definition of CARGO_HOME value Thomas Petazzoni via buildroot
2022-11-03 22:45 ` [Buildroot] [PATCH next 2/2] package/pkg-cargo: move CARGO_HOME into DL_DIR Thomas Petazzoni via buildroot
2022-11-04  8:54   ` Moritz Bitsch via buildroot
2022-11-06 15:03   ` Yann E. MORIN [this message]
2022-11-07  7:52     ` Thomas Petazzoni via buildroot
2022-11-07 17:33       ` Yann E. MORIN
2023-01-14 13:58   ` Yann E. MORIN
2023-01-14 14:17     ` Thomas Petazzoni via buildroot
2023-01-14 14:19     ` Yann E. MORIN
2022-11-06 15:18 ` [Buildroot] [PATCH next 1/2] package/pkg-cargo: provide a single definition of CARGO_HOME value Yann E. MORIN

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=20221106150330.GY3918838@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=james.hilliard1@gmail.com \
    --cc=moritz@h6t.eu \
    --cc=thomas.petazzoni@bootlin.com \
    /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