[v2,1/3] fix(isar-sstate): catch errors during signature reading

Message ID 20220719123509.308439-2-adriaan.schmidt@siemens.com
State Accepted, archived
Headers show
Series isar-sstate improvements | expand

Commit Message

Schmidt, Adriaan July 19, 2022, 4:35 a.m. UTC
Those errors happen when the sstate cache contains both pre and post
bitbake-2.0 signatures, which have a different format (pickle vs. compressed json).

Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
 scripts/isar-sstate | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Patch

diff --git a/scripts/isar-sstate b/scripts/isar-sstate
index 8ea85edc..5c47b479 100755
--- a/scripts/isar-sstate
+++ b/scripts/isar-sstate
@@ -781,7 +781,10 @@  def sstate_analyze(source, target, **kwargs):
 
             local_file = source.download(s.path)
             remote_file = target.download(t.path)
-            out = compare_sigfiles(remote_file, local_file, recursecb, color=True)
+            try:
+                out = compare_sigfiles(remote_file, local_file, recursecb, color=True)
+            except:
+                out = ["Failed to compare signatures."]
             source.release(local_file)
             target.release(remote_file)
             # shorten hashes from 64 to 8 characters for better readability
@@ -803,8 +806,12 @@  def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, **kwargs):
     for sig in cache_sigs.values():
         sig_file = target.download(sig.path)
         with open(sig_file, 'rb') as f:
-            sigdata_raw = pickle.Unpickler(f)
-            sigdata = sigdata_raw.load()
+            try:
+                sigdata_raw = pickle.Unpickler(f)
+                sigdata = sigdata_raw.load()
+            except:
+                # invalid file or format... never mind
+                continue
 
             pn_issues = []
             for name, val in sigdata['varvals'].items():