Allow user to override sanity checks (LP: #896733).

This commit is contained in:
Benjamin Drung 2011-12-21 22:09:53 +01:00
parent e1e13bbfdc
commit bbfbfd8956
3 changed files with 26 additions and 10 deletions

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ ubuntu-dev-tools (0.138) UNRELEASED; urgency=low
- Use syncpackage instead of subscribing ubuntu-archive for sync requests,
because syncpackage supports sponsorship now.
- Check if the sponsored bug is marked as duplicate (LP: #896733).
- Allow user to override sanity checks (LP: #896733).
[ Stefano Rivera ]
* Correct reference to qemu-user-static in pbuilder-dist.1 (Closes: #651999)

View File

@ -17,14 +17,31 @@
import sys
from ubuntutools.question import YesNoQuestion
from ubuntutools.question import Question, YesNoQuestion
def ask_for_ignoring_or_fixing():
"""Ask the user to resolve an issue manually or ignore it.
Returns false if the user want to fix the issue and returns true if the user
want to ignore the issue.
"""
question = Question(["yes", "ignore", "no"])
answer = question.ask("Do you want to resolve this issue manually", "yes")
if answer == "no":
user_abort()
return answer == "ignore"
def ask_for_manual_fixing():
"""Ask the user to resolve an issue manually."""
answer = YesNoQuestion().ask("Do you want to resolve this issue manually",
"yes")
if answer == "no":
user_abort()
def user_abort():
"""Print abort and quit the program."""
print "User abort."
sys.exit(2)

View File

@ -28,7 +28,9 @@ from ubuntutools import subprocess
from ubuntutools.harvest import Harvest
from ubuntutools.question import Question, YesNoQuestion
from ubuntutools.sponsor_patch.question import ask_for_manual_fixing, user_abort
from ubuntutools.sponsor_patch.question import (ask_for_ignoring_or_fixing,
ask_for_manual_fixing,
user_abort)
def _get_series(launchpad):
"""Returns a tuple with the development and list of supported series."""
@ -270,16 +272,14 @@ class SourcePackage(object):
Logger.error(("%s is not an allowed series. It needs to be one "
"of %s.") % (self._changelog.distributions,
", ".join(allowed)))
ask_for_manual_fixing()
return False
return ask_for_ignoring_or_fixing()
elif upload and upload.startswith("ppa/"):
allowed = supported_series + [devel_series]
if self._changelog.distributions not in allowed:
Logger.error(("%s is not an allowed series. It needs to be one "
"of %s.") % (self._changelog.distributions,
", ".join(allowed)))
ask_for_manual_fixing()
return False
return ask_for_ignoring_or_fixing()
return True
def check_version(self, previous_version):
@ -292,8 +292,7 @@ class SourcePackage(object):
if self._version <= previous_version:
Logger.error("The version %s is not greater than the already "
"available %s.", self._version, previous_version)
ask_for_manual_fixing()
return False
return ask_for_ignoring_or_fixing()
return True
def check_sync_request_version(self, bug_number, task):
@ -363,8 +362,7 @@ class SourcePackage(object):
if lp_bug.id not in fixed_bugs:
Logger.error("Launchpad bug #%i is not closed by new version." % \
(lp_bug.id))
ask_for_manual_fixing()
return False
return ask_for_ignoring_or_fixing()
return True
def _print_logs(self):