All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking
Date: Thu, 5 Sep 2024 11:00:03 +0200	[thread overview]
Message-ID: <ZtlzExLTPGV04J5D@landeda> (raw)
In-Reply-To: <20240904204234.498396-1-yann.morin.1998@free.fr>

All,

On 2024-09-04 22:42 +0200, Yann E. MORIN spake thusly:
> By default, 'cargo install' also installs a kind of "registry" in
> /usr/.crates2.json and /usr/.crates.toml [0]:
>     To track information of installed executables, some extra files,
>     such as .crates.toml and .crates2.json, are also created under this
>     root.
> 
> Presumably, this would be used by "cargo uninstall" to properly cleanup
> the package [1]:
>     By default all binaries are removed for a crate [...].
> 
> However, in the context of Buildroot, this is useless, as we do not
> uninstall packages, and thus those files are superfluous.
> 
> Tell cargo to not create that tracking information, by using --no-track
> to "cargo install".
> 
> Note that this would cause cargo to fail to install a file that already
> exists [2], like would be the case when running foo-reinstall for example:
>     --no-track
>     By default, Cargo keeps track of the installed packages with a
>     metadata file stored in the installation root directory. This flag
>     tells Cargo not to use or create that file. With this flag, Cargo
>     will refuse to overwrite any existing files unless the --force flag
>     is used. This also disables Cargo’s ability to protect against
>     multiple concurrent invocations of Cargo installing at the same
>     time.
> 
> However, we do already use --force which allows cargo to overwrite
> existing files without any further ado, so in our case, --no-track will
> only disable the tracking information.
> 
> Also, in Buildroot, we do not have concurrent installation _to the same
> location_: either PPD is disabled, in which case only one package will
> be installed to the common target/ at a time, or we're using PPD, so
> each package will get installed into its own target/. Thus, --no-track
> has no adverse side effect for us.
> 
> Closes: #17
> 
> [0] https://doc.rust-lang.org/cargo/reference/config.html#installroot
> [1] https://doc.rust-lang.org/cargo/commands/cargo-uninstall.html
> [2] https://doc.rust-lang.org/cargo/commands/cargo-install.html
> 
> Reported-by: Thomas Kindler @thomask77
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Thomas tested it foxes it for them too:
    https://gitlab.com/buildroot.org/buildroot/-/issues/17#note_2091496681

Tested-by: Thomas Kindler @thomask77

Regards,
Yann E. MORIN.

> ---
>  package/pkg-cargo.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
> index 41dfcbd096..d94a19024e 100644
> --- a/package/pkg-cargo.mk
> +++ b/package/pkg-cargo.mk
> @@ -279,6 +279,7 @@ define $(2)_INSTALL_TARGET_CMDS
>  			--root $$(TARGET_DIR)/usr/ \
>  			--bins \
>  			--path ./ \
> +			--no-track \
>  			--force \
>  			--locked \
>  			-Z target-applies-to-host \
> @@ -298,6 +299,7 @@ define $(2)_INSTALL_CMDS
>  			--root $$(HOST_DIR) \
>  			--bins \
>  			--path ./ \
> +			--no-track \
>  			--force \
>  			--locked \
>  			$$($(2)_CARGO_INSTALL_OPTS)
> -- 
> 2.46.0
> 
> _______________________________________________
> 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

  reply	other threads:[~2024-09-05  9:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 20:42 [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking Yann E. MORIN
2024-09-05  9:00 ` Yann E. MORIN [this message]
2024-09-05 19:07 ` Thomas Petazzoni via buildroot
2024-09-05 20:01   ` 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=ZtlzExLTPGV04J5D@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.