Description
We recently upgraded to Yocto styhead. After going through yet another problem with cargo-bitbake (WORKDIR
becoming UNPACKDIR
), we looked at how Rust recipes were being managed upstream these days, specifically in poky
, and found that they have all migrated away from cargo-bitbake
1.
What basically happened, as far as we could tell, is that cargo-bitbake was replaced with a normally written recipe (no more auto-generated .bb
file) and a new bitbake command (bitbake -c update_crates RECIPE_NAME
) that converts the Cargo.lock
coming from the repository into a list of crates 2. This is similar to how cargo-bitbake works but I'd argue the file structure is much better organized, since auto-generated content (the list of crates and hashes) sits in a secondary file instead of the main one.
We immediately converted all of our Rust recipes to this new system and found the whole thing to be much faster and cleaner to manage. This led to the deprecation of our fork of cargo-bitbake given that we don't care about previous Yocto versions 3.
The conversion can be done by:
1 Writing a "standard" .bb
file, just like you would do with any other language
2. inherit
ing cargo
and cargo-update-recipe-crates
3. require ${BPN}-crates.inc
4. Create an empty file for ${BPN}-crates.inc
5. Run bitbake -c update_crates RECIPE_NAME
6. Repeat step 5 when updating the package to a new version
I'm not sure if this was obvious to everyone else, but we happened to find this out by pure chance, and after doing a little digging in the documentation we found both the new method and cargo-bitbake suggested as possible solutions for Rust packaging 4, while thinking about our own experience we would never touch cargo-bitbake again now that a better solution is available. Is it time to let cargo-bitbake die?