From 4349bcad397c0d9240ea3e3469920f4e7ec753b1 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 2 Jun 2011 18:30:20 -0400 Subject: [PATCH] * doc/lp-project-upload.1, lp-project-upload: - add support for optionally specifying files containing the changelog and release notes for the release - allows scripts to avoid the interactive editors - document these changes in the manpage --- debian/changelog | 7 +++++++ doc/lp-project-upload.1 | 8 ++++++-- lp-project-upload | 29 +++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index b7619f6..03be190 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,13 @@ ubuntu-dev-tools (0.125) UNRELEASED; urgency=low * ubuntutools.archive: Display any errors rmadison emits, rather than guessing at the cause. (LP: #788447) + [ Dustin Kirkland ] + * doc/lp-project-upload.1, lp-project-upload: + - add support for optionally specifying files containing the changelog + and release notes for the release + - allows scripts to avoid the interactive editors + - document these changes in the manpage + -- Benjamin Drung Sat, 28 May 2011 19:43:10 +0200 ubuntu-dev-tools (0.124) unstable; urgency=low diff --git a/doc/lp-project-upload.1 b/doc/lp-project-upload.1 index 16ade9f..cc1cf58 100644 --- a/doc/lp-project-upload.1 +++ b/doc/lp-project-upload.1 @@ -4,7 +4,7 @@ lp\-project\-upload \- Upload a release tarball to a Launchpad project. .SH SYNOPSIS .B lp\-project\-upload -.I project-name version tarball [new milestone] +.I [new milestone] [changelog file] [releasenotes file] .SH DESCRIPTION \fBlp\-project\-upload\fR uploads a tarball release of a project to Launchpad. @@ -13,8 +13,12 @@ It can create milestones and releases on the fly after confirmation. If there is a file \fItarball\fB.asc\fR, it is uploaded as the signature of the tarball. +You can optionally provide the name of the next milestone, which will be created if specified. + +You can optionally provide filename(s) specifying the changelog and release notes entries for this release. Note that these might be /dev/null, if you do not want to provide changelog or release notes information. If these are not specified, an interactive editor will allow you to compose these. + .SH AUTHORS -\fBlp\-project\-upload\fR was written by Martin Pitt . +\fBlp\-project\-upload\fR was written by Martin Pitt and enhanced by Dustin Kirkland . .PP It is released under the terms of the GNU General Public License, version 2 or (at your option) any later version. diff --git a/lp-project-upload b/lp-project-upload index b7ccb86..28395cf 100755 --- a/lp-project-upload +++ b/lp-project-upload @@ -15,6 +15,8 @@ # Authors: # Martin Pitt , based on # http://blog.launchpad.net/api/recipe-for-uploading-files-via-the-api +# Dustin Kirkland +# - support files for changelog and release notes '''Upload a release tarball to a Launchpad project.''' @@ -70,25 +72,33 @@ def edit_file(prefix, description): 'Lines which start with "#" are ignored.\n' % description) os.close(fd) subprocess.call(['sensible-editor', f]) + return cat_file(f) + +def cat_file(f): content = '' for line in open(f): if line.startswith('#'): continue content += line - return content.strip() def main(): - if len(sys.argv) != 4 and len(sys.argv) != 5: + if len(sys.argv) < 4 or len(sys.argv) > 7: print >> sys.stderr, '''Upload a release tarball to a Launchpad project. - Usage: %s [new milestone]''' % sys.argv[0] + Usage: %s [new milestone] [changelog file] [releasenotes file]''' % sys.argv[0] sys.exit(1) + changelog_file = None + releasenotes_file = None if len(sys.argv) == 4: (project, version, tarball) = sys.argv[1:] - else: + elif len(sys.argv) == 5: (project, version, tarball, new_milestone) = sys.argv[1:] + elif len(sys.argv) == 6: + (project, version, tarball, new_milestone, changelog_file) = sys.argv[1:] + elif len(sys.argv) == 7: + (project, version, tarball, new_milestone, changelog_file, releasenotes_file) = sys.argv[1:] try: launchpad = Launchpad.login_with('ubuntu-dev-tools', 'production') @@ -135,10 +145,17 @@ def main(): file_type='Code Release Tarball', signature_filename=signature, signature_content=signature_content) - changelog = edit_file('changelog', 'changelog') + if changelog_file is not None: + changelog = cat_file(changelog_file) + else: + changelog = edit_file('changelog', 'changelog') if changelog: release.changelog = changelog - release_notes = edit_file('releasenotes', 'release notes') + + if releasenotes_file is not None: + release_notes = cat_file(releasenotes_file) + else: + release_notes = edit_file('releasenotes', 'release notes') if release_notes: release.release_notes = release_notes