summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-07 12:28:56 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-07 12:30:27 -0400
commit374b96a91c167a947d5f607ae9db5992ff8d2cb4 (patch)
tree8901218f7b22a30dd0b539dc4018be95998cae61
parent6bf644f14b3f5ad5d1adf028b850fe8245234fac (diff)
downloadb4-374b96a91c167a947d5f607ae9db5992ff8d2cb4.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__.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index e0403ec..de6a274 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: