From 06446bbd4dde09f4d88cafc359185c20e55153bb Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:16:02 -0800 Subject: [PATCH] backportpackage: Add --suffix option --- backportpackage | 18 +++++++++++++----- doc/backportpackage.1 | 10 ++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/backportpackage b/backportpackage index 4b9046f..a21f871 100755 --- a/backportpackage +++ b/backportpackage @@ -57,6 +57,11 @@ def parse(args): default=None, help='Backport from SOURCE release (default: devel release)', metavar='SOURCE') + p.add_option('-S', '--suffix', + dest='suffix', + default=None, + help='Suffix to append to version number (default: ~ppa1)', + metavar='SUFFIX') p.add_option('-b', '--build', dest='build', default=False, @@ -173,9 +178,11 @@ def fetch_package(lp, workdir, package, version, source_release): cwd=workdir) return os.path.join(workdir, os.path.basename(dsc)) -def get_backport_version(version, upload, release): +def get_backport_version(version, suffix, upload, release): v = version + ('~%s1' % release) - if upload and upload.startswith('ppa:'): + if suffix: + v += suffix + elif upload and upload.startswith('ppa:'): v += '~ppa1' return v @@ -210,12 +217,12 @@ def do_upload(workdir, package, bp_version, upload): check_call(['dput', upload, changes_file], cwd=workdir) -def do_backport(workdir, package, dscfile, version, release, build, builder, - update, upload): +def do_backport(workdir, package, dscfile, version, suffix, release, build, + builder, update, upload): check_call(['dpkg-source', '-x', dscfile, package], cwd=workdir) srcdir = os.path.join(workdir, package) - bp_version = get_backport_version(version, upload, release) + bp_version = get_backport_version(version, suffix, upload, release) bp_dist = get_backport_dist(upload, release) check_call(['dch', @@ -278,6 +285,7 @@ def main(args): package, dscfile, version, + suffix, release, opts.build, opts.builder, diff --git a/doc/backportpackage.1 b/doc/backportpackage.1 index bd08f73..64d8ed6 100644 --- a/doc/backportpackage.1 +++ b/doc/backportpackage.1 @@ -22,6 +22,16 @@ this option nor \fB\-\-version\fR are specified, then \fBbackportpackage\fR defaults to the current Ubuntu development release. .TP +.B \-S \fISUFFIX\fR, \-\-suffix=\fISUFFIX\fR +Add the specified suffix to the version number when +backporting. \fBbackportpackage\fR will always append +~\fIDESTINATION\fR1 to the original version number, and if +\fISUFFIX\fR is specified, it is appended to that, to get version +numbers of the form +\fIORIGINAL_VERSION\fR~\fIDESTINATION\fR1\fISUFFIX\fR. If the +backported package is being uploaded to a PPA, then \fISUFFIX\fR +defaults to \fB~ppa1\fR, otherwise the default is blank. +.TP .B \-b, \-\-build Build the package with the specified builder before uploading. Note for \fBpbuilder\fR(8) users: This assumes the common configuration,