[Buildroot] [PATCH 19/20 v2] package/pkg-cargo: allow unlocked packages to provide local Cargo.lock

Yann E. MORIN yann.morin.1998 at free.fr
Fri Jun 7 19:49:21 UTC 2024


All,

On 2024-06-07 19:06 +0200, Yann E. MORIN spake thusly:
> Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
[--SNIP--]
> diff --git a/support/download/cargo-post-process b/support/download/cargo-post-process
> index 90155a2fad..3431d04a72 100755
> --- a/support/download/cargo-post-process
> +++ b/support/download/cargo-post-process
[--SNIP--]
> @@ -49,6 +51,23 @@ while [ "${lock_dir}" != "." ]; do
>      lock_dir="$(dirname "${lock_dir}")"
>  done
>  
> +if [ "${cargo_lock}" ]; then
> +    if [ -e "${lock_dir}/Cargo.lock" ]; then
> +        printf 'Cannot override %s/Cargo.lock with custom %s\n' "${lock_dir}" "${cargo_lock}"
> +        exit 1
> +    fi >&2
> +    # When the package had no Cargo.lock, we need to
> +    # copy ours next to the top-most manifest.
> +    dir="${manifest}"
> +    while [ "${dir}" != "." ]; do
> +        dir="$(dirname "${dir}")"
> +        if [ -e "${dir}/Cargo.lock" ]; then

Damn, the test should have been against Cargo.toml here, not Cargo.lock.
I did not notice so far, because the only unlock package I know of had
its Cargo.toml at the root, and the loop ends at the root.

I've fixed that locally, until the next respin.

Regards,
Yann E. MORIN.

> +            lock_dir="${dir}"
> +        fi
> +    done
> +    cp "${cargo_lock}" "${lock_dir}/Cargo.lock"
> +fi
> +
>  if [ -e "${lock_dir}/Cargo.lock" ] && ! ${locked}; then
>      printf 'Unlocked vendoring was requested, but source tree has %s/Cargo.lock\n' "${lock_dir}"
>      exit 1
> -- 
> 2.45.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list