backportpackage: If no dest release is specified, default to the current release

This commit is contained in:
Evan Broder 2010-12-15 20:50:30 -08:00
parent 533b2bf7bd
commit 82373b169d
2 changed files with 11 additions and 7 deletions

View File

@ -25,6 +25,7 @@ import urllib
from debian.deb822 import Dsc
import launchpadlib.launchpad
import lsb_release
from ubuntutools.builder import getBuilder
from ubuntutools.logger import Logger
@ -46,7 +47,7 @@ def parse(args):
dest='dest_releases',
default=[],
action='append',
help='Backport to DEST release (required)',
help='Backport to DEST release (default: current release)',
metavar='DEST')
p.add_option('-s', '--source',
dest='source_release',
@ -81,8 +82,6 @@ def parse(args):
opts, args = p.parse_args(args)
if len(args) != 1:
p.error('You must specify a source package')
if not opts.dest_releases:
p.error('You must specify at least one destination release')
if not opts.upload and not opts.build:
p.error('Nothing to do')
@ -232,6 +231,13 @@ def main(args):
lp = launchpadlib.launchpad.Launchpad.login_anonymously(script_name,
opts.launchpad)
if not opts.dest_releases:
try:
distinfo = lsb_release.get_distro_information()
opts.dest_releases = [distinfo['CODENAME']]
except:
error('No destination release specified and unable to guess yours')
workdir = tempfile.mkdtemp(prefix='backportpackage-')
try:
dscfile = fetch_package(lp,

View File

@ -4,8 +4,6 @@ backportpackage \- helper to test package backports
.SH SYNOPSIS
.TP
.B backportpackage \fR[\fIadditional options\fR]
\-\-destination <\fIdest release\fR>
.br
\-\-upload <\fIupload target\fR>
.br
<\fIsource package\fR>
@ -15,8 +13,8 @@ backportpackage \- helper to test package backports
.TP
.B \-d \fIDEST\fR, \-\-destination=\fIDEST\fR
\fBRequired\fR. Backport the package to the specified Ubuntu
release. This option may be specified multiple times, but must be
specified at least once.
release. If this option is unspecified, then \fBbackportpackage\fR
defaults to the release on which it is currently running.
.TP
.B \-s \fISOURCE\fR, \-\-source=\fISOURCE\fR
Backport the package from the specified Ubuntu release. If neither