]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cargo.bbclass: use offline mode for building
authorFrederic Martinsons <frederic.martinsons@gmail.com>
Wed, 15 Mar 2023 07:48:51 +0000 (08:48 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 16 Mar 2023 17:49:35 +0000 (17:49 +0000)
There should not be any network access during the build step so
specify this explicitely to cargo.
This will allow better error message, e.g:

| Caused by:
|  can't checkout from 'ssh://git@.../fmartinsons/zbus-git-dep-test.git': you are in  the offline mode (--offline)

Instead of

|   Updating git repository `ssh://git@.../fmartinsons/zbus-git-dep-test.git`
| warning: spurious network error (2 tries remaining): failed to resolve address for gitlab.com: Temporary failure in name resolution;class=Net (12)

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

index 93e185f2c98071da5cb20a7d09f2252a9bda60f1..7a8cc1e75188eac8cdf4ad29cdaed866deabf226 100644 (file)
@@ -39,7 +39,7 @@ MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 
 RUSTFLAGS ??= ""
 BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
+CARGO_BUILD_FLAGS = "-v --offline --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.