diff --git a/debian/changelog b/debian/changelog index a8bb895..5127878 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,9 @@ ubuntu-dev-tools (0.206) UNRELEASED; urgency=medium * syncpackage: s/syncblacklist/syncblocklist/g * syncpackage: Cache the sync blocklist in-memory, so it's not fetched multiple times when syncing more than one package. + * syncpackage: Catch exceptions cleanly, simply skipping to the next + package (erring on the side of caution) if there is an error doing the + download (LP: #1943286). -- Simon Quigley Tue, 04 Mar 2025 13:04:30 -0600 diff --git a/syncpackage b/syncpackage index f230a0d..ece5e5c 100755 --- a/syncpackage +++ b/syncpackage @@ -459,8 +459,12 @@ def is_blocklisted(query): global cached_sync_blocklist if not cached_sync_blocklist: url = "https://ubuntu-archive-team.ubuntu.com/sync-blocklist.txt" - with urllib.request.urlopen(url) as f: - cached_sync_blocklist = f.read().decode("utf-8") + try: + with urllib.request.urlopen(url) as f: + cached_sync_blocklist = f.read().decode("utf-8") + except: + print("WARNING: unable to download the sync blocklist. Erring on the side of caution.") + return ("ALWAYS", "INTERNAL ERROR: Unable to fetch sync blocklist") applicable_lines = [] for line in cached_sync_blocklist.splitlines():