From 27e0581045279cc5586dd1c434cb4662b076d44f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Feb 14 2020 09:51:05 +0000 Subject: [PATCH 1/2] 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 4cd9539..2032d15 100755 --- a/mdapi-get_repo_md +++ b/mdapi-get_repo_md @@ -59,6 +59,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 = { @@ -285,7 +287,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: @@ -436,11 +441,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 From afef51ddeeb533a693a7ca6ac009d5fb2cbd8299 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Feb 14 2020 09:51:07 +0000 Subject: [PATCH 2/2] Don't compare DBs if not publishing result. --- diff --git a/mdapi-get_repo_md b/mdapi-get_repo_md index 2032d15..f75a22d 100755 --- a/mdapi-get_repo_md +++ b/mdapi-get_repo_md @@ -287,10 +287,7 @@ 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: ' - f'{PUBLISH_CHANGES}') - if not PUBLISH_CHANGES: - return + print(f'{name.ljust(padding)} Publishing differences to fedora messaging:') change = bool(packages) if not change: @@ -417,8 +414,12 @@ def process_repo(tupl): download_db(name, repomd_url, archive) decompress_db(name, archive, tempdb) - packages = compare_dbs(name, tempdb, destfile, cache1, cache2) - publish_changes(name, packages, repomd_url) + if PUBLISH_CHANGES: + packages = compare_dbs(name, tempdb, destfile, cache1, cache2) + publish_changes(name, packages, repomd_url) + else: + print(f'{name.ljust(padding)} Not publishing to Fedora ' + f'messaging; not comparing DBs.') install_db(name, tempdb, destfile)