From 8afda6d3f1dcb33bcbc40d308dcfa8cb07e355f7 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:09:44 -0800 Subject: [PATCH 01/10] backportpackage: Add missing copyright statement --- backportpackage | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backportpackage b/backportpackage index b0374a7..4b9046f 100755 --- a/backportpackage +++ b/backportpackage @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- # ################################################################## # +# Copyright (C) 2010, Evan Broder +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2. From 06446bbd4dde09f4d88cafc359185c20e55153bb Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:16:02 -0800 Subject: [PATCH 02/10] 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, From 4479344db06ef064ab7fdbeff930f684d91f0682 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:16:24 -0800 Subject: [PATCH 03/10] doc/backportpackage.1: --destination is no longer required --- doc/backportpackage.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/backportpackage.1 b/doc/backportpackage.1 index 64d8ed6..cdd4ede 100644 --- a/doc/backportpackage.1 +++ b/doc/backportpackage.1 @@ -12,9 +12,9 @@ backportpackage \- helper to test package backports .SH OPTIONS .TP .B \-d \fIDEST\fR, \-\-destination=\fIDEST\fR -\fBRequired\fR. Backport the package to the specified Ubuntu -release. If this option is unspecified, then \fBbackportpackage\fR -defaults to the release on which it is currently running. +Backport the package to the specified Ubuntu 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 From fca3e45826cc5a60e19da55fa80448dcee86661d Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:21:40 -0800 Subject: [PATCH 04/10] backportpackage: Typo fix --- backportpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backportpackage b/backportpackage index a21f871..de6c472 100755 --- a/backportpackage +++ b/backportpackage @@ -285,7 +285,7 @@ def main(args): package, dscfile, version, - suffix, + opts.suffix, release, opts.build, opts.builder, From 735ac962c3b353793c3259b6476de3346c762b8f Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:29:38 -0800 Subject: [PATCH 05/10] Include -y option to skip prompts (LP: #691895) --- backportpackage | 27 ++++++++++++++++++--------- debian/changelog | 1 + doc/backportpackage.1 | 4 ++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/backportpackage b/backportpackage index de6c472..e3cd8b2 100755 --- a/backportpackage +++ b/backportpackage @@ -81,6 +81,11 @@ def parse(args): dest='upload', help='Specify an upload destination', metavar='UPLOAD') + p.add_option('-y', '--yes', + dest='prompt', + default=True, + action='store_false', + help='Do not prompt before uploading to a PPA') p.add_option('-v', '--version', dest='version', default=None, @@ -207,18 +212,21 @@ def do_build(workdir, package, release, bp_version, builder, update): release, os.path.join(workdir, "buildresult")) -def do_upload(workdir, package, bp_version, upload): +def do_upload(workdir, package, bp_version, upload, prompt): print 'Please check %s %s in file://%s carefully!' % \ (package, bp_version, workdir) - question = 'Do you want to upload the package to %s' % upload - answer = YesNoQuestion().ask(question, "yes") - if answer == "yes": - changes_file = '%s_%s_source.changes' % (package, bp_version) - check_call(['dput', upload, changes_file], cwd=workdir) + if prompt or upload == 'ubuntu': + question = 'Do you want to upload the package to %s' % upload + answer = YesNoQuestion().ask(question, "yes") + if answer != "yes": + return + + changes_file = '%s_%s_source.changes' % (package, bp_version) + check_call(['dput', upload, changes_file], cwd=workdir) def do_backport(workdir, package, dscfile, version, suffix, release, build, - builder, update, upload): + builder, update, upload, prompt): check_call(['dpkg-source', '-x', dscfile, package], cwd=workdir) srcdir = os.path.join(workdir, package) @@ -241,7 +249,7 @@ def do_backport(workdir, package, dscfile, version, suffix, release, build, if 0 != do_build(workdir, package, release, bp_version, builder, update): error('Package failed to build; aborting') if upload: - do_upload(workdir, package, bp_version, upload) + do_upload(workdir, package, bp_version, upload, prompt) shutil.rmtree(srcdir) @@ -290,7 +298,8 @@ def main(args): opts.build, opts.builder, opts.update, - opts.upload) + opts.upload, + opts.prompt) finally: if not opts.workdir: shutil.rmtree(workdir) diff --git a/debian/changelog b/debian/changelog index 772920f..5fa76b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low [ Evan Broder ] * backportpackage: new script for testing backport requests in a PPA. + - Include -y option to skip prompts (LP: #691895) * sponsor-patch: Add --update option to make sure build environment is up to date (LP: #689605) diff --git a/doc/backportpackage.1 b/doc/backportpackage.1 index cdd4ede..0f6d065 100644 --- a/doc/backportpackage.1 +++ b/doc/backportpackage.1 @@ -49,6 +49,10 @@ Update the build environment before attempting to build. .B \-u \fIUPLOAD\fR, \-\-upload=\fIUPLOAD\fR Upload to \fIUPLOAD\fR with \fBdput\fR(1) (after confirmation). .TP +.B \-y, \-\-yes +Do not prompt before uploading to a PPA. For everyone's safety, this +option is ignored if \fIUPLOAD\fR is \fBubuntu\fR. +.TP .B \-v \fIVERSION\fR, \-\-version=\fIVERSION\fR If the \fB\-\-source\fR option is specified, then \fBbackportpackage\fR verifies that the current version of \fIsource From cbe6726eb353694fdfbfeda098d0ce58690a30db Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:32:48 -0800 Subject: [PATCH 06/10] Allow for just building the source package without a test build or upload (LP: #691896) --- backportpackage | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backportpackage b/backportpackage index e3cd8b2..5cbdf28 100755 --- a/backportpackage +++ b/backportpackage @@ -105,8 +105,8 @@ def parse(args): opts, args = p.parse_args(args) if len(args) != 1: p.error('You must specify a single source package or a .dsc URL/path') - if not opts.upload and not opts.build: - p.error('Nothing to do') + if not opts.upload and not opts.workdir: + p.error('Please specify either a working dir or an upload target') return opts, args diff --git a/debian/changelog b/debian/changelog index 5fa76b9..0d04b5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low [ Evan Broder ] * backportpackage: new script for testing backport requests in a PPA. - Include -y option to skip prompts (LP: #691895) + - Allow for just building the source package without a test build or + upload (LP: #691896) * sponsor-patch: Add --update option to make sure build environment is up to date (LP: #689605) From 21355cbf52b92aae500cddd9bcbb1dc9d1112785 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:33:10 -0800 Subject: [PATCH 07/10] backportpackage: Allow for -S "" --- backportpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backportpackage b/backportpackage index 5cbdf28..3a4c971 100755 --- a/backportpackage +++ b/backportpackage @@ -185,7 +185,7 @@ def fetch_package(lp, workdir, package, version, source_release): def get_backport_version(version, suffix, upload, release): v = version + ('~%s1' % release) - if suffix: + if suffix is not None: v += suffix elif upload and upload.startswith('ppa:'): v += '~ppa1' From 70a1dbecc717737de1c3a4b8ef5dd8195abea081 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 12:58:11 -0800 Subject: [PATCH 08/10] backportpackage: Whoops, bdrung should get a copyright notice too --- backportpackage | 1 + 1 file changed, 1 insertion(+) diff --git a/backportpackage b/backportpackage index 3a4c971..0f011f8 100755 --- a/backportpackage +++ b/backportpackage @@ -3,6 +3,7 @@ # ################################################################## # # Copyright (C) 2010, Evan Broder +# Copyright (C) 2010, Benjamin Drung # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License From 9f0722dfb37963e92f5250ff9f75f023318f52e1 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 13:11:27 -0800 Subject: [PATCH 09/10] backportpackage: You say goodbye, and I say hello. --- backportpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backportpackage b/backportpackage index 0f011f8..f007b87 100755 --- a/backportpackage +++ b/backportpackage @@ -219,7 +219,7 @@ def do_upload(workdir, package, bp_version, upload, prompt): if prompt or upload == 'ubuntu': question = 'Do you want to upload the package to %s' % upload answer = YesNoQuestion().ask(question, "yes") - if answer != "yes": + if answer == "no": return changes_file = '%s_%s_source.changes' % (package, bp_version) From 2057d62aac58d7c21e41dacbaf83a40ef9f8ae4f Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 18 Dec 2010 13:14:23 -0800 Subject: [PATCH 10/10] Drop changelog entries for backportpackage --- debian/changelog | 3 --- 1 file changed, 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0d04b5e..772920f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,9 +18,6 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low [ Evan Broder ] * backportpackage: new script for testing backport requests in a PPA. - - Include -y option to skip prompts (LP: #691895) - - Allow for just building the source package without a test build or - upload (LP: #691896) * sponsor-patch: Add --update option to make sure build environment is up to date (LP: #689605)