All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cache/siggen: Simplify passing basehash data into the cache
@ 2022-12-01 22:17 Richard Purdie
  2022-12-04 22:31 ` [bitbake-devel] " Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-12-01 22:17 UTC (permalink / raw)
  To: bitbake-devel

The basehash data is really internal bitbake data and passing an object
directly is more efficient than creating and then extracting variables.

This will match the format of other data we may optionally wish to
store in the cache so more to the more efficient method. Nothing I
can see is using this data today (and nothing should be).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cache.py  | 4 ++--
 lib/bb/siggen.py | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index cb6cf21727..e1214d6ad2 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -28,7 +28,7 @@ import shutil
 
 logger = logging.getLogger("BitBake.Cache")
 
-__cache_version__ = "154"
+__cache_version__ = "155"
 
 def getCacheFile(path, filename, mc, data_hash):
     mcspec = ''
@@ -105,7 +105,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
 
         self.tasks = metadata.getVar('__BBTASKS', False)
 
-        self.basetaskhashes = self.taskvar('BB_BASEHASH', self.tasks, metadata)
+        self.basetaskhashes = metadata.getVar('__siggen_basehashes', False)
         self.hashfilename = self.getvar('BB_HASHFILENAME', metadata)
 
         self.task_deps = metadata.getVar('_task_deps', False) or {'tasks': [], 'parents': {}}
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 72b906c153..34b71d596a 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -247,8 +247,11 @@ class SignatureGeneratorBasic(SignatureGenerator):
         #for task in self.taskdeps[fn]:
         #    self.dump_sigtask(fn, task, d.getVar("STAMP"), False)
 
+        basehashes = {}
         for task in taskdeps:
-            d.setVar("BB_BASEHASH:task-%s" % task, self.basehash[fn + ":" + task])
+            basehashes[task] = self.basehash[fn + ":" + task]
+
+        d.setVar("__siggen_basehashes", basehashes)
 
     def postparsing_clean_cache(self):
         #
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH v2] cache/siggen: Simplify passing basehash data into the cache
@ 2022-12-05 15:18 Richard Purdie
  2022-12-05 15:58 ` [bitbake-devel] " Joshua Watt
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-12-05 15:18 UTC (permalink / raw)
  To: bitbake-devel

The basehash data is really internal bitbake data and passing an object
directly is more efficient than creating and then extracting variables.

This will match the format of other data we may optionally wish to
store in the cache so more to the more efficient method. Nothing I
can see is using this data today (and nothing should be).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cache.py  | 4 ++--
 lib/bb/siggen.py | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

v2: Add default for the cache entry so selftest works

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index cb6cf21727..e117fe56cb 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -28,7 +28,7 @@ import shutil
 
 logger = logging.getLogger("BitBake.Cache")
 
-__cache_version__ = "154"
+__cache_version__ = "155"
 
 def getCacheFile(path, filename, mc, data_hash):
     mcspec = ''
@@ -105,7 +105,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
 
         self.tasks = metadata.getVar('__BBTASKS', False)
 
-        self.basetaskhashes = self.taskvar('BB_BASEHASH', self.tasks, metadata)
+        self.basetaskhashes = metadata.getVar('__siggen_basehashes', False) or {}
         self.hashfilename = self.getvar('BB_HASHFILENAME', metadata)
 
         self.task_deps = metadata.getVar('_task_deps', False) or {'tasks': [], 'parents': {}}
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 72b906c153..34b71d596a 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -247,8 +247,11 @@ class SignatureGeneratorBasic(SignatureGenerator):
         #for task in self.taskdeps[fn]:
         #    self.dump_sigtask(fn, task, d.getVar("STAMP"), False)
 
+        basehashes = {}
         for task in taskdeps:
-            d.setVar("BB_BASEHASH:task-%s" % task, self.basehash[fn + ":" + task])
+            basehashes[task] = self.basehash[fn + ":" + task]
+
+        d.setVar("__siggen_basehashes", basehashes)
 
     def postparsing_clean_cache(self):
         #
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-05 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 22:17 [PATCH v2] cache/siggen: Simplify passing basehash data into the cache Richard Purdie
2022-12-04 22:31 ` [bitbake-devel] " Alexandre Belloni
  -- strict thread matches above, loose matches on Subject: below --
2022-12-05 15:18 Richard Purdie
2022-12-05 15:58 ` [bitbake-devel] " 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.