From: Frederic Martinsons <[email protected]>

And use that for rust-hello-world recipe that did not ship
a Cargo.lock file.

Signed-off-by: Frederic Martinsons <[email protected]>
---
 meta/classes-recipe/cargo.bbclass                          | 4 +++-
 meta/classes-recipe/cargo_common.bbclass                   | 3 +++
 meta/recipes-extended/rust-example/rust-hello-world_git.bb | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/cargo.bbclass 
b/meta/classes-recipe/cargo.bbclass
index 8c0b92df8d..d8ab94f2b4 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -39,12 +39,14 @@ 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
 # the do_fetch step is authorized to access network)
 # 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_EXTRA_FLAGS =  "${@['--frozen', '--offline'][d.getVar('CARGO_NO_FROZEN') 
== '1']}"
+CARGO_BUILD_FLAGS = "-v ${CARGO_EXTRA_FLAGS} --target ${RUST_HOST_SYS} 
${BUILD_MODE} --manifest-path=${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 01afb74640..d17501182f 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -152,6 +152,9 @@ python cargo_common_do_patch_paths() {
     if not patches:
         return
 
+    if d.getVar("CARGO_NO_FROZEN") == 1:
+        return
+
     # Cargo.lock file is needed for to be sure that artifacts
     # downloaded by the fetch steps are those expected by the
     # project and that the possible patches are correctly applied.
diff --git a/meta/recipes-extended/rust-example/rust-hello-world_git.bb 
b/meta/recipes-extended/rust-example/rust-hello-world_git.bb
index 1d91109b51..cad184837f 100644
--- a/meta/recipes-extended/rust-example/rust-hello-world_git.bb
+++ b/meta/recipes-extended/rust-example/rust-hello-world_git.bb
@@ -14,6 +14,8 @@ SUMMARY = "Hello World by Cargo for Rust"
 HOMEPAGE = "https://github.com/meta-rust/rust-hello-world";
 LICENSE = "MIT | Apache-2.0"
 
+CARGO_NO_FROZEN = "1"
+
 S = "${WORKDIR}/git"
 
 BBCLASSEXTEND = "native"
-- 
2.34.1

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

Reply via email to