aboutsummaryrefslogtreecommitdiff
path: root/b4/__init__.py
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-06-10 09:57:23 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-06-10 09:57:23 -0400
commit723f4d79a6181b60f03f9573a394a85895f5cf03 (patch)
tree17473f4516f85ba7e534d39c73aedcb52bb4bc58 /b4/__init__.py
parentb18f05bdcaae1356124192b81a5e941261e67b63 (diff)
downloadb4-723f4d79a6181b60f03f9573a394a85895f5cf03.tar.gz
Start using pytest for the test framework
Since we're not caring about 2.x compatibility, pytest seems to be a good candidate for this job. Obviously, there's a lot of ground to cover, but the goal is to do all future modifications with tests added so we can reduce regressions. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/__init__.py')
-rw-r--r--b4/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index d69f80e..2572017 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2277,20 +2277,26 @@ def parse_int_range(intrange, upper=None):
logger.critical('Unknown range value specified: %s', n)
-def check_gpg_status(status: str) -> Tuple[bool, bool, bool, str, str]:
+def check_gpg_status(status: str) -> Tuple[bool, bool, bool, Optional[str], Optional[str]]:
good = False
valid = False
trusted = False
keyid = None
- signtime = ''
+ signtime = None
+
+ # Do we have a BADSIG?
+ bs_matches = re.search(r'^\[GNUPG:] BADSIG ([0-9A-F]+)\s+(.*)$', status, flags=re.M)
+ if bs_matches:
+ keyid = bs_matches.groups()[0]
+ return good, valid, trusted, keyid, signtime
gs_matches = re.search(r'^\[GNUPG:] GOODSIG ([0-9A-F]+)\s+(.*)$', status, flags=re.M)
if gs_matches:
good = True
+ keyid = gs_matches.groups()[0]
vs_matches = re.search(r'^\[GNUPG:] VALIDSIG ([0-9A-F]+) (\d{4}-\d{2}-\d{2}) (\d+)', status, flags=re.M)
if vs_matches:
valid = True
- keyid = vs_matches.groups()[0]
signtime = vs_matches.groups()[2]
ts_matches = re.search(r'^\[GNUPG:] TRUST_(FULLY|ULTIMATE)', status, flags=re.M)
if ts_matches: