diff --git a/backportpackage b/backportpackage index 4fa0236..320486b 100755 --- a/backportpackage +++ b/backportpackage @@ -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) diff --git a/debian/changelog b/debian/changelog index 43a0aca..29ff7f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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: