mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
sponsor-patch: Check if the version of a sync request is mentioned in the bug title.
This commit is contained in:
parent
5942694e6f
commit
663cb5214f
@ -68,6 +68,10 @@ class BugTask(object):
|
||||
return "lp:" + self.project + "/" + self.get_series() + "/" + \
|
||||
self.package
|
||||
|
||||
def get_bug_title(self):
|
||||
"""Returns the title of the related bug."""
|
||||
return self.bug_task.bug.title
|
||||
|
||||
def get_long_info(self):
|
||||
return "Bug task: " + str(self.bug_task) + "\n" + \
|
||||
"Package: " + str(self.package) + "\n" + \
|
||||
@ -156,3 +160,7 @@ class BugTask(object):
|
||||
|
||||
def is_ubuntu_task(self):
|
||||
return self.project == "ubuntu"
|
||||
|
||||
def title_contains(self, word):
|
||||
"""Checks if the bug title contains the given word."""
|
||||
return word in self.bug_task.bug.title.split(" ")
|
||||
|
@ -26,7 +26,7 @@ from devscripts.logger import Logger
|
||||
|
||||
from ubuntutools import subprocess
|
||||
from ubuntutools.harvest import Harvest
|
||||
from ubuntutools.question import Question
|
||||
from ubuntutools.question import Question, YesNoQuestion
|
||||
|
||||
from ubuntutools.sponsor_patch.question import ask_for_manual_fixing, user_abort
|
||||
|
||||
@ -289,6 +289,18 @@ class SourcePackage(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_sync_request_version(self, bug_number, task):
|
||||
"""Check if the downloaded version of the package is mentioned in the
|
||||
bug title."""
|
||||
|
||||
if not task.title_contains(self._version):
|
||||
print "Bug #%i title: %s" % (bug_number, task.get_bug_title())
|
||||
msg = "Is %s %s the version that should be synced" % (self._package,
|
||||
self._version)
|
||||
answer = YesNoQuestion().ask(msg, "no")
|
||||
if answer == "no":
|
||||
user_abort()
|
||||
|
||||
@property
|
||||
def _debdiff_filename(self):
|
||||
"""Returns the file name of the .debdiff file."""
|
||||
|
@ -261,6 +261,7 @@ def sponsor_patch(bug_number, build, builder, edit, keyid, lpinstance, update,
|
||||
if is_sync(bug) and not edit:
|
||||
successful = True
|
||||
source_package.reload_changelog()
|
||||
source_package.check_sync_request_version(bug_number, task)
|
||||
if build:
|
||||
dist = UbuntuDistroInfo().devel()
|
||||
successful = source_package.build(update, dist)
|
||||
|
Loading…
x
Reference in New Issue
Block a user