Skip to content

Commit 4a9492c

Browse files
authored
Fix suite report (#83)
* add debug prints * more debug * more debug * add another print * add SRS info from fcm info * improve info find * remove extra prints * remove extra prints * correctly line up else
1 parent 790d9f3 commit 4a9492c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

suite_report.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ def __init__(
425425
proj_dict["tested source"] = _remove_quotes(proj_dict["tested source"])
426426
if "repo loc" in proj_dict:
427427
proj_dict["repo loc"] = self.convert_to_srs(
428-
proj_dict["repo loc"], self.projects
428+
proj_dict["repo loc"], self.projects, fcm_exec
429429
)
430430
else:
431431
proj_dict["repo loc"] = self.convert_to_srs(
432-
proj_dict["tested source"], self.projects
432+
proj_dict["tested source"], self.projects, fcm_exec
433433
)
434434

435435
proj_dict["repo mirror"] = self.convert_to_mirror(
@@ -445,7 +445,7 @@ def __init__(
445445
)
446446

447447
proj_dict["parent loc"] = self.convert_to_srs(
448-
proj_dict["parent mirror"], self.projects
448+
proj_dict["parent mirror"], self.projects, fcm_exec
449449
)
450450
# Check "repo loc" and "parent loc" have revisions,
451451
# and if not, try to get a head of 'trunk' one for them.
@@ -1484,10 +1484,12 @@ def convert_to_mirror(url, projects_dict):
14841484
return mirror_url
14851485

14861486
@staticmethod
1487-
def convert_to_srs(url, projects_dict):
1487+
def convert_to_srs(url, projects_dict, fcm_exec):
14881488
"""Take a URL as a string, and a dictionary of {project : url, ...}
14891489
If url is a mirror repository URL in the projects dictionary convert
14901490
to an SRS URL if also availble.
1491+
If this doesn't look like an "fcm" link then try running "fcm info"
1492+
to get the repo location.
14911493
Otherwise return the original URL
14921494
"""
14931495
if url is None:
@@ -1528,6 +1530,15 @@ def convert_to_srs(url, projects_dict):
15281530
else:
15291531
srs_url = re.sub(proj, shared_project, url, count=1)
15301532
break
1533+
else:
1534+
command = [fcm_exec, "info", url]
1535+
_, stdout, _ = _run_command(command, ignore_fail=True)
1536+
find_url = re.compile(r"URL:\s*(.*)")
1537+
for line in stdout:
1538+
result = find_url.search(line)
1539+
if result:
1540+
srs_url = result.group(1).rstrip()
1541+
break
15311542
return srs_url
15321543

15331544
@staticmethod

0 commit comments

Comments
 (0)