Make CURRENT DSD Blacklisting overrideable

This commit is contained in:
Stefano Rivera 2011-09-05 15:40:24 +02:00
parent cfa2134468
commit 328e7bb241
2 changed files with 41 additions and 27 deletions

1
debian/changelog vendored
View File

@ -17,6 +17,7 @@ ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
[ Stefano Rivera ] [ Stefano Rivera ]
* syncpackage: Show changes to be synced when performing native syncs. * syncpackage: Show changes to be synced when performing native syncs.
* syncpackage: Check the sync blacklist.
* syncpackage: Support --bug (extra bugs to be closed by the sync) with * syncpackage: Support --bug (extra bugs to be closed by the sync) with
native syncs. (Bugs are closed one individually, via the API, post-sync) native syncs. (Bugs are closed one individually, via the API, post-sync)
* dgetlp, submittodebian, 404main: Use unicode strings for literal strings * dgetlp, submittodebian, 404main: Use unicode strings for literal strings

View File

@ -404,22 +404,25 @@ def copy(src_pkg, release, bugs, simulate=False, force=False):
def is_blacklisted(query): def is_blacklisted(query):
""""Determine if package "query" is in the sync blacklist """"Determine if package "query" is in the sync blacklist
Returns True or a string of all relevant comments if blacklisted, Returns tuple of (blacklisted, comments)
False if not blacklisted is one of False, 'CURRENT', 'ALWAYS'
""" """
# LP: # LP:
# TODO: Refactor when LP: #833080 is fixed # TODO: Refactor when LP: #833080 is fixed
series = Launchpad.distributions['ubuntu'].current_series series = Launchpad.distributions['ubuntu'].current_series
diffs = (list(series.getDifferencesTo(source_package_name_filter=query, lp_comments = series.getDifferenceComments(source_package_name=query)
status='Blacklisted current version')) blacklisted = False
+ list(series.getDifferencesTo(source_package_name_filter=query, comments = u'; '.join(c.body_text for c in lp_comments)
status='Blacklisted always')))
diffs = series.getDifferencesTo(source_package_name_filter=query,
status='Blacklisted current version')
if len(diffs) > 0: if len(diffs) > 0:
comments = series.getDifferenceComments(source_package_name=query) blacklisted = 'CURRENT'
comment = '; '.join(c.body_text for c in comments)
if comment: diffs = series.getDifferencesTo(source_package_name_filter=query,
return comment status='Blacklisted always')
return True if len(diffs) > 0:
blacklisted = 'ALWAYS'
# Old blacklist: # Old blacklist:
url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt' url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt'
@ -434,13 +437,13 @@ def is_blacklisted(query):
if source and query == source: if source and query == source:
if comment: if comment:
applicable_comments.append(comment) applicable_comments.append(comment)
if applicable_comments: comments = u'; '.join(applicable_comments)
return u'; '.join(applicable_comments) blacklisted = 'ALWAYS'
else: break
return True
elif comment: elif comment:
applicable_comments.append(comment) applicable_comments.append(comment)
return False
return (blacklisted, comments)
def close_bugs(bugs, package, version, changes): def close_bugs(bugs, package, version, changes):
"""Close the correct task on all bugs, with changes""" """Close the correct task on all bugs, with changes"""
@ -590,11 +593,21 @@ def main():
options.component, options.release, options.component, options.release,
options.debian_mirror) options.debian_mirror)
blacklisted = is_blacklisted(src_pkg.source) blacklisted, comments = is_blacklisted(src_pkg.source)
if blacklisted: if blacklisted:
Logger.error("Source package is blacklisted") Logger.error("Source package is blacklisted")
if isinstance(blacklisted, basestring): if comments:
Logger.error(u"Reason: %s", blacklisted) Logger.error(u"Blacklist Comments: %s", comments)
if blacklisted == 'CURRENT':
if options.force:
Logger.warn(u"Forcing override of temporary blacklising.")
else:
Logger.error("The blacklisting only applies to the current "
"versions in Debian and Ubuntu.")
Logger.error("--force is required to override the blacklist.")
sys.exit(1)
else:
Logger.error("If you think this package shouldn't be blacklisted, " Logger.error("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.")