Skip to contentSkip to conversation

siggen: Ensure version of siggen is verified

PATCH New Richard Purdie 1 participant 1 message Jan 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 siggen: Ensure version of siggen is verified

Since we need to change the form of the siggen function, we need to add versioning and some verison checks. This means if a newer bitbake is used with older metadata we can detect it.

---
 lib/bb/command.py  |  1 +
 lib/bb/runqueue.py |  1 +
 lib/bb/siggen.py   | 10 ++++++++++
 3 files changed, 12 insertions(+)
lib/bb/command.py +1 -0
index 79b6c0738f..1fcb9bf14c 100644
@@ -777,6 +777,7 @@ class CommandsAsync:
         (mc, pn) = bb.runqueue.split_mc(params[0])
         taskname = params[1]
         sigs = params[2]
+        bb.siggen.check_siggen_version(bb.siggen)
         res = bb.siggen.find_siginfo(pn, taskname, sigs, command.cooker.databuilder.mcdata[mc])
         bb.event.fire(bb.event.FindSigInfoResult(res), command.cooker.databuilder.mcdata[mc])
         command.finishAsyncCommand()
lib/bb/runqueue.py +1 -0
index 51959231b7..9e3a87c0e8 100644
@@ -1760,6 +1760,7 @@ class RunQueue:
         return invalidtasks
 
     def write_diffscenetasks(self, invalidtasks):
+        bb.siggen.check_siggen_version(bb.siggen)
 
         # Define recursion callback
         def recursecb(key, hash1, hash2):
lib/bb/siggen.py +10 -0
index b023b79eca..5a584cadf9 100644
@@ -24,6 +24,16 @@ import hashserv.client
 logger = logging.getLogger('BitBake.SigGen')
 hashequiv_logger = logging.getLogger('BitBake.SigGen.HashEquiv')
 
+#find_siginfo and find_siginfo_version are set by the metadata siggen
+# The minimum version of the find_siginfo function we need
+find_siginfo_minversion = 2
+
+def check_siggen_version(siggen):
+    if not hasattr(siggen, "find_siginfo_version"):
+        bb.fatal("Siggen from metadata (OE-Core?) is too old, please update it (no version found)")
+    if siggen.find_siginfo_version < siggen.find_siginfo_minversion:
+        bb.fatal("Siggen from metadata (OE-Core?) is too old, please update it (%s vs %s)" % (siggen.find_siginfo_version, siggen.find_siginfo_minversion))
+
 class SetEncoder(json.JSONEncoder):
     def default(self, obj):
         if isinstance(obj, set) or isinstance(obj, frozenset):
Signature · 1 line
2.39.2