From 08513b1897ab0c9b8374ae8bb898745e9307ac16 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Wed, 26 Oct 2011 21:08:17 +0200 Subject: [PATCH] * 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. --- debian/changelog | 5 +++++ syncpackage | 54 ++++++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7fa641b..c7bcc52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,11 @@ ubuntu-dev-tools (0.134) UNRELEASED; urgency=low * mk-sbuild: Correct typo in variable name. Thanks Laurent Declercq. (Closes: #645917) * 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 ] * syncpackage: Catch user abort. diff --git a/syncpackage b/syncpackage index 1a43d9d..b8c42d6 100755 --- a/syncpackage +++ b/syncpackage @@ -414,7 +414,9 @@ def is_blacklisted(query): series = Launchpad.distributions['ubuntu'].current_series lp_comments = series.getDifferenceComments(source_package_name=query) 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 diff in series.getDifferencesTo(source_package_name_filter=query): @@ -427,21 +429,18 @@ def is_blacklisted(query): # Old blacklist: url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt' with codecs.EncodedFile(urllib.urlopen(url), 'UTF-8') as f: - applicable_comments = [] + applicable_lines = [] for line in f: if not line.strip(): - applicable_comments = [] + applicable_lines = [] continue - m = re.match(r'^\s*([a-z0-9.+-]+)?\s*(?:#\s*(.+)?)?$', line) - source, comment = m.groups() + m = re.match(r'^\s*([a-z0-9.+-]+)?', line) + source = m.group(0) + applicable_lines.append(line) if source and query == source: - if comment: - applicable_comments.append(comment) - comments += applicable_comments + comments += ["From sync-blacklist.txt:"] + applicable_lines blacklisted = 'ALWAYS' break - elif comment: - applicable_comments.append(comment) return (blacklisted, comments) @@ -603,45 +602,42 @@ def main(): options.debian_mirror) blacklisted, comments = is_blacklisted(src_pkg.source) + blacklist_fail = False if blacklisted: - fail = False messages = [] if blacklisted == 'CURRENT': - if options.force: - messages += ["Forcing override of temporary blacklisting."] - else: - fail = True - messages += ["The blacklisting only applies to the current " - "versions in Debian and Ubuntu.", - "--force is required to override the blacklist."] + Logger.debug("Source package %s is temporarily blacklisted " + "(blacklisted_current). Ubuntu ignores these for now. " + "See also LP: #841372", src_pkg.source) else: if options.force and not options.lp: messages += ["Forcing fake-sync, overriding blacklist."] else: - fail = True + blacklist_fail = True messages += ["--force and --no-lp are required to override the " "blacklist, if this package needs a fakesync."] messages += ["If you think this package shouldn't be blacklisted, " "please file a bug explaining your reasoning and " "subscribe ~ubuntu-archive."] - if fail: + if blacklist_fail: 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) - - if comments: - Logger.normal("Blacklist Comments:") - for comment in comments: - for line in textwrap.wrap(comment): - Logger.normal(u" " + line) if messages: for message in messages: for line in textwrap.wrap(message): 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: copy(src_pkg, options.release, options.bugs, options.simulate,