* 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
This commit is contained in:
Dustin Kirkland 2011-06-02 18:30:20 -04:00
parent 6aee8410eb
commit 4349bcad39
3 changed files with 36 additions and 8 deletions

7
debian/changelog vendored
View File

@ -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 <bdrung@debian.org> Sat, 28 May 2011 19:43:10 +0200
ubuntu-dev-tools (0.124) unstable; urgency=low

View File

@ -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 <project name> <version> <tarball> [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 <martin.pitt@ubuntu.com>.
\fBlp\-project\-upload\fR was written by Martin Pitt <martin.pitt@ubuntu.com> and enhanced by Dustin Kirkland <kirkland@ubuntu.com>.
.PP
It is released under the terms of the GNU General Public License, version 2
or (at your option) any later version.

View File

@ -15,6 +15,8 @@
# Authors:
# Martin Pitt <martin.pitt@ubuntu.com>, based on
# http://blog.launchpad.net/api/recipe-for-uploading-files-via-the-api
# Dustin Kirkland <kirkland@ubuntu.com>
# - 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 <project name> <version> <tarball> [new milestone]''' % sys.argv[0]
Usage: %s <project name> <version> <tarball> [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,9 +145,16 @@ def main():
file_type='Code Release Tarball', signature_filename=signature,
signature_content=signature_content)
if changelog_file is not None:
changelog = cat_file(changelog_file)
else:
changelog = edit_file('changelog', 'changelog')
if changelog:
release.changelog = changelog
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