mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-20 13:21:28 +00:00
Wrap blacklist messages and comments
This commit is contained in:
parent
700d2473a0
commit
5e59f725c0
37
syncpackage
37
syncpackage
@ -26,6 +26,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import textwrap
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import debian.debian_support
|
import debian.debian_support
|
||||||
@ -410,7 +411,8 @@ 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 = u'; '.join(c.body_text for c in lp_comments)
|
comments = [c.body_text + u' -- ' + c.comment_author.name
|
||||||
|
for c in lp_comments]
|
||||||
|
|
||||||
diff = series.getDifferencesTo(source_package_name_filter=query)[0]
|
diff = series.getDifferencesTo(source_package_name_filter=query)[0]
|
||||||
if diff.status == 'Blacklisted current version':
|
if diff.status == 'Blacklisted current version':
|
||||||
@ -431,7 +433,7 @@ 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)
|
||||||
comments = u'; '.join(applicable_comments)
|
comments += applicable_comments
|
||||||
blacklisted = 'ALWAYS'
|
blacklisted = 'ALWAYS'
|
||||||
break
|
break
|
||||||
elif comment:
|
elif comment:
|
||||||
@ -590,26 +592,26 @@ def main():
|
|||||||
blacklisted, comments = is_blacklisted(src_pkg.source)
|
blacklisted, comments = is_blacklisted(src_pkg.source)
|
||||||
if blacklisted:
|
if blacklisted:
|
||||||
fail = False
|
fail = False
|
||||||
message = ""
|
messages = []
|
||||||
|
|
||||||
if blacklisted == 'CURRENT':
|
if blacklisted == 'CURRENT':
|
||||||
if options.force:
|
if options.force:
|
||||||
message = "Forcing override of temporary blacklising."
|
messages += ["Forcing override of temporary blacklising."]
|
||||||
else:
|
else:
|
||||||
fail = True
|
fail = True
|
||||||
message = ("The blacklisting only applies to the current "
|
messages += ["The blacklisting only applies to the current "
|
||||||
"versions in Debian and Ubuntu. --force is "
|
"versions in Debian and Ubuntu.",
|
||||||
"required to override the blacklist.")
|
"--force is required to override the blacklist."]
|
||||||
else:
|
else:
|
||||||
if options.force and not options.lp:
|
if options.force and not options.lp:
|
||||||
message = "Forcing fake-sync, overriding blacklist."
|
messages += ["Forcing fake-sync, overriding blacklist."]
|
||||||
else:
|
else:
|
||||||
fail = True
|
fail = True
|
||||||
message = ("--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."]
|
||||||
message += ("\nIf 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 fail:
|
||||||
Logger.error(u"Source package %s is blacklisted.", src_pkg.source)
|
Logger.error(u"Source package %s is blacklisted.", src_pkg.source)
|
||||||
@ -617,9 +619,14 @@ def main():
|
|||||||
Logger.normal(u"Source package %s is blacklisted.", src_pkg.source)
|
Logger.normal(u"Source package %s is blacklisted.", src_pkg.source)
|
||||||
|
|
||||||
if comments:
|
if comments:
|
||||||
Logger.normal(u"Blacklist Comments: %s", comments)
|
Logger.normal("Blacklist Comments:")
|
||||||
if message:
|
for comment in comments:
|
||||||
Logger.normal(message)
|
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:
|
if fail:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user