3
0
mirror of https://git.launchpad.net/ubuntu-dev-tools synced 2025-04-22 07:41:08 +00:00

backportpackage: fix automatic selection of the target release.

Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
Mattia Rizzolo 2021-12-05 15:49:31 +01:00
parent 3ef7c4a569
commit 7fc6788b35
No known key found for this signature in database
GPG Key ID: 0816B9E18C762BAD
2 changed files with 11 additions and 2 deletions

@ -29,7 +29,7 @@ from urllib.parse import quote
import lsb_release
from httplib2 import Http, HttpLib2Error
from distro_info import DebianDistroInfo
from distro_info import DebianDistroInfo, UbuntuDistroInfo
from ubuntutools.archive import (DebianSourcePackage,
UbuntuSourcePackage, DownloadError)
@ -398,9 +398,15 @@ def main(args):
if not opts.dest_releases:
distinfo = lsb_release.get_distro_information()
try:
opts.dest_releases = [distinfo['CODENAME']]
current_distro = distinfo['ID']
except KeyError:
error('No destination release specified and unable to guess yours.')
if current_distro == "Ubuntu":
opts.dest_releases = [UbuntuDistroInfo().lts()]
if current_distro == "Debian":
opts.dest_releases = [DebianDistroInfo().stable()]
else:
error(f"Unknown distribution {current_distro}, can't guess target release")
if opts.workdir:
workdir = os.path.expanduser(opts.workdir)

3
debian/changelog vendored

@ -10,6 +10,9 @@ ubuntu-dev-tools (0.187) UNRELEASED; urgency=medium
Closes: #968316
* backportpackage:
+ Support backporting to Debian releases. LP: #974132
+ Fix the guessing algorithm for the target release:
- for Debian: pick the current stable release.
- for Ubuntu: pick the current LTS release.
[ Unit 193 ]
* backportpackage: