-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta-balena-rust: Provide crate fetcher for Yocto versions without it
The crate fetcher was introduced in bitbake in Kirkstone, before that it was living in meta-rust. We want to use the balena-rust layer across a wide variety of Yocto versions so include the fetcher conditionally. Signed-off-by: Alex Gonzalez <[email protected]> Signed-off-by: Florin Sarbu <[email protected]>
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# crate-fetch class | ||
# | ||
# Registers 'crate' method for Bitbake fetch2. | ||
# | ||
# Adds support for following format in recipe SRC_URI: | ||
# crate://<packagename>/<version> | ||
# | ||
|
||
def import_crate(d): | ||
import crate | ||
if not getattr(crate, 'imported', False): | ||
bb.fetch2.methods.append(crate.Crate()) | ||
crate.imported = True | ||
|
||
python crate_import_handler() { | ||
import_crate(d) | ||
} | ||
|
||
addhandler crate_import_handler | ||
crate_import_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
|
||
def crate_get_srcrev(d): | ||
import_crate(d) | ||
return bb.fetch2.get_srcrev(d) | ||
|
||
# Override SRCPV to make sure it imports the fetcher first | ||
SRCPV = "${@crate_get_srcrev(d)}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters