mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
sponsor-patch: Use old Archive Admin way for sync requests until bug #827555 is fixed.
This commit is contained in:
parent
268fea2a1c
commit
5942694e6f
@ -74,6 +74,10 @@ class BugTask(object):
|
||||
"Project: " + str(self.project) + "\n" + \
|
||||
"Series: " + str(self.series)
|
||||
|
||||
def get_lp_task(self):
|
||||
"""Returns the Launchpad bug task object."""
|
||||
return self.bug_task
|
||||
|
||||
def get_package_and_series(self):
|
||||
result = self.package
|
||||
if self.series:
|
||||
|
@ -65,6 +65,51 @@ class SourcePackage(object):
|
||||
self._version = None
|
||||
self._build_log = None
|
||||
|
||||
def ack_sync(self, upload, task, launchpad):
|
||||
"""Acknowledge a sync request and subscribe ubuntu-archive."""
|
||||
|
||||
if upload == "ubuntu":
|
||||
self._print_logs()
|
||||
question = Question(["yes", "edit", "no"])
|
||||
answer = question.ask("Do you want to acknowledge the sync request",
|
||||
"no")
|
||||
if answer == "edit":
|
||||
return False
|
||||
elif answer == "no":
|
||||
user_abort()
|
||||
|
||||
bug = task.bug
|
||||
task.status = "Confirmed"
|
||||
if task.importance == "Undecided":
|
||||
task.importance = "Wishlist"
|
||||
task.lp_save()
|
||||
Logger.info("Set bug #%i status to Confirmed.", bug.id)
|
||||
|
||||
msg = "Sync request ACK'd."
|
||||
if self._build_log:
|
||||
msg = ("%s %s builds on %s. " + msg) % \
|
||||
(self._package, self._version,
|
||||
self._builder.get_architecture())
|
||||
bug.newMessage(content=msg, subject="sponsor-patch")
|
||||
Logger.info("Acknowledged sync request bug #%i.", bug.id)
|
||||
|
||||
bug.subscribe(person=launchpad.people['ubuntu-archive'])
|
||||
Logger.info("Subscribed ubuntu-archive to bug #%i.", bug.id)
|
||||
|
||||
bug.subscribe(person=launchpad.me)
|
||||
Logger.info("Subscribed me to bug #%i.", bug.id)
|
||||
|
||||
bug.unsubscribe(person=launchpad.people['ubuntu-sponsors'])
|
||||
Logger.info("Unsubscribed ubuntu-sponsors from bug #%i.", bug.id)
|
||||
|
||||
Logger.normal("Successfully acknowledged sync request bug #%i.",
|
||||
bug.id)
|
||||
else:
|
||||
Logger.error("Acknowledging a sync request other than to the "
|
||||
"official Ubuntu archive is not supported!")
|
||||
sys.exit(1)
|
||||
return True
|
||||
|
||||
def ask_and_upload(self, upload):
|
||||
"""Ask the user before uploading the source package.
|
||||
|
||||
@ -74,17 +119,7 @@ class SourcePackage(object):
|
||||
|
||||
# Upload package
|
||||
if upload:
|
||||
lintian_filename = self._run_lintian()
|
||||
print "\nPlease check %s %s carefully:\nfile://%s\nfile://%s" % \
|
||||
(self._package, self._version, self._debdiff_filename,
|
||||
lintian_filename)
|
||||
if self._build_log:
|
||||
print "file://%s" % self._build_log
|
||||
|
||||
harvest = Harvest(self._package)
|
||||
if harvest.data:
|
||||
print harvest.report()
|
||||
|
||||
self._print_logs()
|
||||
if upload == "ubuntu":
|
||||
target = "the official Ubuntu archive"
|
||||
else:
|
||||
@ -308,6 +343,21 @@ class SourcePackage(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _print_logs(self):
|
||||
"""Print things that should be checked before uploading a package."""
|
||||
|
||||
lintian_filename = self._run_lintian()
|
||||
print "\nPlease check %s %s carefully:" % (self._package, self._version)
|
||||
if os.path.isfile(self._debdiff_filename):
|
||||
print "file://" + self._debdiff_filename
|
||||
print "file://" + lintian_filename
|
||||
if self._build_log:
|
||||
print "file://" + self._build_log
|
||||
|
||||
harvest = Harvest(self._package)
|
||||
if harvest.data:
|
||||
print harvest.report()
|
||||
|
||||
def reload_changelog(self):
|
||||
"""Reloads debian/changelog and update version."""
|
||||
|
||||
@ -382,3 +432,4 @@ class SourcePackage(object):
|
||||
Logger.error("Uploading a synced package other than to ubuntu "
|
||||
"is not supported yet!")
|
||||
sys.exit(1)
|
||||
return True
|
||||
|
@ -20,12 +20,12 @@ import pwd
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import launchpadlib.launchpad
|
||||
|
||||
from devscripts.logger import Logger
|
||||
|
||||
from distro_info import UbuntuDistroInfo
|
||||
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
|
||||
from ubuntutools import subprocess
|
||||
from ubuntutools.update_maintainer import update_maintainer
|
||||
from ubuntutools.question import input_number
|
||||
@ -244,8 +244,7 @@ def sponsor_patch(bug_number, build, builder, edit, keyid, lpinstance, update,
|
||||
workdir = os.path.realpath(os.path.expanduser(workdir))
|
||||
_create_and_change_into(workdir)
|
||||
|
||||
launchpad = launchpadlib.launchpad.Launchpad.login_anonymously(
|
||||
"sponsor-patch", lpinstance)
|
||||
launchpad = Launchpad.login_with("sponsor-patch", lpinstance)
|
||||
#pylint: disable=E1101
|
||||
bug = launchpad.bugs[bug_number]
|
||||
#pylint: enable=E1101
|
||||
@ -268,8 +267,11 @@ def sponsor_patch(bug_number, build, builder, edit, keyid, lpinstance, update,
|
||||
update = False
|
||||
|
||||
if successful:
|
||||
source_package.sync(upload, bug_number, keyid)
|
||||
return
|
||||
#if source_package.sync(upload, bug_number, keyid):
|
||||
if source_package.ack_sync(upload, task.get_lp_task(), launchpad):
|
||||
return
|
||||
else:
|
||||
edit = True
|
||||
else:
|
||||
edit = True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user