From fb22ba116fdf8fc469c9046cef4a908ab9318c1a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 11 Dec 2018 16:39:49 +0000 Subject: [PATCH] syncpackage: Support wildcards in sync-blacklist This brings syncpackage's parsing of sync-blacklist.txt roughly into line with that in auto-sync (from lp:ubuntu-archive-tools). --- debian/changelog | 7 +++++++ syncpackage | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9ed574b..df73ac0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ubuntu-dev-tools (0.167) UNRELEASED; urgency=medium + + * syncpackage: + + Support wildcards in sync-blacklist. + + -- Colin Watson Tue, 11 Dec 2018 16:39:00 +0000 + ubuntu-dev-tools (0.166) unstable; urgency=medium * Team upload. diff --git a/syncpackage b/syncpackage index 6dfe7f0..ee48c64 100755 --- a/syncpackage +++ b/syncpackage @@ -21,9 +21,9 @@ # ################################################################## import codecs +import fnmatch import optparse import os -import re import shutil import sys import textwrap @@ -436,10 +436,13 @@ def is_blacklisted(query): if not line.strip(): applicable_lines = [] continue - m = re.match(r'^\s*([a-z0-9.+-]+)?', line) - source = m.group(0) applicable_lines.append(line) - if source and query == source: + try: + line = line[:line.index('#')] + except ValueError: + pass + source = line.strip() + if source and fnmatch.fnmatch(query, source): comments += ["From sync-blacklist.txt:"] + applicable_lines blacklisted = 'ALWAYS' break