From ff41896cc841e76de7216b08ec1d6cbd2a8ee364 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 17 Aug 2011 12:50:51 +0200 Subject: [PATCH] Remove lp-project-upload, lp-list-bugs and lp-set-dup, which are now included in lptools. --- debian/changelog | 7 ++ debian/control | 1 + lp-list-bugs | 63 ---------------- lp-project-upload | 178 ---------------------------------------------- lp-set-dup | 134 ---------------------------------- setup.py | 3 - 6 files changed, 8 insertions(+), 378 deletions(-) delete mode 100755 lp-list-bugs delete mode 100755 lp-project-upload delete mode 100755 lp-set-dup diff --git a/debian/changelog b/debian/changelog index 302af1b..240bb22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ubuntu-dev-tools (0.129) UNRELEASED; urgency=low + + * Remove lp-project-upload, lp-list-bugs and lp-set-dup, which are now + included in lptools. + + -- Jelmer Vernooij Wed, 17 Aug 2011 12:47:59 +0200 + ubuntu-dev-tools (0.128) unstable; urgency=low [ Stefano Rivera ] diff --git a/debian/control b/debian/control index c9225d8..14ea07b 100644 --- a/debian/control +++ b/debian/control @@ -51,6 +51,7 @@ Recommends: bzr, debootstrap, genisoimage, libwww-perl, + lptools, pbuilder | cowdancer | sbuild, perl-modules, python-dns, diff --git a/lp-list-bugs b/lp-list-bugs deleted file mode 100755 index 76c3db8..0000000 --- a/lp-list-bugs +++ /dev/null @@ -1,63 +0,0 @@ -#! /usr/bin/python -# -*- coding: UTF-8 -*- -"""Briefly list status of Launchpad bugs.""" - -# Copyright (c) 2010 Canonical Ltd. -# -# lp-set-dup 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; either version 3, or (at your option) any -# later version. -# -# lp-set-dup is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with lp-set-dup; see the file COPYING. If not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# Authors: -# Colin Watson - -import sys -from optparse import OptionParser - -from launchpadlib.launchpad import Launchpad -from launchpadlib.errors import HTTPError - -def main(): - usage = "Usage: %prog [...]" - parser = OptionParser(usage) - args = parser.parse_args()[1] - if len(args) < 1: - parser.error("Need at least one bug number") - - try: - launchpad = Launchpad.login_with('ubuntu-dev-tools', 'production') - except Exception, error: - print >> sys.stderr, 'Could not connect to Launchpad:', str(error) - sys.exit(2) - - for bugnum in args: - try: - bug = launchpad.bugs[bugnum] - print "Bug %s: %s" % (bugnum, bug.title) - for task in bug.bug_tasks: - print " %s: %s" % (task.bug_target_name, task.status) - except HTTPError, error: - if error.response.status == 401: - print >> sys.stderr, \ - ("E: Don't have enough permissions to access bug %s" % - bugnum) - print >> sys.stderr, error.content - continue - elif error.response.status == 404: - print >> sys.stderr, "E: Bug %s not found" % bugnum - else: - raise - -if __name__ == '__main__': - main() diff --git a/lp-project-upload b/lp-project-upload deleted file mode 100755 index f1063a5..0000000 --- a/lp-project-upload +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2009 Canonical Ltd. -# -# 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; either version 2, or (at your option) any -# later version. -# -# lp-project-upload is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# 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.''' - -import datetime -import os -import sys -import tempfile - -from launchpadlib.launchpad import Launchpad -from launchpadlib.errors import HTTPError - -from ubuntutools import subprocess - -def create_release(project, version): - '''Create new release and milestone for LP project.''' - - print 'Release %s could not be found for project. Create it? (Y/n)' % \ - version - answer = sys.stdin.readline().strip() - if answer.startswith('n'): - sys.exit(0) - - n_series = len(project.series) - if n_series == 1: - series = project.series[0] - elif n_series > 1: - msg = 'More than one series exist. Which one would you like to ' \ - 'upload to? Possible series are (listed as index, name):' - print msg - for idx, serie in enumerate(project.series): - print '\t%i - %s' % (idx, serie.name) - print 'Enter series index: ' - answer = sys.stdin.readline().strip() - try: - series = project.series[int(answer)] - except (ValueError, IndexError): - print >> sys.stderr, 'The series index is invalid (%s).' % answer - sys.exit(3) - else: - print "Using series named '%s'" % series.name - else: - print >> sys.stderr, ('Does not support creating releases if no ' - 'series exists.') - sys.exit(3) - - release_date = datetime.date.today().strftime('%Y-%m-%d') - milestone = series.newMilestone(name=version, - date_targeted=release_date) - return milestone.createProductRelease(date_released=release_date) - -def edit_file(prefix, description): - (fd, f) = tempfile.mkstemp(prefix=prefix+'.') - os.write(fd, '\n\n#------\n# Please enter the %s here. ' - '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 or len(sys.argv) > 7: - print >> sys.stderr, '''Upload a release tarball to a Launchpad project. - - Usage: %s [new milestone] [changelog file] [releasenotes file]''' % sys.argv[0] - sys.exit(1) - - new_milestone = None - changelog_file = None - releasenotes_file = None - if len(sys.argv) == 4: - (project, version, tarball) = sys.argv[1:] - 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') - except Exception, error: - print >> sys.stderr, 'Could not connect to Launchpad:', str(error) - sys.exit(2) - - try: - # Look up the project using the Launchpad instance. - proj = launchpad.projects[project] - # Find the release in the project's releases collection. - release = None - for rel in proj.releases: - if rel.version == version: - release = rel - break - if not release: - for milestone in proj.all_milestones: - if milestone.name == version: - today = datetime.date.today().strftime('%Y-%m-%d') - release = milestone.createProductRelease(date_released=today) - if not release: - release = create_release(proj, version) - - # Get the file contents. - file_content = open(tarball, 'r').read() - # Get the signature, if available. - signature = tarball + '.asc' - if not os.path.exists(signature): - print 'Calling GPG to create tarball signature...' - cmd = ['gpg', '--armor', '--sign', '--detach-sig', tarball] - if subprocess.call(cmd) != 0: - print >> sys.stderr, 'gpg failed, aborting' - - if os.path.exists(signature): - signature_content = open(signature, 'r').read() - else: - signature_content = None - - # Create a new product release file. - filename = os.path.basename(tarball) - release.add_file(filename=filename, description='release tarball', - file_content=file_content, content_type='appplication/x-gzip', - 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 - - release.lp_save() - - # Create a new milestone if requested - if new_milestone is not None: - mil = release.milestone - for series in proj.series: - if mil.name in [milestone.name for milestone in series.all_milestones]: - series.newMilestone(name=new_milestone) - - except HTTPError, error: - print 'An error happened in the upload:', error.content - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/lp-set-dup b/lp-set-dup deleted file mode 100755 index 8df0cea..0000000 --- a/lp-set-dup +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- -"""Sets the "duplicate of" bug of a bug and its dups.""" - -# Copyright (c) 2009 Canonical Ltd. -# -# lp-set-dup 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; either version 2, or (at your option) any -# later version. -# -# lp-set-dup is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with lp-set-dup; see the file COPYING. If not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# Authors: -# Loïc Minier - -import sys -from optparse import OptionParser - -from launchpadlib.launchpad import Launchpad -from launchpadlib.errors import HTTPError - -from ubuntutools.config import UDTConfig - -def die(message): - print >> sys.stderr, "Fatal: " + message - sys.exit(1) - -def main(): - usage = "Usage: %prog [-f] [...]" - opt_parser = OptionParser(usage) - opt_parser.add_option("-f", - help="Skip confirmation prompt", - dest="force", default=False, action="store_true") - opt_parser.add_option("-l", "--lpinstance", metavar="INSTANCE", - help="Launchpad instance to connect to " - "(default: production)", - dest="lpinstance", default=None) - opt_parser.add_option("--no-conf", - help="Don't read config files or " - "environment variables.", - dest="no_conf", default=False, action="store_true") - (options, args) = opt_parser.parse_args() - - if len(args) < 2: - opt_parser.error("Need at least a new main bug and a bug to dup") - - config = UDTConfig(options.no_conf) - if options.lpinstance is None: - options.lpinstance = config.get_value("LPINSTANCE") - - launchpad = None - try: - print "Setting up Launchpad" - launchpad = Launchpad.login_with("ubuntu-dev-tools", options.lpinstance) - print "Launchpad setup complete" - except ImportError: - suggestion = "check whether python-launchpadlib is installed" - if launchpad is None: - die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \ - (suggestion, )) - - # check that the new main bug isn't a duplicate - try: - new_main_bug = launchpad.bugs[args[0]] - except HTTPError, error: - if error.response.status == 401: - print >> sys.stderr, ("E: Don't have enough permissions to access " - "bug %s") % (args[0]) - die(error.content) - else: - raise - new_main_dup_of = new_main_bug.duplicate_of - if new_main_dup_of is not None: - answer = None - try: - answer = raw_input("Bug %s is a duplicate of %s; would you like to " - "use %s as the new main bug instead? [y/N]" % \ - (new_main_bug.id, new_main_dup_of.id, - new_main_dup_of.id)) - except: - die("Aborted") - if answer.lower() not in ("y", "yes"): - die("User aborted") - new_main_bug = new_main_dup_of - - # build list of bugs to process, first the dups then the bug - bugs_to_process = [] - for bug_number in args[1:]: - print "Processing %s" % (bug_number) - try: - bug = launchpad.bugs[bug_number] - except HTTPError, error: - if error.response.status == 401: - print >> sys.stderr, ("W: Don't have enough permissions to " - "access bug %s") % (bug_number) - print >> sys.stderr, "W: %s" % (error.content) - continue - else: - raise - dups = bug.duplicates - if dups is not None: - bugs_to_process.extend(dups) - print "Found %i dups for %s" % (len(dups), bug_number) - bugs_to_process.append(bug) - - # process dups first, then their main bug - print "Would set the following bugs as duplicates of %s: %s" % \ - (new_main_bug.id, " ".join([str(b.id) for b in bugs_to_process])) - - if not options.force: - answer = None - try: - answer = raw_input("Proceed? [y/N]") - except: - die("Aborted") - if answer.lower() not in ("y", "yes"): - die("User aborted") - - for bug in bugs_to_process: - print "Marking bug %s as a duplicate of %s" % (bug.id, new_main_bug.id) - bug.duplicate_of = new_main_bug - bug.lp_save() - -if __name__ == '__main__': - main() diff --git a/setup.py b/setup.py index a9ff166..0a657ea 100755 --- a/setup.py +++ b/setup.py @@ -28,9 +28,6 @@ scripts = ['404main', 'harvest', 'hugdaylist', 'import-bug-from-debian', - 'lp-list-bugs', - 'lp-project-upload', - 'lp-set-dup', 'lp-shell', 'massfile', 'merge-changelog',