* syncpackage:

- Ignore CURRENT blacklisting: it's buggy, and we don't have a good use
    for it.
  - Always display blacklist comments, if they exist.
  - Display timestamps for DSD blacklist comments.
This commit is contained in:
Stefano Rivera 2011-10-26 21:08:17 +02:00
parent 2ad6ec42dd
commit 08513b1897
2 changed files with 30 additions and 29 deletions

5
debian/changelog vendored
View File

@ -4,6 +4,11 @@ ubuntu-dev-tools (0.134) UNRELEASED; urgency=low
* mk-sbuild: Correct typo in variable name. Thanks Laurent Declercq. * mk-sbuild: Correct typo in variable name. Thanks Laurent Declercq.
(Closes: #645917) (Closes: #645917)
* Remove massfile. Neglected and unused (LP: #145598) * Remove massfile. Neglected and unused (LP: #145598)
* syncpackage:
- Ignore CURRENT blacklisting: it's buggy, and we don't have a good use
for it.
- Always display blacklist comments, if they exist.
- Display timestamps for DSD blacklist comments.
[ Benjamin Drung ] [ Benjamin Drung ]
* syncpackage: Catch user abort. * syncpackage: Catch user abort.

View File

@ -414,7 +414,9 @@ def is_blacklisted(query):
series = Launchpad.distributions['ubuntu'].current_series series = Launchpad.distributions['ubuntu'].current_series
lp_comments = series.getDifferenceComments(source_package_name=query) lp_comments = series.getDifferenceComments(source_package_name=query)
blacklisted = False blacklisted = False
comments = [c.body_text + u' -- ' + c.comment_author.name comments = [u'%s\n -- %s %s'
%(c.body_text, c.comment_author.name,
c.comment_date.strftime('%a, %d %b %Y %H:%M:%S +0000'))
for c in lp_comments] for c in lp_comments]
for diff in series.getDifferencesTo(source_package_name_filter=query): for diff in series.getDifferencesTo(source_package_name_filter=query):
@ -427,21 +429,18 @@ def is_blacklisted(query):
# Old blacklist: # Old blacklist:
url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt' url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt'
with codecs.EncodedFile(urllib.urlopen(url), 'UTF-8') as f: with codecs.EncodedFile(urllib.urlopen(url), 'UTF-8') as f:
applicable_comments = [] applicable_lines = []
for line in f: for line in f:
if not line.strip(): if not line.strip():
applicable_comments = [] applicable_lines = []
continue continue
m = re.match(r'^\s*([a-z0-9.+-]+)?\s*(?:#\s*(.+)?)?$', line) m = re.match(r'^\s*([a-z0-9.+-]+)?', line)
source, comment = m.groups() source = m.group(0)
applicable_lines.append(line)
if source and query == source: if source and query == source:
if comment: comments += ["From sync-blacklist.txt:"] + applicable_lines
applicable_comments.append(comment)
comments += applicable_comments
blacklisted = 'ALWAYS' blacklisted = 'ALWAYS'
break break
elif comment:
applicable_comments.append(comment)
return (blacklisted, comments) return (blacklisted, comments)
@ -603,45 +602,42 @@ def main():
options.debian_mirror) options.debian_mirror)
blacklisted, comments = is_blacklisted(src_pkg.source) blacklisted, comments = is_blacklisted(src_pkg.source)
blacklist_fail = False
if blacklisted: if blacklisted:
fail = False
messages = [] messages = []
if blacklisted == 'CURRENT': if blacklisted == 'CURRENT':
if options.force: Logger.debug("Source package %s is temporarily blacklisted "
messages += ["Forcing override of temporary blacklisting."] "(blacklisted_current). Ubuntu ignores these for now. "
else: "See also LP: #841372", src_pkg.source)
fail = True
messages += ["The blacklisting only applies to the current "
"versions in Debian and Ubuntu.",
"--force is required to override the blacklist."]
else: else:
if options.force and not options.lp: if options.force and not options.lp:
messages += ["Forcing fake-sync, overriding blacklist."] messages += ["Forcing fake-sync, overriding blacklist."]
else: else:
fail = True blacklist_fail = True
messages += ["--force and --no-lp are required to override the " messages += ["--force and --no-lp are required to override the "
"blacklist, if this package needs a fakesync."] "blacklist, if this package needs a fakesync."]
messages += ["If you think this package shouldn't be blacklisted, " messages += ["If you think this package shouldn't be blacklisted, "
"please file a bug explaining your reasoning and " "please file a bug explaining your reasoning and "
"subscribe ~ubuntu-archive."] "subscribe ~ubuntu-archive."]
if fail: if blacklist_fail:
Logger.error(u"Source package %s is blacklisted.", src_pkg.source) Logger.error(u"Source package %s is blacklisted.", src_pkg.source)
else: elif blacklisted == 'ALWAYS':
Logger.normal(u"Source package %s is blacklisted.", src_pkg.source) Logger.normal(u"Source package %s is blacklisted.", src_pkg.source)
if comments:
Logger.normal("Blacklist Comments:")
for comment in comments:
for line in textwrap.wrap(comment):
Logger.normal(u" " + line)
if messages: if messages:
for message in messages: for message in messages:
for line in textwrap.wrap(message): for line in textwrap.wrap(message):
Logger.normal(line) Logger.normal(line)
if fail:
sys.exit(1) if comments:
Logger.normal("Blacklist Comments:")
for comment in comments:
for line in textwrap.wrap(comment):
Logger.normal(u" " + line)
if blacklist_fail:
sys.exit(1)
if options.lp: if options.lp:
copy(src_pkg, options.release, options.bugs, options.simulate, copy(src_pkg, options.release, options.bugs, options.simulate,