mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
remove grab-attachments, too.
This commit is contained in:
parent
c55c731237
commit
1cb0bfd1e7
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -1,7 +1,7 @@
|
|||||||
ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
|
ubuntu-dev-tools (0.129) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* Remove lp-project-upload, lp-list-bugs and lp-set-dup, which are now
|
* Remove grab-attachments, lp-project-upload, lp-list-bugs and lp-set-dup,
|
||||||
included in lptools.
|
which are now included in lptools.
|
||||||
|
|
||||||
-- Jelmer Vernooij <jelmer@ubuntu.com> Wed, 17 Aug 2011 12:47:59 +0200
|
-- Jelmer Vernooij <jelmer@ubuntu.com> Wed, 17 Aug 2011 12:47:59 +0200
|
||||||
|
|
||||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -80,8 +80,6 @@ Description: useful tools for Ubuntu developers
|
|||||||
team.
|
team.
|
||||||
- get-build-deps - install the build dependencies needed for a package
|
- get-build-deps - install the build dependencies needed for a package
|
||||||
reading debian/control.
|
reading debian/control.
|
||||||
- grab-attachments - download all bug attachments from a Launchpad bug
|
|
||||||
report.
|
|
||||||
- grab-merge - grabs a merge from merges.ubuntu.com easily.
|
- grab-merge - grabs a merge from merges.ubuntu.com easily.
|
||||||
- grep-merges - search for pending merges from Debian.
|
- grep-merges - search for pending merges from Debian.
|
||||||
- harvest - grabs information about development opportunities from
|
- harvest - grabs information about development opportunities from
|
||||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -84,7 +84,6 @@ License: GPL-2+
|
|||||||
Files: ack-sync
|
Files: ack-sync
|
||||||
doc/bitesize.1
|
doc/bitesize.1
|
||||||
doc/get-branches.1
|
doc/get-branches.1
|
||||||
doc/grab-attachments.1
|
|
||||||
doc/grab-merge.1
|
doc/grab-merge.1
|
||||||
doc/harvest.1
|
doc/harvest.1
|
||||||
doc/hugdaylist.1
|
doc/hugdaylist.1
|
||||||
@ -94,7 +93,6 @@ Files: ack-sync
|
|||||||
doc/syncpackage.1
|
doc/syncpackage.1
|
||||||
bitesize
|
bitesize
|
||||||
get-branches
|
get-branches
|
||||||
grab-attachments
|
|
||||||
grab-merge
|
grab-merge
|
||||||
harvest
|
harvest
|
||||||
hugdaylist
|
hugdaylist
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
.TH GRAB\-ATTACHMENTS "1" "10 August 2008" "ubuntu-dev-tools"
|
|
||||||
.SH NAME
|
|
||||||
grab\-attachments \- downloads attachments from a Launchpad bug
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B grab\-attachments\fR [\fIoptions\fR] \fIbug-number\fR...
|
|
||||||
.br
|
|
||||||
.B grab\-attachments \-h
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBgrab\-attachments\fR is a script to download all attachments from a
|
|
||||||
Launchpad bug report or bug reports with a source package task into
|
|
||||||
a directory named after the bug e.g. bug-1.
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
Listed below are the command line options for grab\-attachments:
|
|
||||||
.TP
|
|
||||||
.I bug-number
|
|
||||||
Specifies the Launchpad bug number that the script should download
|
|
||||||
attachments from.
|
|
||||||
.TP
|
|
||||||
.BR \-h ", " \-\-help
|
|
||||||
Display a help message and exit.
|
|
||||||
.TP
|
|
||||||
.B \-l \fIINSTANCE\fR, \fB\-\-lpinstance\fR=\fIINSTANCE\fR
|
|
||||||
Use the specified instance of Launchpad (e.g. "staging"), instead of
|
|
||||||
the default of "production".
|
|
||||||
.TP
|
|
||||||
.B \-\-no\-conf
|
|
||||||
Do not read any configuration files, or configuration from environment
|
|
||||||
variables.
|
|
||||||
.TP
|
|
||||||
.BR \-d ", " \-\-duplicates
|
|
||||||
Download attachments from duplicates too.
|
|
||||||
.TP
|
|
||||||
.B \-p \fISRCPACKAGE\fR, \fB\-\-package\fR=\fISRCPACKAGE\fR
|
|
||||||
Download attachments from all bugs with a task for this source
|
|
||||||
package.
|
|
||||||
.SH ENVIRONMENT
|
|
||||||
All of the \fBCONFIGURATION VARIABLES\fR below are also supported as
|
|
||||||
environment variables.
|
|
||||||
Variables in the environment take precedence to those in configuration
|
|
||||||
files.
|
|
||||||
.SH CONFIGURATION VARIABLES
|
|
||||||
The following variables can be set in the environment or in
|
|
||||||
.BR ubuntu\-dev\-tools (5)
|
|
||||||
configuration files.
|
|
||||||
In each case, the script\-specific variable takes precedence over the
|
|
||||||
package\-wide variable.
|
|
||||||
.TP
|
|
||||||
.BR GRAB_ATTACHMENTS_LPINSTANCE ", " UBUNTUTOOLS_LPINSTANCE
|
|
||||||
The default value for \fB--lpinstance\fR.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ubuntu\-dev\-tools (5)
|
|
||||||
.SH AUTHOR
|
|
||||||
\fBgrab\-attachments\fR was written by Daniel Holbach and this manual page
|
|
||||||
was written by Jonathan Patrick Davies.
|
|
||||||
.PP
|
|
||||||
Both are released under the GNU General Public License, version 2.
|
|
107
grab-attachments
107
grab-attachments
@ -1,107 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007, Canonical Ltd.
|
|
||||||
# Written by Daniel Holbach,
|
|
||||||
# Stefano Rivera,
|
|
||||||
# Brian Murray
|
|
||||||
#
|
|
||||||
# ##################################################################
|
|
||||||
#
|
|
||||||
# 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 3.
|
|
||||||
#
|
|
||||||
# This program 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.
|
|
||||||
#
|
|
||||||
# See file /usr/share/common-licenses/GPL-3 for more details.
|
|
||||||
#
|
|
||||||
# ##################################################################
|
|
||||||
|
|
||||||
from optparse import OptionParser
|
|
||||||
import errno
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from launchpadlib.launchpad import Launchpad
|
|
||||||
|
|
||||||
from ubuntutools.config import UDTConfig
|
|
||||||
|
|
||||||
USAGE = "grab-attachments <bug numbers>"
|
|
||||||
|
|
||||||
|
|
||||||
def download_attachments(bug):
|
|
||||||
|
|
||||||
bug_folder_name = 'bug-%s' % bug.id
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.mkdir(bug_folder_name)
|
|
||||||
except OSError, error:
|
|
||||||
if error.errno == errno.EEXIST:
|
|
||||||
return
|
|
||||||
|
|
||||||
for attachment in bug.attachments:
|
|
||||||
f = attachment.data.open()
|
|
||||||
filename = os.path.join(os.getcwd(), bug_folder_name, f.filename)
|
|
||||||
local_file = open(filename, "w")
|
|
||||||
local_file.write(f.read())
|
|
||||||
f.close()
|
|
||||||
local_file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = OptionParser('Usage: %prog [options] <bug numbers>')
|
|
||||||
parser.add_option('-l', '--lpinstance', metavar='INSTANCE',
|
|
||||||
dest='lpinstance', default=None,
|
|
||||||
help='Launchpad instance to connect to '
|
|
||||||
'(default: production)')
|
|
||||||
parser.add_option('--no-conf',
|
|
||||||
dest='no_conf', default=False, action='store_true',
|
|
||||||
help="Don't read config files or environment variables")
|
|
||||||
parser.add_option('-d', '--duplicates', default=False,
|
|
||||||
action='store_true',
|
|
||||||
help='Download attachments from duplicates too')
|
|
||||||
parser.add_option('-p', '--package',
|
|
||||||
help='Download attachments from all bugs with a '
|
|
||||||
'task for this source package')
|
|
||||||
|
|
||||||
opts, args = parser.parse_args()
|
|
||||||
if len(args) < 1 and not opts.package:
|
|
||||||
parser.error('No bug numbers provided')
|
|
||||||
config = UDTConfig(opts.no_conf)
|
|
||||||
if opts.lpinstance is None:
|
|
||||||
opts.lpinstance = config.get_value('LPINSTANCE')
|
|
||||||
|
|
||||||
try:
|
|
||||||
launchpad = Launchpad.login_with("ubuntu-dev-tools", opts.lpinstance)
|
|
||||||
|
|
||||||
if opts.package:
|
|
||||||
ubuntu = launchpad.projects['ubuntu']
|
|
||||||
src_package = ubuntu.getSourcePackage(name=opts.package)
|
|
||||||
if src_package is None:
|
|
||||||
parser.error('Unable to find package %s' % opts.package)
|
|
||||||
for task in src_package.searchTasks():
|
|
||||||
args.append(task.bug.id)
|
|
||||||
|
|
||||||
for arg in args:
|
|
||||||
try:
|
|
||||||
bug_number = int(arg)
|
|
||||||
except ValueError:
|
|
||||||
parser.error("'%s' is not a valid bug number." % arg)
|
|
||||||
|
|
||||||
bug = launchpad.bugs[bug_number]
|
|
||||||
download_attachments(bug)
|
|
||||||
|
|
||||||
if opts.duplicates is True:
|
|
||||||
for bug in bug.duplicates:
|
|
||||||
download_attachments(bug)
|
|
||||||
|
|
||||||
# no LP credentials
|
|
||||||
except IOError, error:
|
|
||||||
print error
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
x
Reference in New Issue
Block a user