backportpackage: Add --release-pocket option, rather than relying entirely

on heuristics (Closes: #652000)
This commit is contained in:
Stefano Rivera 2011-12-21 22:49:24 +02:00
parent 3f6eb545e2
commit 705335a220
3 changed files with 25 additions and 9 deletions

View File

@ -70,7 +70,7 @@ def parse(args):
parser.add_option('-S', '--suffix',
metavar='SUFFIX',
help='Suffix to append to version number '
'(default: ~ppa1)')
'(default: ~ppa1 when uploading to a PPA)')
parser.add_option('-b', '--build',
default=False,
action='store_true',
@ -99,6 +99,11 @@ def parse(args):
metavar='WORKDIR',
help='Specify a working directory '
'(default: temporary dir)')
parser.add_option('-r', '--release-pocket',
default=False,
action='store_true',
help='Target the release pocket in the .changes file. '
'Necessary (and default) for uploads to PPAs')
parser.add_option('-m', '--mirror',
metavar='INSTANCE',
help='Preferred mirror (default: Launchpad)')
@ -126,6 +131,8 @@ def parse(args):
opts.lpinstance = config.get_value('LPINSTANCE')
if not opts.upload and not opts.workdir:
parser.error('Please specify either a working dir or an upload target!')
if opts.upload and opts.upload.startswith('ppa:'):
opts.release_pocket = True
return opts, args, config
@ -192,11 +199,11 @@ def get_backport_version(version, suffix, upload, release):
backport_version += '~ppa1'
return backport_version
def get_backport_dist(upload, release):
if not upload or upload == 'ubuntu':
return '%s-backports' % release
else:
def get_backport_dist(release, release_pocket):
if release_pocket:
return release
else:
return '%s-backports' % release
def do_build(workdir, dsc, release, builder, update):
builder = get_builder(builder)
@ -224,15 +231,15 @@ def do_upload(workdir, package, bp_version, changes, upload, prompt):
check_call(['dput', upload, changes], cwd=workdir)
def do_backport(workdir, pkg, suffix, release, build, builder, update, upload,
prompt):
def do_backport(workdir, pkg, suffix, release, release_pocket, build, builder,
update, upload, prompt):
dirname = '%s-%s' % (pkg.source, release)
pkg.unpack(dirname)
srcdir = os.path.join(workdir, dirname)
bp_version = get_backport_version(pkg.version.full_version, suffix,
upload, release)
bp_dist = get_backport_dist(upload, release)
bp_dist = get_backport_dist(release, release_pocket)
check_call(['dch',
'--force-bad-version',
@ -291,6 +298,7 @@ def main(args):
pkg,
opts.suffix,
release,
opts.release_pocket,
opts.build,
opts.builder,
opts.update,

4
debian/changelog vendored
View File

@ -9,8 +9,10 @@ ubuntu-dev-tools (0.138) UNRELEASED; urgency=low
[ Stefano Rivera ]
* Correct reference to qemu-user-static in pbuilder-dist.1 (Closes: #651999)
* mk-sbuild: Don't install devscripts by default (LP: #904502)
* backportpackage: Add --release-pocket option, rather than relying entirely
on heuristics (Closes: #652000)
-- Benjamin Drung <bdrung@debian.org> Wed, 21 Dec 2011 21:42:27 +0100
-- Stefano Rivera <stefanor@debian.org> Wed, 21 Dec 2011 22:43:13 +0200
ubuntu-dev-tools (0.137) unstable; urgency=low

View File

@ -85,6 +85,12 @@ unpacked, built into, and otherwise manipulated in
\fIWORKDIR\fR. Otherwise, a temporary directory is created, which is
deleted before \fIbackportpackage\fR exits.
.TP
.B \-r\fR, \fB\-\-release\-pocket
Target the upload at the release pocket, rather than the
\fB\-backports\fR pocket.
This is required for Launchpad PPAs, which are pocket-less (and the
default, when the upload target is a PPA).
.TP
.B \-m \fIMIRROR\fR, \fB\-\-mirror\fR=\fIMIRROR\fR
Use the specified mirror.
Should be in the form \fBhttp://archive.ubuntu.com/ubuntu\fR.