aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2022-10-19 11:04:36 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2022-11-24 20:33:11 +0100
commit7d5fc59b8c256246bb72da67133beb832831937e (patch)
treeb6378c3a0011430dad94954bb5b3bb418a28b2ea
parent9a7364fe25a62ea895d644303bfc87702d079604 (diff)
downloadopenembedded-core-contrib-jansa/langdale.tar.gz
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>
-rw-r--r--meta/classes-recipe/cargo-update-recipe-crates.bbclass8
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}
-CARGO_LOCK_SRC_DIR ??= ""
+# The directory where to search for Cargo.lock files
+CARGO_LOCK_SRC_DIR ??= "${S}"
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))