]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cargo.bbclass: Use --frozen flag for cargo operations
authorFrederic Martinsons <frederic.martinsons@gmail.com>
Wed, 2 Aug 2023 13:16:03 +0000 (15:16 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 9 Aug 2023 12:21:27 +0000 (13:21 +0100)
It supersed the --offline flag and guarantee that Cargo.lock
file will not be modified during the build.

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/cargo.bbclass

index 3ef0bbbb44e9670a03b205ae6b0cbb6a48363fb1..8c0b92df8d3330a6f2db9a6396339d5a65661ff0 100644 (file)
@@ -39,7 +39,12 @@ MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 
 RUSTFLAGS ??= ""
 BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --offline --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
+# --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}"
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.