All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Simon Richter <simon.richter@ptwdosimetry.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2] support/download/cargo-post-process: cargo output for vendor config
Date: Mon, 31 Oct 2022 10:08:31 +0100	[thread overview]
Message-ID: <20221031090831.GL1058960@scaer> (raw)
In-Reply-To: <20221025100200.78438-1-simon.richter@ptwdosimetry.com>

Simon, All,

On 2022-10-25 12:02 +0200, Simon Richter spake thusly:
> Use the output of `cargo vendor` to generate the vendor configuration.
> 
> Fixes the need to patch the generated configuration if there are
> non-crates.io dependencies.
> 
> Note:
>   `cargo vendor` currently prints a newline before it prints the
>   needed configuration.
> 
>   This is fixed in +nightly, will end up in +stable soon and must
>   be considered when updating cargo.
>   See: https://github.com/rust-lang/cargo/pull/11273

This is going to need care when we bump, so I added a little comment in
rust-bin.mk and rust.mk tocheck that a version bump still generates the
same archives.

>   Until then it is needed to remove this first line to make sure
>   that the contents of .cargo/config will be the same as they were
>   generated with the earlier version of the script. Thus, the
>   hashes of the packages that use this script remain the same.
> 
> Signed-off-by: Simon Richter <simon.richter@ptwdosimetry.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  support/download/cargo-post-process | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/support/download/cargo-post-process b/support/download/cargo-post-process
> index a4a4718a2a..186e9eb69b 100755
> --- a/support/download/cargo-post-process
> +++ b/support/download/cargo-post-process
> @@ -1,6 +1,7 @@
>  #!/usr/bin/env bash
>  
>  set -e
> +set -o pipefail
>  
>  . "${0%/*}/helpers"
>  
> @@ -22,17 +23,28 @@ post_process_unpack "${base_name}" "${output}"
>  
>  # Do the Cargo vendoring
>  pushd "${base_name}" > /dev/null
> -cargo vendor --manifest-path ${BR_CARGO_MANIFEST_PATH-Cargo.toml} --locked VENDOR
>  
>  # Create the local .cargo/config with vendor info
> +#
> +# The first line of the output to stdout is empty.
> +# So skip it to have the file start with the vendoring
> +# configuration (`tail --lines=+2`).
> +#
> +# NOTE:
> +#   There is  a patch for cargo to remove the first empty line:
> +#   See: https://github.com/rust-lang/cargo/pull/11273
> +#
> +#   The patch already landed in +nightly and will end up
> +#   in +stable soon.
> +#
> +# ->  When updating rust/cargo, the call to `tail` must be removed.
> +#
>  mkdir -p .cargo/
> -cat <<EOF >.cargo/config
> -[source.crates-io]
> -replace-with = "vendored-sources"
> +cargo vendor \
> +    --manifest-path ${BR_CARGO_MANIFEST_PATH-Cargo.toml} \
> +    --locked VENDOR \
> +    | tail --lines=+2 | tee .cargo/config
>  
> -[source.vendored-sources]
> -directory = "VENDOR"
> -EOF
>  popd > /dev/null
>  
>  post_process_repack "$(pwd)" "${base_name}" "${output}"
> -- 
> 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

      reply	other threads:[~2022-10-31  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221019161513.994988-1-simon.richter@ptwdosimetry.com>
2022-10-19 20:52 ` [Buildroot] [PATCH 1/1] support/download/cargo-post-process: use cargo output for vendor config Yann E. MORIN
2022-10-20 18:16   ` Richter Simon
2022-10-20 20:25     ` Yann E. MORIN
2022-10-21 12:10       ` Richter Simon
2022-10-21 16:31         ` Yann E. MORIN
2022-10-25 10:02           ` [Buildroot] [PATCH v2] support/download/cargo-post-process: " Simon Richter
2022-10-31  9:08             ` Yann E. MORIN [this message]

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=20221031090831.GL1058960@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=simon.richter@ptwdosimetry.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 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.