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).
This commit is contained in:
Colin Watson 2018-12-11 16:39:49 +00:00
parent 6b8a75bc99
commit fb22ba116f
2 changed files with 14 additions and 4 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ubuntu-dev-tools (0.167) UNRELEASED; urgency=medium
* syncpackage:
+ Support wildcards in sync-blacklist.
-- Colin Watson <cjwatson@ubuntu.com> Tue, 11 Dec 2018 16:39:00 +0000
ubuntu-dev-tools (0.166) unstable; urgency=medium
* Team upload.

View File

@ -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