diff options
author | Alex Kiernan <alex.kiernan@gmail.com> | 2023-12-08 12:00:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-09 19:17:11 +0000 |
commit | 6543d3c5e9fc0eecf68f9db1614b8c48fd600b73 (patch) | |
tree | 47f02d8ae2cb885006e88a3750bcaba318510a26 /meta/classes-recipe/cargo_common.bbclass | |
parent | dddfe1e3f4135d974c6692071e08f6e0a96df1b3 (diff) | |
download | poky-6543d3c5e9fc0eecf68f9db1614b8c48fd600b73.tar.gz |
cargo: Add CARGO_LOCK_PATH for path to Cargo.lock
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.
(From OE-Core rev: 30159f88a97c73d234f69c5800ba2adb0e26ad44)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/cargo_common.bbclass')
-rw-r--r-- | meta/classes-recipe/cargo_common.bbclass | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass index 48cdd69bca..0fb443edbd 100644 --- a/meta/classes-recipe/cargo_common.bbclass +++ b/meta/classes-recipe/cargo_common.bbclass | |||
@@ -40,6 +40,9 @@ CARGO_SRC_DIR ??= "" | |||
40 | # The actual path to the Cargo.toml | 40 | # The actual path to the Cargo.toml |
41 | CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml" | 41 | CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml" |
42 | 42 | ||
43 | # Path to Cargo.lock | ||
44 | CARGO_LOCK_PATH ??= "${@ os.path.join(os.path.dirname(d.getVar('CARGO_MANIFEST_PATH', True)), 'Cargo.lock')}" | ||
45 | |||
43 | CARGO_RUST_TARGET_CCLD ??= "${RUST_TARGET_CCLD}" | 46 | CARGO_RUST_TARGET_CCLD ??= "${RUST_TARGET_CCLD}" |
44 | cargo_common_do_configure () { | 47 | cargo_common_do_configure () { |
45 | mkdir -p ${CARGO_HOME}/bitbake | 48 | mkdir -p ${CARGO_HOME}/bitbake |
@@ -168,8 +171,7 @@ python cargo_common_do_patch_paths() { | |||
168 | # here is better than letting cargo tell (in case the file is missing) | 171 | # here is better than letting cargo tell (in case the file is missing) |
169 | # "Cargo.lock should be modified but --frozen was given" | 172 | # "Cargo.lock should be modified but --frozen was given" |
170 | 173 | ||
171 | manifest_path = d.getVar("CARGO_MANIFEST_PATH", True) | 174 | lockfile = d.getVar("CARGO_LOCK_PATH", True) |
172 | lockfile = os.path.join(os.path.dirname(manifest_path), "Cargo.lock") | ||
173 | if not os.path.exists(lockfile): | 175 | if not os.path.exists(lockfile): |
174 | bb.fatal(f"{lockfile} file doesn't exist") | 176 | bb.fatal(f"{lockfile} file doesn't exist") |
175 | 177 | ||