All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-Core][PATCH 1/3] cargo: Rename MANIFEST_PATH -> CARGO_MANIFEST_PATH
@ 2023-12-07 13:39 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 13:39 ` [OE-Core][PATCH 3/3] cargo: Add CARGO_LOCK_PATH for path to Cargo.lock Alex Kiernan
  0 siblings, 2 replies; 8+ messages in thread
From: Alex Kiernan @ 2023-12-07 13:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alex Kiernan

This variable is a piece of recipe configurable interface, scope it with
the class name to make that clear.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 meta/classes-recipe/cargo.bbclass        | 4 ++--
 meta/classes-recipe/cargo_common.bbclass | 2 +-
 meta/classes-recipe/ptest-cargo.bbclass  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index 8c0b92df8d33..96a74e2ef1ec 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -35,7 +35,7 @@ export RUST_BACKTRACE = "1"
 CARGO_SRC_DIR ??= ""
 
 # The actual path to the Cargo.toml
-MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
+CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 
 RUSTFLAGS ??= ""
 BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
@@ -44,7 +44,7 @@ BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
 # and will require an up to date Cargo.lock file.
 # This force the package being built to already ship a Cargo.lock, in the end
 # this is what we want, at least, for reproducibility of the build.
-CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
+CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${CARGO_MANIFEST_PATH}"
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.
diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
index b732a1bd9538..bf298e96c745 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -161,7 +161,7 @@ python cargo_common_do_patch_paths() {
     # here is better than letting cargo tell (in case the file is missing)
     # "Cargo.lock should be modified but --frozen was given"
 
-    manifest_path = d.getVar("MANIFEST_PATH", True)
+    manifest_path = d.getVar("CARGO_MANIFEST_PATH", True)
     lockfile = os.path.join(os.path.dirname(manifest_path), "Cargo.lock")
     if not os.path.exists(lockfile):
         bb.fatal(f"{lockfile} file doesn't exist")
diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass
index ff57be852508..c46df362bfee 100644
--- a/meta/classes-recipe/ptest-cargo.bbclass
+++ b/meta/classes-recipe/ptest-cargo.bbclass
@@ -15,7 +15,7 @@ python do_compile_ptest_cargo() {
     cargo = bb.utils.which(d.getVar("PATH"), d.getVar("CARGO", True))
     cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS", True)
     rust_flags = d.getVar("RUSTFLAGS", True)
-    manifest_path = d.getVar("MANIFEST_PATH", True)
+    manifest_path = d.getVar("CARGO_MANIFEST_PATH", True)
     project_manifest_path = os.path.normpath(manifest_path)
     manifest_dir = os.path.dirname(manifest_path)
 
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
  2023-12-07 13:39 [OE-Core][PATCH 1/3] cargo: Rename MANIFEST_PATH -> CARGO_MANIFEST_PATH Alex Kiernan
@ 2023-12-07 13:39 ` Alex Kiernan
  2023-12-07 22:39   ` Richard Purdie
  2023-12-07 13:39 ` [OE-Core][PATCH 3/3] cargo: Add CARGO_LOCK_PATH for path to Cargo.lock Alex Kiernan
  1 sibling, 1 reply; 8+ messages in thread
From: Alex Kiernan @ 2023-12-07 13:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alex Kiernan

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.

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
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [OE-Core][PATCH 3/3] cargo: Add CARGO_LOCK_PATH for path to Cargo.lock
  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 13:39 ` Alex Kiernan
  1 sibling, 0 replies; 8+ messages in thread
From: Alex Kiernan @ 2023-12-07 13:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alex Kiernan

When building a workspace enabled project, the Cargo.lock is found at
the root of the project, not alongside the Cargo.toml. Expose
CARGO_LOCK_PATH so it can be explicitly configured.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 meta/classes-recipe/cargo_common.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
index c330c122a9d3..a236628664c8 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -40,6 +40,9 @@ CARGO_SRC_DIR ?= ""
 # The actual path to the Cargo.toml
 CARGO_MANIFEST_PATH ?= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 
+# Path to Cargo.lock
+CARGO_LOCK_PATH ?= "${@ os.path.join(os.path.dirname(d.getVar('CARGO_MANIFEST_PATH', True)), 'Cargo.lock')}"
+
 CARGO_RUST_TARGET_CCLD ?= "${RUST_TARGET_CCLD}"
 cargo_common_do_configure () {
 	mkdir -p ${CARGO_HOME}/bitbake
@@ -168,8 +171,7 @@ python cargo_common_do_patch_paths() {
     # here is better than letting cargo tell (in case the file is missing)
     # "Cargo.lock should be modified but --frozen was given"
 
-    manifest_path = d.getVar("CARGO_MANIFEST_PATH", True)
-    lockfile = os.path.join(os.path.dirname(manifest_path), "Cargo.lock")
+    lockfile = d.getVar("CARGO_LOCK_PATH", True)
     if not os.path.exists(lockfile):
         bb.fatal(f"{lockfile} file doesn't exist")
 
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
  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
  2023-12-08  8:15     ` Alex Kiernan
       [not found]     ` <179ECD325A85AE45.16398@lists.openembedded.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Purdie @ 2023-12-07 22:39 UTC (permalink / raw)
  To: Alex Kiernan, openembedded-core

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]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
  2023-12-07 22:39   ` Richard Purdie
@ 2023-12-08  8:15     ` Alex Kiernan
  2023-12-08  8:28       ` Richard Purdie
       [not found]     ` <179ECD325A85AE45.16398@lists.openembedded.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Alex Kiernan @ 2023-12-08  8:15 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

On Thu, Dec 7, 2023 at 10:40 PM Richard Purdie
<richard.purdie@linuxfoundation.org> 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 <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]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>


-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
       [not found]     ` <179ECD325A85AE45.16398@lists.openembedded.org>
@ 2023-12-08  8:23       ` Alex Kiernan
  2023-12-08  8:30         ` Richard Purdie
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kiernan @ 2023-12-08  8:23 UTC (permalink / raw)
  To: alex.kiernan; +Cc: Richard Purdie, openembedded-core

On Fri, Dec 8, 2023 at 8:15 AM Alex Kiernan via lists.openembedded.org
<alex.kiernan=gmail.com@lists.openembedded.org> wrote:
>
> On Thu, Dec 7, 2023 at 10:40 PM Richard Purdie
> <richard.purdie@linuxfoundation.org> 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?
>

And I've just read the bitbake docs and I clearly still don't really
understand... its += / -= rather than append/remove which are the
things which are important here.

> 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 <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
> > >
> > >
> >
>
>
> --
> 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/3618097
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kiernan@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
  2023-12-08  8:15     ` Alex Kiernan
@ 2023-12-08  8:28       ` Richard Purdie
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2023-12-08  8:28 UTC (permalink / raw)
  To: Alex Kiernan; +Cc: openembedded-core

On Fri, 2023-12-08 at 08:15 +0000, Alex Kiernan wrote:
> On Thu, Dec 7, 2023 at 10:40 PM Richard Purdie
> <richard.purdie@linuxfoundation.org> 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?

??= means "fall back to this value if nothing else is ever set".

For a single value, append or += never makes sense so the fallback is
probably what we want from a class regardless of order.

If you use ?= it just adds some ordering constraints.

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

For the above case it is one of the few "clearer" cases. As soon as you
have multiple values, it becomes fuzzy sadly. I'm not sure how we
improve things either.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-Core][PATCH 2/3] cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
  2023-12-08  8:23       ` Alex Kiernan
@ 2023-12-08  8:30         ` Richard Purdie
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2023-12-08  8:30 UTC (permalink / raw)
  To: Alex Kiernan; +Cc: openembedded-core

On Fri, 2023-12-08 at 08:23 +0000, Alex Kiernan wrote:
> On Fri, Dec 8, 2023 at 8:15 AM Alex Kiernan via lists.openembedded.org
> <alex.kiernan=gmail.com@lists.openembedded.org> wrote:
> > 
> > On Thu, Dec 7, 2023 at 10:40 PM Richard Purdie
> > <richard.purdie@linuxfoundation.org> 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?
> > 
> 
> And I've just read the bitbake docs and I clearly still don't really
> understand... its += / -= rather than append/remove which are the
> things which are important here.
> 
> > TBH I've never really been very clear what the "right" thing to use is
> > between ?= and ??=

For something which isn't a single value, you'd need to use += or
append and that gets much more unclear. My comments were only for
single value variables as we don't have a good answer for the rest,
much as I wish we had.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-08  8:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.