diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-07 12:28:56 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-07 12:28:56 -0400 |
commit | 852e334191af5b6bc6825424acc5cfed3891272d (patch) | |
tree | 24ba8cfa2df5fd4a3712e06329cb4f6e8c0c59f8 | |
parent | 46c29287b1284e3d5de32107dbfca752fd40c8ed (diff) | |
download | b4-852e334191af5b6bc6825424acc5cfed3891272d.tar.gz |
Fix attestation error messages
Fix a crash when multiple patches fail attestation. Also fixes fancy
chechmarks.
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 37121be..5c2de31 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -39,7 +39,7 @@ FILENAME_RE = re.compile(r'^(---|\+\+\+) (\S+)') PASS_SIMPLE = '[P]' FAIL_SIMPLE = '[F]' PASS_FANCY = '[\033[32m\u2713\033[0m]' -FAIL_FANCY = '[\033[31m\u2717\034[0m]' +FAIL_FANCY = '[\033[31m\u2717\033[0m]' # You can use bash-style globbing here WANTHDRS = [ @@ -521,15 +521,22 @@ class LoreSeries: if attpolicy in ('softfail', 'hardfail'): logger.info(' %s %s', attfail, lmsg.full_subject) # Which part failed? - failed = ['commit metadata', 'commit message', 'patch content'] + fi = fm = fp = True for attdoc in ATTESTATIONS: for i, m, p in attdoc.hashes: if p == lmsg.attestation.p: - failed.remove('patch content') + fp = False if m == lmsg.attestation.m: - failed.remove('commit message') + fm = False if i == lmsg.attestation.i: - failed.remove('commit metadata') + fi = False + failed = list() + if fp: + failed.append('patch content') + if fm: + failed.append('commit message') + if fi: + failed.append('patch metadata') atterrors.append('Patch %s/%s failed attestation (%s)' % (at, lmsg.expected, ', '.join(failed))) else: |