* [OE-core][PATCH] classes/crate-fetch: Ensure crate fetcher is available
@ 2021-11-19 2:12 Joshua Watt
2021-11-19 2:14 ` Joshua Watt
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Watt @ 2021-11-19 2:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Randy.MacLeod, Joshua Watt
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 <JPEWhacker@gmail.com>
---
meta/classes/crate-fetch.bbclass | 21 ++++++++++++++++++---
1 file 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)}"
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [OE-core][PATCH] classes/crate-fetch: Ensure crate fetcher is available
2021-11-19 2:12 [OE-core][PATCH] classes/crate-fetch: Ensure crate fetcher is available Joshua Watt
@ 2021-11-19 2:14 ` Joshua Watt
0 siblings, 0 replies; 2+ messages in thread
From: Joshua Watt @ 2021-11-19 2:14 UTC (permalink / raw)
To: openembedded-core; +Cc: Randy.MacLeod
On 11/18/21 8:12 PM, Joshua Watt wrote:
> 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>
> ---
> meta/classes/crate-fetch.bbclass | 21 ++++++++++++++++++---
> 1 file 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)}"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-19 2:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 2:12 [OE-core][PATCH] classes/crate-fetch: Ensure crate fetcher is available Joshua Watt
2021-11-19 2:14 ` Joshua Watt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.