On Thu, Dec 7, 2023 at 10:40 PM Richard Purdie
<[email protected]> wrote:
>
> 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.
>

Ah, I guess that makes sense - for "single value" :append/:remove
aren't really useful, so leaving the actual assignment as late as
possible works?

TBH I've never really been very clear what the "right" thing to use is
between ?= and ??=

> 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!).
>

I'll go back and do the opposite cleanup and send a v2.

> Cheers,
>
> Richard
>
> >
> > Signed-off-by: Alex Kiernan <[email protected]>
> > ---
> >
> >  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
> > 
> >
>


-- 
Alex Kiernan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192014): 
https://lists.openembedded.org/g/openembedded-core/message/192014
Mute This Topic: https://lists.openembedded.org/mt/103034028/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to