summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/sstatesig.py
diff options
context:
space:
mode:
authorJulien Stephan <jstephan@baylibre.com>2023-09-25 10:04:50 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-09 15:58:47 +0100
commit043ca5f64db8d98c30bdc4cb1f3f6976561495e7 (patch)
treeb9d14bd547206e7baefb8077d75bde4b93ff4458 /meta/lib/oe/sstatesig.py
parent96f6271d0a3a4a2da724be712f0342e50c6b59c4 (diff)
downloadpoky-043ca5f64db8d98c30bdc4cb1f3f6976561495e7.tar.gz
sstatesig: add a new info level for SIGGEN_LOCKEDSIGS_TASKSIG_CHECK
as of now, SIGGEN_LOCKEDSIGS_TASKSIG_CHECK can take 2 values: "warn" and "error", displaying respectively a warning or a fatal error message only when a task is locked and the task signature is different from the locked one. The "info" level is introduced to add a "note" message to remind the user that a recipe is locked even if the signature is equivalent to the locked one. The "warn" and "error" level display the warn/error message for each task having a mismatch of the signature. Doing this with the "info" level would result in very verbose output if there are several tasks locked, so the info level will only print once the list of recipes that have locked signature. (From OE-Core rev: 840402181d36ca3f60119984478979afb5bb3bbf) Signed-off-by: Julien Stephan <jstephan@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/sstatesig.py')
-rw-r--r--meta/lib/oe/sstatesig.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 633a0fd450..5bf1697e72 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -104,6 +104,8 @@ class SignatureGeneratorOEBasicHashMixIn(object):
104 self.lockedhashfn = {} 104 self.lockedhashfn = {}
105 self.machine = data.getVar("MACHINE") 105 self.machine = data.getVar("MACHINE")
106 self.mismatch_msgs = [] 106 self.mismatch_msgs = []
107 self.mismatch_number = 0
108 self.lockedsigs_msgs = ""
107 self.unlockedrecipes = (data.getVar("SIGGEN_UNLOCKED_RECIPES") or 109 self.unlockedrecipes = (data.getVar("SIGGEN_UNLOCKED_RECIPES") or
108 "").split() 110 "").split()
109 self.unlockedrecipes = { k: "" for k in self.unlockedrecipes } 111 self.unlockedrecipes = { k: "" for k in self.unlockedrecipes }
@@ -187,6 +189,7 @@ class SignatureGeneratorOEBasicHashMixIn(object):
187 #bb.warn("Using %s %s %s" % (recipename, task, h)) 189 #bb.warn("Using %s %s %s" % (recipename, task, h))
188 190
189 if h != h_locked and h_locked != unihash: 191 if h != h_locked and h_locked != unihash:
192 self.mismatch_number += 1
190 self.mismatch_msgs.append('The %s:%s sig is computed to be %s, but the sig is locked to %s in %s' 193 self.mismatch_msgs.append('The %s:%s sig is computed to be %s, but the sig is locked to %s in %s'
191 % (recipename, task, h, h_locked, var)) 194 % (recipename, task, h, h_locked, var))
192 195
@@ -267,6 +270,15 @@ class SignatureGeneratorOEBasicHashMixIn(object):
267 warn_msgs = [] 270 warn_msgs = []
268 error_msgs = [] 271 error_msgs = []
269 sstate_missing_msgs = [] 272 sstate_missing_msgs = []
273 info_msgs = None
274
275 if self.lockedsigs:
276 if len(self.lockedsigs) > 10:
277 self.lockedsigs_msgs = "There are %s recipes with locked tasks (%s task(s) have non matching signature)" % (len(self.lockedsigs), self.mismatch_number)
278 else:
279 self.lockedsigs_msgs = "The following recipes have locked tasks:"
280 for pn in self.lockedsigs:
281 self.lockedsigs_msgs += " %s" % (pn)
270 282
271 for tid in sq_data['hash']: 283 for tid in sq_data['hash']:
272 if tid not in found: 284 if tid not in found:
@@ -279,7 +291,9 @@ class SignatureGeneratorOEBasicHashMixIn(object):
279 % (pn, taskname, sq_data['hash'][tid])) 291 % (pn, taskname, sq_data['hash'][tid]))
280 292
281 checklevel = d.getVar("SIGGEN_LOCKEDSIGS_TASKSIG_CHECK") 293 checklevel = d.getVar("SIGGEN_LOCKEDSIGS_TASKSIG_CHECK")
282 if checklevel == 'warn': 294 if checklevel == 'info':
295 info_msgs = self.lockedsigs_msgs
296 if checklevel == 'warn' or checklevel == 'info':
283 warn_msgs += self.mismatch_msgs 297 warn_msgs += self.mismatch_msgs
284 elif checklevel == 'error': 298 elif checklevel == 'error':
285 error_msgs += self.mismatch_msgs 299 error_msgs += self.mismatch_msgs
@@ -290,6 +304,8 @@ class SignatureGeneratorOEBasicHashMixIn(object):
290 elif checklevel == 'error': 304 elif checklevel == 'error':
291 error_msgs += sstate_missing_msgs 305 error_msgs += sstate_missing_msgs
292 306
307 if info_msgs:
308 bb.note(info_msgs)
293 if warn_msgs: 309 if warn_msgs:
294 bb.warn("\n".join(warn_msgs)) 310 bb.warn("\n".join(warn_msgs))
295 if error_msgs: 311 if error_msgs: