From: Alexander Kanavin Date: Mon, 31 Oct 2022 11:47:07 +0000 (+0100) Subject: cargo-update-recipe-crates.bbclass: add a class to generate SRC_URI crate lists from... X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~2682 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9eee3631124d64574b18a70a2fc42f446d58bfd2;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git cargo-update-recipe-crates.bbclass: add a class to generate SRC_URI crate lists from Cargo.lock For better or worse, more and more rust components are appearing that do not include their dependencies in tarballs (or git trees), and rely on cargo to fetch them. On the other hand, bitbake does not use cargo (and quite possible won't ever be able to), and relies on having each item explicitly listed in SRC_URI with a crate:// prefix. This however creates a problem of both making such lists in the first place and updating them when a recipe is updated to a newer version. So this class can be used to perform such updates by implementing a task that does it; the next commit shows the outcome for python3-bcrypt (which has been tested to work and produce a successful build). Note: the python script relies on tomllib library, which appears in Python 3.11 and does not exist in earlier versions - I've tested this by first updating python to 3.11-rc2 in oe-core. Signed-off-by: Alexander Kanavin Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass new file mode 100644 index 00000000000..f90938c734d --- /dev/null +++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass @@ -0,0 +1,41 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +## +## Purpose: +## This class is used to update the list of crates in SRC_URI +## by reading Cargo.lock in the source tree. +## +## See meta/recipes-devtools/python/python3-bcrypt_*.bb for an example +## +## To perform the update: bitbake -c update_crates recipe-name + +addtask do_update_crates after do_patch +do_update_crates[depends] = "python3-native:do_populate_sysroot" + +do_update_crates() { + nativepython3 - <