classes/crate-fetch: Ensure crate fetcher is available
PATCH 1/1 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.
Signed-off-by Joshua Watt <[email protected]>
--- meta/classes/crate-fetch.bbclass | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
meta/classes/crate-fetch.bbclass +18 -3
@@ -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)}"
Signature · 1 line
2.33.0
Quoted 4 lines · Joshua Watt
Reworks the crate fetcher class to have it install the fetcher at recipe finalization so that it is always available before
SRC_URIis expanded. In addition, override the value of SRCPV to also install the fetcher when SRCPV is expanded so that AUTOREV works.
[YOCTO #10867]
Quoted 35 lines
Signed-off-by Joshua Watt <[email protected]>--- meta/classes/crate-fetch.bbclass | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)meta/classes/crate-fetch.bbclass +18
-3@@ -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)}"