summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-11-18 20:12:49 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-23 10:53:12 +0000
commitbc66c5dd65fb654af5cd91b47f9b4f7a5f53436e (patch)
tree907a85f26c2db13c25aa55b961e769c4c428d0f2 /meta
parentf86ffdb1b77c6ba32ec250545a40c1c54f983f21 (diff)
downloadopenembedded-core-contrib-bc66c5dd65fb654af5cd91b47f9b4f7a5f53436e.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] Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/crate-fetch.bbclass21
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 @@
# crate://<packagename>/<version>
#
-python () {
- import crate
- bb.fetch2.methods.append( crate.Crate() )
+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)}"