diff options
authorMartin Jansa <Martin.Jansa@gmail.com>2022-10-19 11:04:36 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2022-12-02 09:34:31 +0100
commit0767b54d9f8e69bad1bbcb4241764c40b66c98b2 (patch)
parent13e07d03e66cd4ce054d7ef1ec16ddfcc211ff84 (diff)
cargo-update-recipe-creates: change CARGO_LOCK_SRC_DIRjansa/langdale
* I've used it as relative to ${S}, because that's what CARGO_SRC_DIR in cargo.bbclass is using: meta/classes-recipe/cargo.bbclass:CARGO_SRC_DIR ??= "" meta/classes-recipe/cargo.bbclass:MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml" but change it as requested by Alex: 11:44 < kanavin> JaMa, would prefer CARGO_LOCK_SRC_DIR ??= "${S}" 11:46 < kanavin> otherwise looks good * I've resolved my usecase for CARGO_LOCK_SRC_DIR by changing S back to ${WORKDIR}/git and using CARGO_SRC_DIR to select the right subdirectory to be built, because the Cargo.toml in this subdirectory was also referencing other subdirectories with relative path: https://github.com/solana-labs/solana-program-library/blob/88b147506d5b9515f3a4762421a0b8c309188dc9/token/cli/Cargo.toml#L30 so including all Cargo.lock files in whole ${WORKDIR}/git seems like reasonable approach Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
index c25fe8ef3e..3a12ba247d 100644
--- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass
+++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass
@@ -16,15 +16,15 @@
addtask do_update_crates after do_patch
do_update_crates[depends] = "python3-native:do_populate_sysroot"
-# The directory where to search for Cargo.lock files relative to the root directory ${S}
+# The directory where to search for Cargo.lock files
do_update_crates() {
nativepython3 - <<EOF
def get_crates(f):
import tomllib
- c_list = '# from %s' % os.path.relpath(f, '${S}')
+ c_list = '# from %s' % os.path.relpath(f, '${CARGO_LOCK_SRC_DIR}')
c_list += '\nSRC_URI += " \\\'
crates = tomllib.load(open(f, 'rb'))
for c in crates['package']:
@@ -35,7 +35,7 @@ def get_crates(f):
import os
crates = "# Autogenerated with 'bitbake -c update_crates ${PN}'\n\n"
-for root, dirs, files in os.walk('${S}/${CARGO_LOCK_SRC_DIR}'):
+for root, dirs, files in os.walk('${CARGO_LOCK_SRC_DIR}'):
for file in files:
if file == 'Cargo.lock':
crates += get_crates(os.path.join(root, file))