From d76ae4459104eab3337ee8af846bef5b50e4c42d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Feb 13 2020 05:47:29 +0000 Subject: Add an option for whether to publish changes. Running locally, there's no need to publish changes, since you don't have access to Fedora Messaging. This breaks the script halfway through since this happens before installing the database. --- diff --git a/mdapi-get_repo_md b/mdapi-get_repo_md index 51365d7..34c20ea 100755 --- a/mdapi-get_repo_md +++ b/mdapi-get_repo_md @@ -60,6 +60,8 @@ DL_SERVER = 'http://dl.fedoraproject.org' PKGDB2_VERIFY = True # Valid for both koji and the download server DL_VERIFY = True +# Whether to publish to Fedora Messaging. +PUBLISH_CHANGES = True repomd_xml_namespace = { @@ -289,7 +291,10 @@ def compare_dbs(name, db1, db2, cache1, cache2): def publish_changes(name, packages, repomd_url): - print(f'{name.ljust(padding)} Publishing differences to fedora messaging:') + print(f'{name.ljust(padding)} Publishing differences to fedora messaging: ' + f'{PUBLISH_CHANGES}') + if not PUBLISH_CHANGES: + return change = bool(packages) if not change: @@ -440,11 +445,13 @@ def main(): return 1 global PKGDB2_URL, KOJI_REPO, DL_SERVER, PKGDB2_VERIFY, DL_VERIFY + global PUBLISH_CHANGES PKGDB2_URL = CONFIG.get('PKGDB2_URL', PKGDB2_URL) KOJI_REPO = CONFIG.get('KOJI_REPO', KOJI_REPO) DL_SERVER = CONFIG.get('DL_SERVER', DL_SERVER) PKGDB2_VERIFY = CONFIG.get('PKGDB2_VERIFY', PKGDB2_VERIFY) DL_VERIFY = CONFIG.get('DL_VERIFY', DL_VERIFY) + PUBLISH_CHANGES = CONFIG.get('PUBLISH_CHANGES', PUBLISH_CHANGES) if not DL_VERIFY or not PKGDB2_VERIFY: # Suppress urllib3's warning about insecure requests diff --git a/mdapi/default_config.py b/mdapi/default_config.py index 2757562..1a44e7e 100644 --- a/mdapi/default_config.py +++ b/mdapi/default_config.py @@ -56,3 +56,6 @@ LOGGING = { } } } + +# Don't publish to Fedora Messaging. +PUBLISH_CHANGES = False