mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-25 01:41:08 +00:00
requestbackport: Adapt to new backports policy (LP: #1959115)
As documented on <https://wiki.ubuntu.com/UbuntuBackports> Template update done by Unit 193. Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
parent
844d6d942c
commit
0f3d2fed2a
@ -40,7 +40,7 @@ class DestinationException(Exception):
|
|||||||
def determine_destinations(source, destination):
|
def determine_destinations(source, destination):
|
||||||
ubuntu_info = UbuntuDistroInfo()
|
ubuntu_info = UbuntuDistroInfo()
|
||||||
if destination is None:
|
if destination is None:
|
||||||
destination = ubuntu_info.stable()
|
destination = ubuntu_info.lts()
|
||||||
|
|
||||||
if source not in ubuntu_info.all:
|
if source not in ubuntu_info.all:
|
||||||
raise DestinationException("Source release %s does not exist" % source)
|
raise DestinationException("Source release %s does not exist" % source)
|
||||||
@ -86,22 +86,13 @@ def disclaimer():
|
|||||||
confirmation_prompt()
|
confirmation_prompt()
|
||||||
|
|
||||||
|
|
||||||
def check_existing(package, destinations):
|
def check_existing(package):
|
||||||
"""Search for possible existing bug reports"""
|
"""Search for possible existing bug reports"""
|
||||||
# The LP bug search is indexed, not substring:
|
distro = Distribution('ubuntu')
|
||||||
query = re.findall(r'[a-z]+', package)
|
srcpkg = distro.getSourcePackage(name=package.getPackageName())
|
||||||
bugs = []
|
|
||||||
for release in destinations:
|
bugs = srcpkg.searchTasks(omit_duplicates=True,
|
||||||
project_name = '{}-backports'.format(release)
|
search_text="[BPO]",
|
||||||
try:
|
|
||||||
project = Launchpad.projects[project_name]
|
|
||||||
except KeyError:
|
|
||||||
Logger.error("The backports tracking project '%s' doesn't seem to "
|
|
||||||
"exist. Please check the situation with the "
|
|
||||||
"backports team.", project_name)
|
|
||||||
sys.exit(1)
|
|
||||||
bugs += project.searchTasks(omit_duplicates=True,
|
|
||||||
search_text=query,
|
|
||||||
status=["Incomplete", "New", "Confirmed",
|
status=["Incomplete", "New", "Confirmed",
|
||||||
"Triaged", "In Progress",
|
"Triaged", "In Progress",
|
||||||
"Fix Committed"])
|
"Fix Committed"])
|
||||||
@ -111,7 +102,7 @@ def check_existing(package, destinations):
|
|||||||
Logger.info("There are existing bug reports that look similar to your "
|
Logger.info("There are existing bug reports that look similar to your "
|
||||||
"request. Please check before continuing:")
|
"request. Please check before continuing:")
|
||||||
|
|
||||||
for bug in sorted(set(bug_task.bug for bug_task in bugs)):
|
for bug in sorted([bug_task.bug for bug_task in bugs], key=lambda bug: bug.id):
|
||||||
Logger.info(" * LP: #%-7i: %s %s", bug.id, bug.title, bug.web_link)
|
Logger.info(" * LP: #%-7i: %s %s", bug.id, bug.title, bug.web_link)
|
||||||
|
|
||||||
confirmation_prompt()
|
confirmation_prompt()
|
||||||
@ -178,21 +169,17 @@ def locate_package(package, distribution):
|
|||||||
package_spph = archive.getSourcePackage(package, distribution)
|
package_spph = archive.getSourcePackage(package, distribution)
|
||||||
return package_spph
|
return package_spph
|
||||||
except PackageNotFoundException as e:
|
except PackageNotFoundException as e:
|
||||||
if pass_ == 'binary':
|
|
||||||
Logger.error(str(e))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
apt_pkg = apt.Cache()[package]
|
apt_pkg = apt.Cache()[package]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
Logger.error(str(e))
|
||||||
|
sys.exit(1)
|
||||||
package = apt_pkg.candidate.source_name
|
package = apt_pkg.candidate.source_name
|
||||||
Logger.info("Binary package specified, considering its source "
|
Logger.info("Binary package specified, considering its source "
|
||||||
"package instead: %s", package)
|
"package instead: %s", package)
|
||||||
|
|
||||||
|
|
||||||
def request_backport(package_spph, source, destinations):
|
def request_backport(package_spph, source, destinations):
|
||||||
|
|
||||||
published_binaries = set()
|
published_binaries = set()
|
||||||
for bpph in package_spph.getBinaries():
|
for bpph in package_spph.getBinaries():
|
||||||
published_binaries.add(bpph.getPackageName())
|
published_binaries.add(bpph.getPackageName())
|
||||||
@ -205,18 +192,11 @@ def request_backport(package_spph, source, destinations):
|
|||||||
"the binaries have been accepted.")
|
"the binaries have been accepted.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
testing = []
|
testing = ["[Testing]", ""]
|
||||||
testing += ["You can test-build the backport in your PPA with "
|
|
||||||
"backportpackage:"]
|
|
||||||
testing += ["$ backportpackage -u ppa:<lp username>/<ppa name> "
|
|
||||||
"-s %s -d %s %s"
|
|
||||||
% (source, dest, package_spph.getPackageName())
|
|
||||||
for dest in destinations]
|
|
||||||
testing += [""]
|
|
||||||
for dest in destinations:
|
for dest in destinations:
|
||||||
testing += ['* %s:' % dest]
|
testing += [" * %s:" % dest.capitalize()]
|
||||||
testing += ["[ ] Package builds without modification"]
|
testing += [" [ ] Package builds without modification"]
|
||||||
testing += ["[ ] %s installs cleanly and runs" % binary
|
testing += [" [ ] %s installs cleanly and runs" % binary
|
||||||
for binary in published_binaries]
|
for binary in published_binaries]
|
||||||
|
|
||||||
subst = {
|
subst = {
|
||||||
@ -226,22 +206,22 @@ def request_backport(package_spph, source, destinations):
|
|||||||
'source': package_spph.getSeriesAndPocket(),
|
'source': package_spph.getSeriesAndPocket(),
|
||||||
'destinations': ', '.join(destinations),
|
'destinations': ', '.join(destinations),
|
||||||
}
|
}
|
||||||
subject = ("Please backport %(package)s %(version)s (%(component)s) "
|
subject = "[BPO] %(package)s %(version)s to %(destinations)s" % subst
|
||||||
"from %(source)s" % subst)
|
|
||||||
body = ('\n'.join(
|
body = ('\n'.join(
|
||||||
[
|
[
|
||||||
"Please backport %(package)s %(version)s (%(component)s) "
|
"[Impact]",
|
||||||
"from %(source)s to %(destinations)s.",
|
|
||||||
"",
|
"",
|
||||||
"Reason for the backport:",
|
" * Justification for backporting the new version to the stable release.",
|
||||||
"========================",
|
|
||||||
">>> Enter your reasoning here <<<",
|
|
||||||
"",
|
"",
|
||||||
"Testing:",
|
"[Scope]",
|
||||||
"========",
|
"",
|
||||||
"Mark off items in the checklist [X] as you test them, "
|
" * List the Ubuntu release you will backport from, and the specific package version.",
|
||||||
"but please leave the checklist so that backporters can quickly "
|
"",
|
||||||
"evaluate the state of testing.",
|
" * List the Ubuntu release(s) you will backport to.",
|
||||||
|
"",
|
||||||
|
"[Other Info]",
|
||||||
|
"",
|
||||||
|
" * Anything else you think is useful to include",
|
||||||
""
|
""
|
||||||
]
|
]
|
||||||
+ testing
|
+ testing
|
||||||
@ -258,12 +238,20 @@ def request_backport(package_spph, source, destinations):
|
|||||||
if YesNoQuestion().ask("Request this backport", "yes") == "no":
|
if YesNoQuestion().ask("Request this backport", "yes") == "no":
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
targets = [Launchpad.projects['%s-backports' % destination]
|
distro = Distribution('ubuntu')
|
||||||
for destination in destinations]
|
pkgname = package_spph.getPackageName()
|
||||||
|
|
||||||
bug = Launchpad.bugs.createBug(title=subject, description=body,
|
bug = Launchpad.bugs.createBug(title=subject, description=body,
|
||||||
target=targets[0])
|
target=distro.getSourcePackage(name=pkgname))
|
||||||
for target in targets[1:]:
|
|
||||||
bug.addTask(target=target)
|
bug.subscribe(person=Launchpad.people['ubuntu-backporters'])
|
||||||
|
|
||||||
|
for dest in destinations:
|
||||||
|
series = distro.getSeries(dest)
|
||||||
|
try:
|
||||||
|
bug.addTask(target=series.getSourcePackage(name=pkgname))
|
||||||
|
except:
|
||||||
|
break
|
||||||
|
|
||||||
Logger.info("Backport request filed as %s", bug.web_link)
|
Logger.info("Backport request filed as %s", bug.web_link)
|
||||||
|
|
||||||
@ -273,7 +261,7 @@ def main():
|
|||||||
parser.add_option('-d', '--destination', metavar='DEST',
|
parser.add_option('-d', '--destination', metavar='DEST',
|
||||||
help='Backport to DEST release and necessary '
|
help='Backport to DEST release and necessary '
|
||||||
'intermediate releases '
|
'intermediate releases '
|
||||||
'(default: current stable release)')
|
'(default: current LTS release)')
|
||||||
parser.add_option('-s', '--source', metavar='SOURCE',
|
parser.add_option('-s', '--source', metavar='SOURCE',
|
||||||
help='Backport from SOURCE release '
|
help='Backport from SOURCE release '
|
||||||
'(default: current devel release)')
|
'(default: current devel release)')
|
||||||
@ -307,9 +295,9 @@ def main():
|
|||||||
|
|
||||||
disclaimer()
|
disclaimer()
|
||||||
|
|
||||||
check_existing(package, destinations)
|
|
||||||
|
|
||||||
package_spph = locate_package(package, options.source)
|
package_spph = locate_package(package, options.source)
|
||||||
|
|
||||||
|
check_existing(package_spph)
|
||||||
request_backport(package_spph, options.source, destinations)
|
request_backport(package_spph, options.source, destinations)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user