diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2021-11-18 20:12:49 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-23 10:53:15 +0000 |
commit | 7574868367ded0e4e1d11241e7ce6d04afd91dbe (patch) | |
tree | e62ee00bc82c0cce462a203c1179d74fd663b0b6 /meta/classes | |
parent | e7666d7cb8569df74147cc7def926b8c2dba8d9e (diff) | |
download | poky-7574868367ded0e4e1d11241e7ce6d04afd91dbe.tar.gz |
classes/crate-fetch: Ensure crate fetcher is available
Reworks the crate fetcher class to have it install the fetcher at recipe
finalization so that it is always available before SRC_URI is expanded.
In addition, override the value of SRCPV to also install the fetcher
when SRCPV is expanded so that AUTOREV works.
[YOCTO #10867]
(From OE-Core rev: bc66c5dd65fb654af5cd91b47f9b4f7a5f53436e)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/crate-fetch.bbclass | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/meta/classes/crate-fetch.bbclass b/meta/classes/crate-fetch.bbclass index c0ed434a96..a7fa22b2a0 100644 --- a/meta/classes/crate-fetch.bbclass +++ b/meta/classes/crate-fetch.bbclass | |||
@@ -7,7 +7,22 @@ | |||
7 | # crate://<packagename>/<version> | 7 | # crate://<packagename>/<version> |
8 | # | 8 | # |
9 | 9 | ||
10 | python () { | 10 | def import_crate(d): |
11 | import crate | 11 | import crate |
12 | bb.fetch2.methods.append( crate.Crate() ) | 12 | if not getattr(crate, 'imported', False): |
13 | bb.fetch2.methods.append(crate.Crate()) | ||
14 | crate.imported = True | ||
15 | |||
16 | python crate_import_handler() { | ||
17 | import_crate(d) | ||
13 | } | 18 | } |
19 | |||
20 | addhandler crate_import_handler | ||
21 | crate_import_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
22 | |||
23 | def crate_get_srcrev(d): | ||
24 | import_crate(d) | ||
25 | return bb.fetch2.get_srcrev(d) | ||
26 | |||
27 | # Override SRCPV to make sure it imports the fetcher first | ||
28 | SRCPV = "${@crate_get_srcrev(d)}" | ||