Merge with Iain Lane's branch and some other changes.

This commit is contained in:
Siegfried-Angel Gevatter Pujals 2008-08-04 20:51:47 +02:00
commit fcb0d7166a
7 changed files with 196 additions and 12 deletions

14
debian/changelog vendored
View File

@ -1,12 +1,24 @@
ubuntu-dev-tools (0.35) intrepid; urgency=low
[ Siegfried-Angel Gevatter Pujals ]
* doc/update-maintainer.1:
- Remove the reference to the --no-changelog option from the manpage.
* requestsync:
- If the email interface is used, check if DEBEMAIL is set before anything
else (LP: #254632).
* massfile, examples/massfile.instructions:
- Make it possible to give the created bugs a determined status.
-- Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com> Mon, 04 Aug 2008 14:50:15 +0200
[ Iain Lane ]
* Add pull-lp-source, which get source packages from LP to avoid mirror lag.
* pbuilder-dist.new:
- Set mirror and component for Debian distros.
- Use local apt cache if available.
* massfile:
- Modify it to work with Firefox 3 cookies, taking code from requestsync.
- Set the status to Confirmed, by default.
-- Iain Lane <iain@orangesquash.org.uk> Mon, 04 Aug 2008 18:29:46 +0100
ubuntu-dev-tools (0.34) intrepid; urgency=low

9
debian/copyright vendored
View File

@ -18,6 +18,7 @@ Upstream Authors:
Soren Hansen <soren@ubuntu.com>
Steve Kowalik <stevenk@ubuntu.com>
Terence Simpson <stdin@stdin.me.uk>
Iain Lane <iain@orangesquash.org.uk>
Copyright:
@ -32,6 +33,7 @@ Copyright:
(C) 2006-2007, Pete Savage <petesavage@ubuntu.com>
(C) 2007-2008, Siegfried-A. Gevatter <rainct@ubuntu.com>
(C) 2007, Terence Simpson <stdin@stdin.me.uk>
(C) 2008, Iain Lane <iain@orangesquash.org.uk>
Licenses:
@ -51,8 +53,8 @@ and what-patch are licensed under GPLv2:
On Debian systems, the complete text of the GNU General Public License v2
can be found in `/usr/share/common-licenses/GPL-2'.
get-branches, get-build-deps, debian-pull-debdiff, massfile, ppaput and
suspicious-source are licensed under GPLv3:
get-branches, get-build-deps, debian-pull-debdiff, massfile, ppaput,
suspicious-source and pull-lp-source are licensed under GPLv3:
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
@ -68,4 +70,5 @@ can be found in `/usr/share/common-licenses/GPL-3'.
The following of the scripts can be used, at your option, regarding any
later version of the previously specified license: 404main, pbuilder-dist,
dgetlp, reverse-build-depends, suspicious-source and get-build-deps.
dgetlp, reverse-build-depends, suspicious-source, pull-lp-source and
get-build-deps.

39
doc/pull-lp-source.1 Normal file
View File

@ -0,0 +1,39 @@
.TH PULL-LP-SOURCE "1" "4 August 2008" "ubuntu-dev-tools"
.SH NAME
pull-lp-source \- download a source package from Launchpad
.SH SYNOPSIS
.B pull-lp-source [-h] <\fBsource package\fR> [\fItarget release\fR]
.SH DESCRIPTION
.PP
\fBpull-lp-source\fR downloads and extracts the latest version of
<\fBsource package\fR> from Launchpad. If the optional parameter
[\fItarget release\fR] is specified, the latest version in that release
will be downloaded instead.
.SH OPTIONS
.PP
Listed below are the command line options for requestsync:
.TP
.B \-h, --help
Display a help message and exit.
.TP
.B <source package>
This is the source package that you would like to be downloaded from Launchpad.
.TP
.B [target release]
This is the release that you would like the source package to be downloaded from.
This value defaults to the current development release.
.SH ENVIRONMENT VARIABLES
.TP
DIST
Specifies the default target.
.SH AUTHOR
.PP
\fBpull-lp-source\fR and this manual page were written by Iain Lane
<iain@orangesquash.org.uk>. Both are released under the GNU General Public
License, version 3 or later.

View File

@ -1,5 +1,6 @@
subject: [UNMETDEPS] $pack has unmet dependencies
assignee:
status: confirmed
subscribers: motu
tags: unmetdeps
buglist-url: http://bugs.launchpad.net/ubuntu/+bugs?field.tag=unmetdeps
@ -13,4 +14,3 @@ text:
installable (on AMD64) at the moment.
.
Please have a look and make sure it's installable again.

View File

@ -2,11 +2,15 @@
# -*- coding: utf-8 -*-
#
# (C) Canonical, 2007, GPL v3
#
# Modified by Iain Lane <iain@orangesquash.org.uk>, taking some code written by
# Daniel Hahler <ubuntu@thequod.de>
import os
import sys
import email
import subprocess
import glob
import launchpadbugs.connector as Connector
@ -18,7 +22,7 @@ def read_config():
instr = dict()
for field in "subject", "assignee", "subscribers", "tags", "text", \
"buglist-url":
"buglist-url", "status":
instr[field] = instructions.get(field)
return instr
@ -66,7 +70,7 @@ def check_configfiles():
def file_bug(config):
Bug = Connector.ConnectBug()
Bug.authentication = os.path.expanduser("~/.lpcookie")
Bug.authentication = cookie
try:
summary = config["subject"].replace("$pack", config["sourcepackage"])
@ -85,6 +89,10 @@ def file_bug(config):
if tag.strip("\n").strip():
bug.tags.append(tag.strip("\n").strip())
bug.assignee = config["assignee"]
if config["status"]:
bug.status = config["status"].capitalize()
else:
bug.status = "Confirmed"
bug.commit()
except:
"Bug for '%s' was not filed." % config["sourcepackage"]
@ -100,16 +108,38 @@ def read_buglist(url):
return packages
def lp_cookie():
global cookie
cookie = None
# Search cookiefile (for authentication to lp)
if cookie == None:
try_globs = ('~/.lpcookie.txt', '~/.mozilla/*/*/cookies.sqlite', '~/.mozilla/*/*/cookies.txt')
for try_glob in try_globs:
try:
cookiefile = glob.glob(os.path.expanduser(try_glob))[0]
except IndexError:
continue
# Found:
print "Using cookie file at «%s».\n" % cookiefile
cookie = cookiefile
break
if cookie == None:
raise RuntimeError("Could not find cookie file for Launchpad \
(looked in %s). You should be able to create a valid file by logging into \
Launchpad with Firefox") % ", ".join(try_globs)
def main():
if not check_configfiles():
sys.exit(1)
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
print >> sys.stderr, \
"Launchpad cookie not found in ~/.lpcookie."
try:
lp_cookie()
except RuntimeError, e:
print e
sys.exit(1)
config = read_config()
pack_list = read_list()
buglist = read_buglist(config["buglist-url"])

View File

@ -17,6 +17,8 @@
import sys
import os
debian_distros = ['etch', 'lenny', 'sid', 'stable', 'testing', 'unstable']
class pbuilder_dist:
def __init__(self):
@ -182,8 +184,19 @@ class pbuilder_dist:
'--logfile "%(logfile)s"' % self,
'--aptcache "/var/cache/apt/archives/"',
### --mirror "${ARCHIVE}" \
'--bindmounts "/var/cache/archive/"',
'--override-config',
]
localrepo = '/var/cache/archive/%(target_distro)s' % self
if os.path.exists(localrepo):
arguments.append('--othermirror ' +\
'"deb file:///var/cache/archive/ %(target_distro)s/"' % self)
if self.target_distro in debian_distros:
arguments.append('--mirror "ftp://ftp.debian.org/debian"')
arguments.append('--components "main contrib non-free"')
if self.build_architecture != self.system_architecture:
arguments.append('--debootstrapopts --arch')
arguments.append('--debootstrapopts "%(build_architecture)s"' % self)

87
pull-lp-source Executable file
View File

@ -0,0 +1,87 @@
#!/usr/bin/python
# pull-lp-source -- pull a source package from Launchpad
# Basic usage: pull-lp-source <source package> [<distro>]
#
# Copyright (C) 2008 Iain Lane <iain@orangesquash.org.uk>
#
# BackportFromLP class taken from prevu tool, which has
# copyright (C) 2006 John Dong <jdong@ubuntu.com>.
#
# 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 3
# of the License, or (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# TODO: Determine before going to LP whether a source package and distro exist or not.
# TODO: Determine current development distro programatically
import sys
import os
class BackportFromLP:
def __getitem__(self, name):
return getattr(self, name)
def __init__(self, package, target_distro):
self.package = package
self.target_distro = target_distro
self.__prepare_sources()
def __prepare_sources(self):
# Scrape the source package from Launchpad :)
import re
contents = os.popen('wget -q https://launchpad.net/ubuntu/%(target_distro)s/+source/%(package)s -O-' % self).read()
links = re.findall('a href=\"(.*\.dsc)\"', contents)
if len(links) == 1 and \
(os.system('dget -x http://launchpad.net%s' % links[0])) == 0:
print '\nSuccess!'
else:
raise ValueError, '\nFailed to fetch and extract the source. ' +\
'Ensure that the package specified is a valid source ' +\
'package name and that Launchpad is not down.'
default_distro = 'intrepid'
def usage():
print 'Usage: %s <package> [distro]' % sys.argv[0]
if __name__ == '__main__':
args = sys.argv[1:] or []
if args == [] or args[0] in ('-h', '--help'):
usage()
sys.exit(0)
if len(args) >= 1:
package = args[0]
if len(args) == 2:
distro = args[1]
elif len(args) == 1:
distro = os.getenv('DIST') or default_distro
else: # incorrect args
usage()
sys.exit(1)
# Correct-ish args, can proceed
try:
print 'Attempting to get %s from distro %s...' % \
(package, distro.capitalize())
BackportFromLP(package, distro)
except ValueError, e:
print 'Error when downloading package %s from distro %s: %s' % \
(package, distro, e)