* [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking
@ 2024-09-04 20:42 Yann E. MORIN
2024-09-05 9:00 ` Yann E. MORIN
2024-09-05 19:07 ` Thomas Petazzoni via buildroot
0 siblings, 2 replies; 4+ messages in thread
From: Yann E. MORIN @ 2024-09-04 20:42 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking
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
2024-09-05 19:07 ` Thomas Petazzoni via buildroot
1 sibling, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2024-09-05 9:00 UTC (permalink / raw)
To: buildroot
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking
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
@ 2024-09-05 19:07 ` Thomas Petazzoni via buildroot
2024-09-05 20:01 ` Yann E. MORIN
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-09-05 19:07 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
Hello,
On Wed, 4 Sep 2024 22:42:34 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> 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
Thanks for the patch, which I have applied to next. However, I would
really like:
Closes: #17
to be:
Fixes:
https://gitlab.com/buildroot.org/buildroot/-/issues/17
For two reasons:
(1) For autobuilder failures we use a full URL, not just the
identifier, so we should do the same for Gitlab issue. It also makes
them directly clickable from the commit log, which is really nice,
and makes it very clear that it's fixing a Gitlab issue
(2) Fixes: gets picked up by patchwork and not Closes:
I adjusted this when committing, so this was really just to hopefully
establish what we consider to be our best practice on this matter :-)
Thanks a lot for addressing this issue!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/pkg-cargo: don't install crates tracking
2024-09-05 19:07 ` Thomas Petazzoni via buildroot
@ 2024-09-05 20:01 ` Yann E. MORIN
0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2024-09-05 20:01 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot
Thomas, All,
On 2024-09-05 21:07 +0200, Thomas Petazzoni spake thusly:
> On Wed, 4 Sep 2024 22:42:34 +0200
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
[--SNIP--]
> > Closes: #17
>
> Thanks for the patch, which I have applied to next. However, I would
> really like:
>
> Closes: #17
>
> to be:
>
> Fixes:
>
> https://gitlab.com/buildroot.org/buildroot/-/issues/17
As explained on IRC, and for all to know: using "Fixes: #17" makes
Gitlab automatically close the corresponding issue with a reference to
the proper commit log.
It seems GitLab was able to notice that this commit referenced the
issue, so if we go for the full URL, I think we should put it on the
same line as the "Fixes:" tag.
> For two reasons:
>
> (1) For autobuilder failures we use a full URL, not just the
> identifier, so we should do the same for Gitlab issue. It also makes
> them directly clickable from the commit log, which is really nice,
> and makes it very clear that it's fixing a Gitlab issue
>
> (2) Fixes: gets picked up by patchwork and not Closes:
>
> I adjusted this when committing, so this was really just to hopefully
> establish what we consider to be our best practice on this matter :-)
I think it sets the wrong example, then, and that we'll have to settle
on an actual best practice. ;-)
Then I'll have to address another issue so that I can properly tag it in
my commit log! :-]
Thanks!
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-05 20:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-09-05 19:07 ` Thomas Petazzoni via buildroot
2024-09-05 20:01 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox