Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Alex Kiernan <alex.kiernan@gmail.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
Date: Thu, 07 Dec 2023 22:39:59 +0000	[thread overview]
Message-ID: <58a265ee08706c7d5e0b9c5678dfbe44b63c96cb.camel@linuxfoundation.org> (raw)
In-Reply-To: <20231207133913.443-2-alex.kiernan@gmail.com>

On Thu, 2023-12-07 at 13:39 +0000, Alex Kiernan wrote:
> cargo_common_do_configure uses CARGO_MANIFEST_PATH (which depends on
> CARGO_SRC_DIR), but their definition was in cargo.bbclass.
> 
> Match the other variables here and change to default values, rather
> than weak defaults.

FWIW "single value" class variables tend to work much better as ??=
(which I'd call default value) since than it doesn't matter if the
recipe setting comes before or after the inherit and the inherit
position in the recipe doesn't matter.

I'd call ?= a weak assignment or weak default.

Thanks for working on cleaning some of these things up. I got so far
with it originally and then ran out of time (and too frustrated with
the long build/test cycles!).

Cheers,

Richard

> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
> 
>  meta/classes-recipe/cargo.bbclass        | 7 -------
>  meta/classes-recipe/cargo_common.bbclass | 7 +++++++
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
> index 96a74e2ef1ec..0829a58dd90f 100644
> --- a/meta/classes-recipe/cargo.bbclass
> +++ b/meta/classes-recipe/cargo.bbclass
> @@ -30,13 +30,6 @@ B = "${WORKDIR}/build"
>  # where the issue occured
>  export RUST_BACKTRACE = "1"
>  
> -# The directory of the Cargo.toml relative to the root directory, per default
> -# assume there's a Cargo.toml directly in the root directory
> -CARGO_SRC_DIR ??= ""
> -
> -# The actual path to the Cargo.toml
> -CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
> -
>  RUSTFLAGS ??= ""
>  BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
>  # --frozen flag will prevent network access (which is required since only
> diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
> index bf298e96c745..c330c122a9d3 100644
> --- a/meta/classes-recipe/cargo_common.bbclass
> +++ b/meta/classes-recipe/cargo_common.bbclass
> @@ -33,6 +33,13 @@ CARGO_DISABLE_BITBAKE_VENDORING ?= "0"
>  # Used by libstd-rs to point to the vendor dir included in rustc src
>  CARGO_VENDORING_DIRECTORY ?= "${CARGO_HOME}/bitbake"
>  
> +# The directory of the Cargo.toml relative to the root directory, per default
> +# assume there's a Cargo.toml directly in the root directory
> +CARGO_SRC_DIR ?= ""
> +
> +# The actual path to the Cargo.toml
> +CARGO_MANIFEST_PATH ?= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
> +
>  CARGO_RUST_TARGET_CCLD ?= "${RUST_TARGET_CCLD}"
>  cargo_common_do_configure () {
>  	mkdir -p ${CARGO_HOME}/bitbake
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#191955): https://lists.openembedded.org/g/openembedded-core/message/191955
> Mute This Topic: https://lists.openembedded.org/mt/103034028/1686473
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [richard.purdie@linuxfoundation.org]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



  reply	other threads:[~2023-12-07 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 13:39 [OE-Core][PATCH 1/3] cargo: Rename MANIFEST_PATH -> CARGO_MANIFEST_PATH Alex Kiernan
2023-12-07 13:39 ` [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common Alex Kiernan
2023-12-07 22:39   ` Richard Purdie [this message]
2023-12-08  8:15     ` Alex Kiernan
2023-12-08  8:28       ` Richard Purdie
     [not found]     ` <179ECD325A85AE45.16398@lists.openembedded.org>
2023-12-08  8:23       ` Alex Kiernan
2023-12-08  8:30         ` Richard Purdie
2023-12-07 13:39 ` [OE-Core][PATCH 3/3] cargo: Add CARGO_LOCK_PATH for path to Cargo.lock Alex Kiernan

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=58a265ee08706c7d5e0b9c5678dfbe44b63c96cb.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=alex.kiernan@gmail.com \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox