From 1acdbccc1edc4c04e8ad668f4e75701bf937fcec Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Jan 11 2022 01:50:01 +0000 Subject: Merge #33 `Fix build errors and build only packages in product mapping` --- diff --git a/bin/fetch-repository-dbs.py b/bin/fetch-repository-dbs.py index c7968df..94bf8a0 100755 --- a/bin/fetch-repository-dbs.py +++ b/bin/fetch-repository-dbs.py @@ -358,7 +358,7 @@ def main(): args = parser.parse_args() # Get active releases from PDC. - print("Fetching active releases from PDC...") + print("Fetching active releases from PDC... https://pdc.fedoraproject.org/") r = requests.get( "https://pdc.fedoraproject.org/rest_api/v1/product-versions/", params={"active": "true"}, diff --git a/bin/generate-html.py b/bin/generate-html.py index 2999b72..d50ac6d 100755 --- a/bin/generate-html.py +++ b/bin/generate-html.py @@ -16,10 +16,13 @@ import argparse import glob from datetime import date +from collections import defaultdict +from pathlib import Path -from jinja2 import Environment, PackageLoader +from jinja2 import Environment, FileSystemLoader -TEMPLATE_DIR = "../templates" +ROOT_DIR = Path(__file__).parent.parent +TEMPLATE_DIR = ROOT_DIR / "templates" DBS_DIR = os.environ.get("DB_DIR") or "repositories" ASSETS_DIR = "assets" SCM_MAINTAINER_MAPPING = ( @@ -123,7 +126,7 @@ def main(): # Initialize templating system. env = Environment( - loader=PackageLoader("generate-html", TEMPLATE_DIR), autoescape=True + loader=FileSystemLoader(TEMPLATE_DIR), autoescape=True ) # Load maintainer mapping (imported from dist-git). @@ -138,7 +141,7 @@ def main(): release_mapping = json.load(raw) # Group databases files. - databases = {} + databases = defaultdict(dict) db_pattern = re.compile( "^(fedora|epel)-([\w|-]+)_(primary|filelists|other).sqlite$" ) @@ -148,10 +151,8 @@ def main(): (product, branch, db_type) = db_pattern.findall(db)[0] release_branch = "{}-{}".format(product, branch) - if release_branch in databases: + if release_branch in release_mapping: databases[release_branch][db_type] = db - else: - databases[release_branch] = {db_type: db} # Build internal package metadata structure / cache. # { "src_pkg": { "subpackage": pkg, ... } } diff --git a/bin/get-product-names.py b/bin/get-product-names.py index 7f0d388..2db4207 100755 --- a/bin/get-product-names.py +++ b/bin/get-product-names.py @@ -36,7 +36,7 @@ def get_data(URI, previous_data=None): def main(): final_data = get_data(PDC_URI) with open(PRODUCT_VERSION_MAPPING, "w") as outfile: - json.dump(final_data, outfile) + json.dump(final_data, outfile, indent=2) if __name__ == "__main__":