diff mbox series

[langdale,20/21] cargo.bbclass: use offline mode for building

Message ID bad6361b2f90e7916e344148976a968559375eda.1679494378.git.steve@sakoman.com
State New
Headers show
Series [langdale,01/21] git: ignore CVE-2023-22743 | expand

Commit Message

Steve Sakoman March 22, 2023, 2:21 p.m. UTC
From: Frederic Martinsons <frederic.martinsons@gmail.com>

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>
(cherry picked from commit 8e9ec03c73e8c09e223d6f6cce297df363991350)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
 meta/classes-recipe/cargo.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index d1e83518b5..b27eb2f209 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -39,7 +39,7 @@  MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 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.