* [PATCH 1/2] tinfoil: add new "finalizeData" API
@ 2024-11-12 23:05 Yoann Congal
2024-11-12 23:05 ` [PATCH 2/2] bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e" Yoann Congal
0 siblings, 1 reply; 4+ messages in thread
From: Yoann Congal @ 2024-11-12 23:05 UTC (permalink / raw)
To: bitbake-devel; +Cc: Yoann Congal
From: Yoann Congal <yoann.congal@smile.fr>
Create a new tinfoil API "finalizeData" which does key expantion and
runs the anonymous functions to allow bitbake-getvar to have the same
output as "bitbake -e".
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
lib/bb/command.py | 8 ++++++++
lib/bb/tinfoil.py | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 1fcb9bf14..3d094fc34 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -24,6 +24,7 @@ import io
import bb.event
import bb.cooker
import bb.remotedata
+import bb.parse
class DataStoreConnectionHandle(object):
def __init__(self, dsindex=0):
@@ -582,6 +583,13 @@ class CommandsSync:
return DataStoreConnectionHandle(idx)
parseRecipeFile.readonly = True
+ def finalizeData(self, command, params):
+ newdata = command.cooker.data.createCopy()
+ bb.data.expandKeys(newdata)
+ bb.parse.ast.runAnonFuncs(newdata)
+ idx = command.remotedatastores.store(newdata)
+ return DataStoreConnectionHandle(idx)
+
class CommandsAsync:
"""
A class of asynchronous commands
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index dcd3910cc..0e937fba3 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -633,6 +633,12 @@ class Tinfoil:
fn = self.get_recipe_file(pn)
return self.parse_recipe_file(fn)
+ def finalizeData(self):
+ """
+ Run anonymous functions and expand keys
+ """
+ return self._reconvert_type(self.run_command('finalizeData'), 'DataStoreConnectionHandle')
+
def parse_recipe_file(self, fn, appends=True, appendlist=None, config_data=None):
"""
Parse the specified recipe file (with or without bbappends)
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e"
2024-11-12 23:05 [PATCH 1/2] tinfoil: add new "finalizeData" API Yoann Congal
@ 2024-11-12 23:05 ` Yoann Congal
2024-11-13 14:50 ` [bitbake-devel] " Mathieu Dubois-Briand
0 siblings, 1 reply; 4+ messages in thread
From: Yoann Congal @ 2024-11-12 23:05 UTC (permalink / raw)
To: bitbake-devel; +Cc: Yoann Congal
From: Yoann Congal <yoann.congal@smile.fr>
Fixes [YOCTO #15638]
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
bin/bitbake-getvar | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bin/bitbake-getvar b/bin/bitbake-getvar
index 8901f99ae..bc0b989c8 100755
--- a/bin/bitbake-getvar
+++ b/bin/bitbake-getvar
@@ -45,6 +45,10 @@ if __name__ == "__main__":
tinfoil.prepare(quiet=2, config_only=True)
d = tinfoil.config_data
+ # Expand keys and run anonymous functions to get identical result to
+ # "bitbake -e"
+ d = tinfoil.finalizeData()
+
value = None
if args.flag:
value = d.getVarFlag(args.variable, args.flag, expand=not args.unexpand)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-14 22:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 23:05 [PATCH 1/2] tinfoil: add new "finalizeData" API Yoann Congal
2024-11-12 23:05 ` [PATCH 2/2] bitbake-getvar: use finalizeData tinfoil API to get identical result to "bitbake -e" Yoann Congal
2024-11-13 14:50 ` [bitbake-devel] " Mathieu Dubois-Briand
2024-11-14 22:22 ` Yoann Congal
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.