diff --git a/layers/meta-opentrons/classes/cargo-update-recipe-crates.bbclass b/layers/meta-opentrons/classes/cargo-update-recipe-crates.bbclass new file mode 100644 index 00000000..3251d5ef --- /dev/null +++ b/layers/meta-opentrons/classes/cargo-update-recipe-crates.bbclass @@ -0,0 +1,81 @@ +# +# 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[nostamp] = "1" +do_update_crates[doc] = "Update the recipe by reading Cargo.lock and write in ${THISDIR}/${BPN}-crates.inc" + +RECIPE_UPGRADE_EXTRA_TASKS += "do_update_crates" + +# The directory where to search for Cargo.lock files +CARGO_LOCK_SRC_DIR ??= "${S}" + +do_update_crates() { + TARGET_FILE="${THISDIR}/${BPN}-crates.inc" + + nativepython3 - <