diff --git a/contest/results-faker.py b/contest/results-faker.py index 753d51b..608b10c 100755 --- a/contest/results-faker.py +++ b/contest/results-faker.py @@ -15,43 +15,19 @@ Config: [input] -branches=/path/to/branches.json,/path/to/branches2.json -infos=/path/to/infos.json,/path/to/infos2.json +branches=/path/to/branches.json [output] dir=/path/to/output url_pfx=relative/within/server -info=/path/to/info.json """ -def combine_infos(config): - paths = config.get("input", "infos", fallback="").split(',') - if not paths or not paths[0]: - return - - infos = {} - for path in paths: - with open(path, "r") as fp: - infos.update(json.load(fp)) - - # atomic write needed - path = config.get("output", "info") - tmp = path + '.new' - with open(tmp, 'w') as fp: - json.dump(infos, fp) - os.rename(tmp, path) - - def main() -> None: config = configparser.ConfigParser() config.read(['faker.config']) - combine_infos(config) - - branches = [] - paths = config.get("input", "branches") - for path in paths.split(','): - with open(path, "r") as fp: - branches += json.load(fp) + path = config.get("input", "branches") + with open(path, "r") as fp: + branches = json.load(fp) branches = sorted(branches, key=lambda x: x["date"]) @@ -85,7 +61,7 @@ def main() -> None: if br["url"].startswith('https://github.com') and tail > 0: br_url = br["url"][:tail] + "/commits/" + br["url"][tail + 5:] else: - br_url = "https://netdev.bots.linux.dev/contest/branches.json" + br_url = "https://netdev.bots.linux.dev/contest/" + os.path.basename(path) run["results"] = [ {"test": "branch-created", "group": "---", "result": "pass", "link": br_url}