From c06c41078be64e49eab851e63896fe96c5d8395e Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 9 Feb 2023 14:17:26 -0500 Subject: [PATCH] r-httpd-browse: /testruns/ tolerate systemtap testrun These repos may lack source.gitdescribe metadata key. --- bin/r-httpd-browse.in | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/r-httpd-browse.in b/bin/r-httpd-browse.in index ec80eaf..9c072cb 100755 --- a/bin/r-httpd-browse.in +++ b/bin/r-httpd-browse.in @@ -730,12 +730,17 @@ def create_app(): # filter out empty commitishes strings, which can come from an empty text box commitishes = [i for i in commitishes if i] + # fetch list of keywords in database + with sqlite3.connect(args.db, uri=True) as db: + keywords = [row[0] for row in db.execute("select distinct key from testrun_kv order by key")] + if not has_keyvalue_k and not has_keyvalue_v: # set a pretty default has_keyvalue_k = 'testrun.git_describe' has_keyvalue_v = '*' has_keyvalue_op = 'glob' - if not has_keyvalue2_k and not has_keyvalue2_v: # set a pretty default - has_keyvalue2_k = 'source.gitdescribe' + default_kv2 = 'source.gitdescribe' + if not has_keyvalue2_k and not has_keyvalue2_v and default_kv2 in keywords: # set a pretty default + has_keyvalue2_k = default_kv2 has_keyvalue2_v = '*' has_keyvalue2_op = 'glob' if not has_keyvalue_op: @@ -753,10 +758,6 @@ def create_app(): offset = "0" limit = request.args.get('limit', "1000") - # fetch list of keywords in database - with sqlite3.connect(args.db, uri=True) as db: - keywords = [row[0] for row in db.execute("select distinct key from testrun_kv order by key")] - cmd = ["r-find-testruns", "--git", args.git, "--db", args.db, "--template", "json"] @@ -774,7 +775,7 @@ def create_app(): cmd.extend(["--has-keyvalue-op", has_keyvalue_op]) if has_keyvalue2_k and has_keyvalue2_v: cmd.extend(["--has-keyvalue2", has_keyvalue2_k, has_keyvalue2_v]) - if has_keyvalue_op: + if has_keyvalue2_op: cmd.extend(["--has-keyvalue2-op", has_keyvalue2_op]) if order_by: cmd.extend(["--order-by", order_by]) -- 2.43.5