Merged trunk

This commit is contained in:
Daniel Hahler 2008-04-16 02:34:37 +02:00
commit 5323f8f647
35 changed files with 933 additions and 711 deletions

1
.bzrignore Normal file
View File

@ -0,0 +1 @@
debian/pycompat

54
404main
View File

@ -31,7 +31,7 @@ def find_main(pack):
global packages global packages
# Retrieve information about the package # Retrieve information about the package
out = subprocess.Popen('apt-cache madison ' + pack, shell=True, stdout=subprocess.PIPE).stdout.read() out = subprocess.Popen('apt-cache madison ' + pack + ' | grep ' + distro + ' | grep -m 1 Packages', shell=True, stdout=subprocess.PIPE).stdout.read()
if out.find("/main") != -1: if out.find("/main") != -1:
packages[pack] = True packages[pack] = True
@ -41,12 +41,12 @@ def find_main(pack):
packages[pack] = False packages[pack] = False
# Retrive package dependencies # Retrive package dependencies
deps = subprocess.Popen("apt-cache show " + pack + " | grep Depends", shell=True, stdout=subprocess.PIPE).stdout.read().split('\n')[0].replace('Depends: ', '').split(', ') deps = subprocess.Popen('apt-cache show ' + pack + ' | grep -m 1 ^Depends', shell=True, stdout=subprocess.PIPE).stdout.read().split('\n')[0].replace('Depends: ', '').split(', ')
process_deps(deps) process_deps(deps)
# Retrieve package build dependencies # Retrieve package build dependencies
deps1 = subprocess.Popen("apt-cache showsrc " + pack + " | grep Build-Depends", shell=True, stdout=subprocess.PIPE).stdout.readlines() deps1 = subprocess.Popen('apt-cache showsrc ' + pack + ' | grep -m 1 ^Build-Depends', shell=True, stdout=subprocess.PIPE).stdout.readlines()
deps = [] deps = []
for builddep in deps1: for builddep in deps1:
@ -56,25 +56,31 @@ def find_main(pack):
process_deps(deps) process_deps(deps)
if __name__ == '__main__': def main():
global packages, distro
# Check if the amount of arguments is correct # Check if the amount of arguments is correct
if len(sys.argv) != 2 or sys.argv[1] in ('help', '-h', '--help'): if len(sys.argv) < 2 or len(sys.argv) > 3 or sys.argv[1] in ('help', '-h', '--help'):
print "Usage: %s <package name>" % sys.argv[0] print 'Usage: %s <package name> [<distribution>]' % sys.argv[0]
sys.exit(1) sys.exit(1)
# Global variable to hold the status of all packages if len(sys.argv) == 3 and sys.argv[2]:
packages = {} distro = sys.argv[2]
if not subprocess.Popen('apt-cache madison bash | grep ' + distro, shell=True, stdout=subprocess.PIPE).stdout.read():
print '«%s» is not a valid distribution.' % distro
print 'Remember that for 404main to work with a certain distribution it must be in your /etc/apt/sources.list file.'
sys.exit(1)
else:
distro = subprocess.Popen('lsb_release -cs', shell=True, stdout=subprocess.PIPE).stdout.read().strip('\n')
if subprocess.Popen("apt-cache show " + sys.argv[1] + " 2>/dev/null", shell=True, stdout=subprocess.PIPE).stdout.read() == '': if not subprocess.Popen('apt-cache madison ' + sys.argv[1] + ' | grep ' + distro, shell=True, stdout=subprocess.PIPE).stdout.read():
print "Package «%s» doesn't exist." % sys.argv[1] print 'Can\'t find package «%s» in distribution «%s».' % (sys.argv[1], distro)
sys.exit(1) sys.exit(1)
try: print 'Checking package «%s» in distribution «%s»...' % (sys.argv[1], distro)
find_main(sys.argv[1])
except KeyboardInterrupt: find_main(sys.argv[1])
print 'Aborted.'
sys.exit(1)
# True if everything checked until the point is in main # True if everything checked until the point is in main
all_in_main = True all_in_main = True
@ -82,9 +88,23 @@ if __name__ == '__main__':
for package in packages: for package in packages:
if not packages[package]: if not packages[package]:
if all_in_main: if all_in_main:
print "Following packages aren't in main:" print 'The following packages aren\'t in main:'
all_in_main = False all_in_main = False
print ' ', package print ' ', package
if all_in_main: if all_in_main:
print package, "and all its dependencies are in main." print 'Package «%s» and all its dependencies and build dependencies are in main.' % sys.argv[1]
if __name__ == '__main__':
# Global variable to hold the status of all packages
packages = {}
# Global variable to hold the target distribution
distro = ''
try:
main()
except KeyboardInterrupt:
print 'Aborted.'
sys.exit(1)

6
README
View File

@ -46,12 +46,6 @@ pbuilder-dist [withlog] [create|update|build|clean|login|execute]
Debian releases. It's recommended to symlink as pbuilder-feisty, Debian releases. It's recommended to symlink as pbuilder-feisty,
pbuilder-gutsy, etc. pbuilder-gutsy, etc.
ppaput [-n] <dput location> [<debuild options>]
... will build a source package using <debuild options>, upload it
to <dput location> and follow up on specified bugs, make sure the
sponsoring process is followed. Also it will file a new bug, if
'-n' is used.
pull-debian-debdiff <package> <version> pull-debian-debdiff <package> <version>
... will attempt to find and download a specific version of a ... will attempt to find and download a specific version of a
Debian package and its immediate parent to generate a debdiff. Debian package and its immediate parent to generate a debdiff.

4
TODO Normal file
View File

@ -0,0 +1,4 @@
- Create missing manpages (for all commands).
- Document ubuntutools Python modules.
- Add the process-interdiff script to ubuntu-dev-tools.
- Modify 404main to use the more robust python-apt module.

View File

@ -0,0 +1,35 @@
# pbuilder-dist completion
#
# Copyright 2008 Stephan Hermann <sh@sourcecode.de>, created for
# the Ubuntu MOTU Team.
#
# Released under the GNU General Public License, version 2
#
# Based upon cobwuilder's autocompletion, Copyright 2007 Cyril
# Brulebois <cyril.brulebois@enst-bretagne.fr>
have pbuilder-dist &&
_pbuilder-dist()
{
local cur prev options
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
options='create update build clean login execute'
case $prev in
build)
COMPREPLY=( $( compgen -o filenames -G "$cur*.dsc" ) )
;;
*)
COMPREPLY=( $( compgen -W "$options" | grep "^$cur" ) )
;;
esac
return 0
}
[ "$have" ] && complete -F _pbuilder-dist -o filenames \
pbuilder-{dist,dapper,edgy,feisty,gutsy,hardy,intrepid,sarge,etch,lenny,sid}
# Make it pbuilder-* if you know how to do it

View File

@ -30,7 +30,7 @@ do
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`;
do do
LIBNAME=$(basename $lib); LIBNAME=$(basename $lib);
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.1; nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.old;
done; done;
DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "; DEBLINE="$DEBLINE $DEBDIR/$pack*.deb ";
done done
@ -58,9 +58,9 @@ do
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`;
do do
LIBNAME=$(basename $lib); LIBNAME=$(basename $lib);
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.2; nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.new;
echo "Checking: $lib"; echo "Checking: $lib";
diff -u /tmp/$LIBNAME.{1,2}; diff -u /tmp/$LIBNAME.{old,new};
rm /tmp/$LIBNAME.{1,2}; rm /tmp/$LIBNAME.{old,new};
done; done;
done done

127
debian/changelog vendored
View File

@ -1,5 +1,10 @@
ubuntu-dev-tools (0.31) hardy; urgency=low ubuntu-dev-tools (0.31) UNRELEASED; urgency=low
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
* pbuilder-dist:
- Rewrite the script in Python to make it more robust and faster.
[ Daniel Hahler ]
* requestsync: * requestsync:
- Use debian_bundle.changelog.Version for version comparison in - Use debian_bundle.changelog.Version for version comparison in
debian_changelog. debian_changelog.
@ -18,12 +23,110 @@ ubuntu-dev-tools (0.31) hardy; urgency=low
- post_bug: Catch IOError when setting bug importance (LP: #190061) - post_bug: Catch IOError when setting bug importance (LP: #190061)
- mail_bug: Catch socket.error (LP: #190739) - mail_bug: Catch socket.error (LP: #190739)
-- Daniel Hahler <ubuntu@thequod.de> Wed, 16 Apr 2008 01:57:41 +0200 -- Daniel Hahler <ubuntu@thequod.de> Wed, 16 Apr 2008 02:32:40 +0200
ubuntu-dev-tools (0.26) UNRELEASED; urgency=low ubuntu-dev-tools (0.30) hardy; urgency=low
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
* pbuilder-dist-simple, doc/pbuilder-dist-simple.1, setup.py:
- Add the original pbuilder-dist script as pbuilder-dist-simple.
* setup.py:
- Really install reverse-build-depends (LP: #203523).
* debian/source.lintian-overrides:
- Override lintian's useless warnings (about this being a NMU).
[ Adrien Cunin ]
* debian/ubuntu-dev-tools.install: install bash_completion/pbuilder-dist in
/etc/bash_completion.d/ instead of /etc/bash_completion.d/pbuilder-dist/
* bash_completion/pbuilder-dist: apply the completion not only to
pbuilder-dist but also to pbuilder-{hardy,sid,etc.}
-- Siegfried-Angel Gevatter Pujals (RainCT) <rainct@ubuntu.com> Tue, 08 Apr 2008 16:33:52 +0200
ubuntu-dev-tools (0.29) hardy; urgency=low
* grab-attachments, setup.py: added grab-attachments tool. You give it bug
numbers, it gets you their attachments. Useful for sponsoring.
-- Daniel Holbach <daniel.holbach@ubuntu.com> Mon, 10 Mar 2008 11:31:50 +0100
ubuntu-dev-tools (0.28) hardy; urgency=low
[ Adrien Cunin ]
* pbuilder-dist:
- Fixed minor bash syntax error
- Removed quotes around the path when using --aptconfdir, otherwise
pbuilder create fails
[ Kees Cook ]
* mk-sbuild-lv: add --personality option from Jamie Strandboge (LP: #199181)
* check-symbols: rename temp files to avoid .so versioning confusion.
-- Kees Cook <kees@ubuntu.com> Thu, 06 Mar 2008 11:05:02 -0800
ubuntu-dev-tools (0.27) hardy; urgency=low
[ Andrew Hunter ]
* ppaput:
- Separated ppaput script from backend python modules (LP: #192184).
- Switched from homegrown option parseing to Optparse, much more
robust and less code duplication.
[ Daniel Holbach ]
* README, debian/rules, doc/ppaput.1.docbook, ppaput, setup.py: removed
ppaput for now. It has shortcomings and is not actively used in the
sponsoring process (LP: #194634).
[ Siegfried-Angel Gevatter Pujals (RainCT) ]
* This upload removes accidentaly uploaded files (LP: #194635, #194618,
#194621).
* Remove executable bit from AUTHORS file (LP: #194619).
* debian/control:
- Change the Vcs-Bzr address to the correct one.
- Move the reportbug dependency to Recommends.
- Drop docbook2x build dependency (see Daniel's changes).
* Move ppaput.py (the module) into new ubuntutools/ directory and
remove it's shabang.
* submittodebian:
- Check if reportbug is installed and if it isn't throw an error.
* suspicious-sources:
- Ignore .in files.
* pbuilder-dist:
- Apply patch from James Westby to fix a problem where it always
wanted to get the architecture to use as an option if a symlink
was being used .
- Fix a recently introduced problem where pbuilder-dist would always
want to know the architecture if a symlink was being used. Thanks to
Adrien Cunin and James Westby for their help on this (LP: #194633).
- Escape many variables to avoid possible problems there.
- Reorganize the code a bit and comment it.
- Accept "upgrade" as an alias for "update".
- Hide lsb_release's traceback if pbuilder-dist is manually aborted
while the distribution was being detected.
* 404main:
- Try to filter out entries from Debian and PPAs, thanks to Adrien
Cunin! (LP: #194704)
- Add limited support for multiple distributions (and update they
manpage to reflect this).
- TODO: Use python-apt instead of lots of pipes.
* debian/copyright.
- Add ppaput (the executable has been removed for now -see above-,
but there is still the module in the source package).
* debian/pycompat:
- Remove it, as it is not necessary for python-central.
[ Terence Simpson ]
* dgetlp:
- Fix bug where optaining the .orig.tar.gz would fail if the package
name contains hypens.
- Add support for native packages.
-- Siegfried-Angel Gevatter Pujals (RainCT) <rainct@ubuntu.com> Sun, 24 Feb 2008 19:11:06 +0100
ubuntu-dev-tools (0.26) hardy; urgency=low
[ Stephan Hermann ] [ Stephan Hermann ]
* pbuild-dist: fixed a bug with the *sudo call. * pbuilder-dist: fixed a bug with the *sudo call.
changed from $SUDOREPLACE "pbuilder" to $SUDOREPLACE -- pbuilder ... changed from $SUDOREPLACE "pbuilder" to $SUDOREPLACE -- pbuilder ...
[ Daniel Hahler ] [ Daniel Hahler ]
@ -34,7 +137,18 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low
(LP: #190351) (LP: #190351)
* Exit, if versions in Ubuntu and Debian are the same already. * Exit, if versions in Ubuntu and Debian are the same already.
-- Daniel Hahler <ubuntu@thequod.de> Sat, 09 Feb 2008 18:27:06 +0100 [ Siegfried-Angel Gevatter Pujals (RainCT) ]
* Add manpages for update-maintainer and 404main.
* Move pbuilder-dist.bash_completion into new bash_completion/
directory and tell dh_install to take care of the stuff there.
* Let update-maintainer also accept --no-changelog (in addition to
the current --nochangelog), improve its error messages and change
the default section to universe.
* Add AUTHORS section to doc/check-symbols.1, and little changes to
doc/suspicious-source.1.
* Fix some issues with the new pbuilder-dist code.
-- Siegfried-Angel Gevatter Pujals (RainCT) <rainct@ubuntu.com> Sun, 17 Feb 2008 19:35:46 +0100
ubuntu-dev-tools (0.25) hardy; urgency=low ubuntu-dev-tools (0.25) hardy; urgency=low
@ -50,7 +164,8 @@ ubuntu-dev-tools (0.25) hardy; urgency=low
[ Siegfried-Angel Gevatter Pujals (RainCT) ] [ Siegfried-Angel Gevatter Pujals (RainCT) ]
* what-patch: * what-patch:
- Print a list of files that have been modified outside debian/. - Print a list of files that have been modified outside the
debian/ directory (LP: #174933).
- Add -h and -q options. - Add -h and -q options.
- Add proper exit values. - Add proper exit values.
* debian/control: * debian/control:

8
debian/control vendored
View File

@ -2,10 +2,10 @@ Source: ubuntu-dev-tools
Section: devel Section: devel
Priority: optional Priority: optional
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
Vcs-Bzr: https://launchpad.net/ubuntu-dev-tools/ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk
Vcs-Browser: http://codebrowse.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk/changes Vcs-Browser: http://codebrowse.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk/changes
Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5), python-all-dev (>= 2.4) Build-Depends: cdbs (>= 0.4.49), debhelper (>= 5), python-all-dev (>= 2.4)
Build-Depends-Indep: docbook2x, python-central (>= 0.5) Build-Depends-Indep: python-central (>= 0.5)
XS-Python-Version: all XS-Python-Version: all
Homepage: https://launchpad.net/ubuntu-dev-tools/ Homepage: https://launchpad.net/ubuntu-dev-tools/
Standards-Version: 3.7.3 Standards-Version: 3.7.3
@ -13,8 +13,8 @@ Standards-Version: 3.7.3
Package: ubuntu-dev-tools Package: ubuntu-dev-tools
Architecture: all Architecture: all
Section: devel Section: devel
Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), reportbug (>= 3.39ubuntu1), python-debian, dctrl-tools, lsb-release Depends: ${python:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), python-debian, dctrl-tools, lsb-release
Recommends: bzr, pbuilder Recommends: bzr, pbuilder, reportbug (>= 3.39ubuntu1)
Conflicts: devscripts (<< 2.10.7ubuntu5) Conflicts: devscripts (<< 2.10.7ubuntu5)
Replaces: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5)
XB-Python-Version: ${python:Versions} XB-Python-Version: ${python:Versions}

15
debian/copyright vendored
View File

@ -1,7 +1,8 @@
This package was re-debianized by Daniel Holbach <daniel.holbach@ubuntu.com> on This package was re-debianized by Daniel Holbach <daniel.holbach@ubuntu.com> on
Fri, 01 Jun 2007 11:30:08 +0200. Fri, 01 Jun 2007 11:30:08 +0200.
Upstream Author: Upstream Authors:
Albert Damen <albrt@gmx.net> Albert Damen <albrt@gmx.net>
Albin Tonnerre <lut1n.tne@gmail.com> Albin Tonnerre <lut1n.tne@gmail.com>
Daniel Hahler <ubuntu@thequod.de> Daniel Hahler <ubuntu@thequod.de>
@ -18,18 +19,18 @@ Upstream Author:
Steve Kowalik <stevenk@ubuntu.com> Steve Kowalik <stevenk@ubuntu.com>
Terence Simpson <stdin@stdin.me.uk> Terence Simpson <stdin@stdin.me.uk>
Copyright: Copyright:
Copyright 2006-2007 (C) Canonical Ltd.
Canonical Ltd. 2006-2008
Albert Damen <albrt@gmx.net> 2007 Albert Damen <albrt@gmx.net> 2007
Albin Tonnerre <lut1n.tne@gmail.com> 2006-2007 Albin Tonnerre <lut1n.tne@gmail.com> 2006-2007
Daniel Holbach <daniel.holbach@ubuntu.com> 2006-2007 Daniel Holbach <daniel.holbach@ubuntu.com> 2006-2007
Luke Yelavich <themuso@ubuntu.com> 2006-2007 Luke Yelavich <themuso@ubuntu.com> 2006-2007
Martin Pitt <martin.pitt@ubuntu.com> 2007 Martin Pitt <martin.pitt@ubuntu.com> 2007
Michael Bienia <geser@ubuntu.com> 2006-2007 Michael Bienia <geser@ubuntu.com> 2006-2007
Kees Cook <kees@ubuntu.com> 2006-2007 Kees Cook <kees@ubuntu.com> 2006-2008
Pete Savage <petesavage@ubuntu.com> 2006-2007 Pete Savage <petesavage@ubuntu.com> 2006-2007
Siegfried-A. Gevatter <rainct@ubuntu.com> 2007 Siegfried-A. Gevatter <rainct@ubuntu.com> 2007-2008
Terence Simpson <stdin@stdin.me.uk> 2007 Terence Simpson <stdin@stdin.me.uk> 2007
Licenses: Licenses:
@ -50,8 +51,8 @@ update-maintainer and what-patch are licensed under GPLv2:
On Debian systems, the complete text of the GNU General Public License v2 On Debian systems, the complete text of the GNU General Public License v2
can be found in `/usr/share/common-licenses/GPL-2'. can be found in `/usr/share/common-licenses/GPL-2'.
get-branches, get-build-deps, massfile andsuspicious-source are licensed get-branches, get-build-deps, massfile, ppaput and suspicious-source
under GPLv3: are licensed under GPLv3:
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

1
debian/pycompat vendored
View File

@ -1 +0,0 @@
2

13
debian/rules vendored
View File

@ -1,18 +1,11 @@
#!/usr/bin/make -f #!/usr/bin/make -f
DEB_PYTHON_SYSTEM := pycentral DEB_PYTHON_SYSTEM := pycentral
include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk include /usr/share/cdbs/1/class/python-distutils.mk
DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1
build/ubuntu-dev-tools:: binary-install/ubuntu-dev-tools::
docbook2x-man doc/ppaput.1.docbook; mv ppaput.1 doc rm -rf debian/ubuntu-dev-tools/usr/lib
install/ubuntu-dev-tools::
mkdir -p debian/ubuntu-dev-tools/etc/bash_completion.d/
cp -v pbuilder-dist.bash_completion debian/ubuntu-dev-tools/etc/bash_completion.d/pbuilder-dist
clean::
rm -f doc/ppaput.1

3
debian/source.lintian-overrides vendored Normal file
View File

@ -0,0 +1,3 @@
# Override useless NMU warnings; this is a native Ubuntu package.
ubuntu-dev-tools source: changelog-should-mention-nmu
ubuntu-dev-tools source: source-nmu-has-incorrect-version-number

1
debian/ubuntu-dev-tools.install vendored Normal file
View File

@ -0,0 +1 @@
bash_completion/* etc/bash_completion.d/

138
dgetlp
View File

@ -1,7 +1,20 @@
#!/bin/bash #!/bin/bash
# Copyright 2007 (C) Terence Simpson <stdin@stdin.me.uk> # Copyright (C) 2008 Terence Simpson <tsimpson@ubuntu.com>
# Modified by Siegfried-A. Gevatter <rainct@ubuntu.com> # Modified by Siegfried-A. Gevatter <rainct@ubuntu.com>
# License: GPLv2 or later # License:
# 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 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.
# #
# This script simulates «dget»'s behaviour for files hosted at # This script simulates «dget»'s behaviour for files hosted at
# launchpadlibrarian.net. # launchpadlibrarian.net.
@ -15,6 +28,7 @@
GET="wget" GET="wget"
UNPACK="dpkg-source -x {dsc-file}" UNPACK="dpkg-source -x {dsc-file}"
DIRECT_TO_NULL="/dev/null"
usage() usage()
{ {
@ -24,27 +38,41 @@ Usage: $0 [-d] <Launchpad URL>
This scripts simulates «dget»'s behaviour for files hostead at This scripts simulates «dget»'s behaviour for files hostead at
launchpadlibrarian.net. launchpadlibrarian.net.
If you specify the -d option then it won't do anything, but just If you specify the -d option then it won't do anything, except download the
print the commands it would run otherwise. .dsc file, but just print the commands it would run otherwise.
Example: Example:
$0 http://launchpadlibrarian.net/10348157/coreutils_5.97-5.4ubuntu1.dsc $(basename $0) http://launchpadlibrarian.net/10348157/coreutils_5.97-5.4ubuntu1.dsc
EOF EOF
} }
if [ $1 ] && [ $1 = "-d" ] || [ $1 = "--debug" ] while [ $# -ne 1 ]; do
then case "$1" in
# Debug Mode -d|--debug)
GET="echo "${GET} # Debug Mode
UNPACK="echo "${UNPACK} OUTPUT="/tmp/"
shift GET="echo ${GET}"
fi UNPACK="echo ${UNPACK}"
shift
if [ $1 ] && [ $1 = "-h" ] || [ $1 = "--help" ] ;;
then -v|--verbose)
usage DIRECT_TO_NULL="$(tty)"
exit 0 shift
fi ;;
-h|--help)
usage
exit 0
;;
-*)
echo "Unknown option: \`$1'"
usage >&2
exit 1
;;
*)
break
;;
esac
done
if [ $# -ne 1 ] if [ $# -ne 1 ]
then then
@ -52,6 +80,43 @@ then
exit 1 exit 1
fi fi
## internal functions
getBase() {
echo "Getting ${BASE}/${NUMBER}/${FILE}"
if [ -f "$FILE" ]; then rm -f $FILE; fi # Remove .dsc incase the last run was with debug
if ! wget ${BASE}/${NUMBER}/${FILE} -O ${OUTPUT}${FILE} 2>${DIRECT_TO_NULL}
then
echo "Failed to fetch «.dsc» file, aborting."
exit 1
fi
}
getUrl() {
if [ -f "$2" ]
then
##Todo: Check the md5sum in the .dsc to see if we should redownload or not
echo "Skipping already downloaded ${2}"
return 0
fi
echo "Getting ${1}${2}"
if ! $GET ${1}${2} 2>$DIRECT_TO_NULL
then
echo "Failed to fetch «${3}»"
exit 1
fi
}
unpack() {
if ! $UNPACK
then
echo "Failed to unpack source, aborting."
exit 1
fi
}
## begin #!/bin/bash
# Store download URL into a local variable to be able to modify it # Store download URL into a local variable to be able to modify it
URL=$1 URL=$1
@ -77,35 +142,28 @@ then
exit 1 exit 1
fi fi
BASE="http://launchpadlibrarian.net" #BASE="http://$(echo $URL|cut -d '/' -f 3)" #BASE="http://$(echo $URL|cut -d '/' -f 3)" #Not needed as we know the base URL
BASE="http://launchpadlibrarian.net"
NUMBER="$(echo $URL|cut -d '/' -f 4)" NUMBER="$(echo $URL|cut -d '/' -f 4)"
FILE="$(echo $URL|cut -d '/' -f 5)" FILE="$(echo $URL|cut -d '/' -f 5)"
UNPACK=$(echo $UNPACK | sed s/{dsc-file}/${FILE}/g) UNPACK=$(echo $UNPACK | sed s/{dsc-file}/${FILE}/g)
echo "Getting ${BASE}/${NUMBER}/${FILE}" if [ -f "$FILE" ]; then rm -f $FILE; fi
if ! $GET ${BASE}/${NUMBER}/${FILE} getBase;
PkgVersion="$(grep -B100 "^Files:" ${OUTPUT}${FILE}|grep "^Version:"|cut -d' ' -f2)"
PkgName="$(grep -B100 "^Files:" ${OUTPUT}${FILE}|grep "^Source:"|cut -d' ' -f2)"
if $(echo ${PkgVersion} | grep '-' >/dev/null)
then then
echo "Failed to fetch «.dsc» file, aborting." getUrl ${BASE}/$((${NUMBER}-1))/ "$(echo $FILE|sed 's,\.dsc,.diff.gz,')" "diff.gz"
exit 1 getUrl ${BASE}/$((${NUMBER}-2))/ "${PkgName}_$(echo ${PkgVersion}|sed 's,-[0-9]*[a-z]*[0-9]*,.orig.tar.gz,')" "orig.tar.gz"
else
getUrl ${BASE}/$((${NUMBER}-1))/ "${PkgName}_${PkgVersion}.tar.gz" "tar.gz"
fi fi
echo "Getting ${BASE}/$(($NUMBER-1))/$(echo $FILE|sed 's,\.dsc$,.diff.gz,')" if [ "x${OUTPUT}" != "x" ]
if ! $GET ${BASE}/$(($NUMBER-1))/$(echo $FILE | sed 's,\.dsc$,.diff.gz,') then rm -f ${OUTPUT}${FILE}
then
echo "Failed to fetch «.diff.gz» file, aborting."
exit 1
fi fi
echo "Getting ${BASE}/$(($NUMBER-2))/$(echo $FILE|sed 's,\-[0-9]*.*$,.orig.tar.gz,')" unpack;
if ! $GET ${BASE}/$(($NUMBER-2))/$(echo $FILE|sed 's,\-[0-9]*.*$,.orig.tar.gz,')
then
echo "Failed to fetch «orig.tar.gz» file, aborting."
exit 1
fi
if ! $UNPACK
then
echo "Failed to unpack source, aborting."
exit 1
fi

29
doc/404main.1 Normal file
View File

@ -0,0 +1,29 @@
.TH 404main 1 "February 17, 2008" "ubuntu-dev-tools"
.SH NAME
404main \- check if all build dependencies of a package are in main
.SH SYNOPSIS
\fB404main\fP <\fIpackage name\fP> [<\fIdistribution\fP>]
.SH DESCRIPTION
\fB404main\fP is a script that can be used to check if a package and
all its build dependencies are in Ubuntu's main component or not.
.SH CAVEATS
\fB404main\fP will take the dependencies and build dependencies of the
packages from the distribution you have first in your
/etc/apt/sources.list file.
.PP
Also, because of this the <\fIdistribution\fP> option is NOT trustful, if
the dependencies changed YOU WILL GET INCORRECT RESULTS.
.SH SEE ALSO
.BR apt-cache (8)
.SH AUTHORS
\fB404main\fP was written by Pete Savage <petesavage@ubuntu.com> and
this manpage by Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>.
.PP
Both are released under the GNU General Public License, version 2 or
later.

View File

@ -1,19 +1,11 @@
.\" Title: check-symbols
.\" Author: Albert Damen
.\" Contact details: albrt@gmx.net
.\"
.\" Copyright (C), 2007, Albert Damen
.\"
.\" Permission is granted to copy, distribute and/or modify this document under
.\" the terms of the GNU General Public License version 2.
.\"
.TH "CHECK\-SYMBOLS" "1" "December 9, 2007" "ubuntu-dev-tools" .TH "CHECK\-SYMBOLS" "1" "December 9, 2007" "ubuntu-dev-tools"
.SH "NAME" .SH "NAME"
check\-symbols \- verify symbols exported by a new library version check\-symbols \- verify symbols exported by a new library version
.\"
.SH "SYNOPSIS" .SH "SYNOPSIS"
\fBcheck\-symbols\fP <\fIsource\-package\fR\> [\fIDEBDIR\fR] \fBcheck\-symbols\fP <\fIsource\-package\fR\> [\fIDEBDIR\fR]
.\"
.SH "DESCRIPTION" .SH "DESCRIPTION"
To verify the symbols exported by a new library version, run To verify the symbols exported by a new library version, run
\fBcheck-symbols\fP with the name of the source package as argument. \fBcheck-symbols\fP with the name of the source package as argument.
@ -32,9 +24,8 @@ the exported symbols of the libraries.
.PP .PP
If no value is given for DEBDIR, the script will assume the new library If no value is given for DEBDIR, the script will assume the new library
deb files are stored in /var/cache/pbuilder/result. deb files are stored in /var/cache/pbuilder/result.
.\"
.SH "EXAMPLES" .SH "EXAMPLES"
.TP
\fBcheck\-symbols\fP telepathy-glib . \fBcheck\-symbols\fP telepathy-glib .
.TP .TP
This will: This will:
@ -51,12 +42,17 @@ output of the old version.
.TP 2 .TP 2
\(bu List the result in diff format. \(bu List the result in diff format.
.RE .RE
.\"
.SH "BUGS" .SH "BUGS"
.nf .nf
Please report bugs on: Please report bugs on:
https://bugs.launchpad.net/ubuntu/+source/ubuntu\-dev\-tools/ https://bugs.launchpad.net/ubuntu/+source/ubuntu\-dev\-tools/
.fi .fi
.\"
.SH "SEE ALSO" .SH "SEE ALSO"
.BR nm (1) .BR nm (1)
.SH "AUTHOR"
\fBcheck\-symbols\fP was written by Daniel Holbach <daniel.holbach@ubuntu.com>
and this manpage by Albert Damen <albrt@gmx.net>. Both are licensed
under the GNU General Public License, version 2.

View File

@ -1,7 +1,3 @@
.\" Title: get-build-deps
.\" Author: Siegfried-Angel Gevatter Pujals
.\" Contact details: rainct@ubuntu.com
.TH GET\-BUILD\-DEPS 1 "October 27, 2007" "ubuntu-dev-tools" .TH GET\-BUILD\-DEPS 1 "October 27, 2007" "ubuntu-dev-tools"
.SH NAME .SH NAME
@ -11,28 +7,28 @@ get\-build\-deps \- install build dependencies for one or more packages
\fBget\-build\-deps\fP [\fIpackage name\fR] \fBget\-build\-deps\fP [\fIpackage name\fR]
.SH DESCRIPTION .SH DESCRIPTION
\fBget\-build\-deps\fP is a script to install the build dependencies for either a \fBget\-build\-deps\fP is a script to install the build dependencies for
local source package or one or more packages from the repositories. either a local source package or one or more packages from the repositories.
.PP .PP
In order to obtain all missing build dependencies for a package on which source In order to obtain all missing build dependencies for a package on
you are currently working, just run this script without any argument, and it'll which source you are currently working, just run this script without
read its debian/control file to determine the missing build dependencies. any argument, and it'll read its debian/control file to determine the
missing build dependencies.
.PP .PP
Alternatively, you can call it with a list of space-separated package names, or the Alternatively, you can call it with a list of space-separated package
name of a single file which contains the package names each on a line. names, or the name of a single file which contains the package names
Then it will install the missing dependencies for those packages using each on a line. Then it will install the missing dependencies for those
"apt-get build-dep". packages using "apt-get build-dep".
.SH EXAMPLES .SH EXAMPLES
.TP .TP
get\-build\-deps get\-build\-deps
Looks for a debian/control file in the current working directory and installs the Looks for a debian/control file in the current working directory and
dependencies listed there. installs the dependencies listed there.
.TP .TP
get\-build\-deps geany get\-build\-deps geany
Installs the build dependencies for the version of Installs the build dependencies for the version of \fBgeany\fP that's
.B geany in the repositories.
that's in the repositories.
.TP .TP
get\-build\-deps geany epiphany-browser rhythmbox get\-build\-deps geany epiphany-browser rhythmbox
Same as the previous example but also with the dependencies for Same as the previous example but also with the dependencies for
@ -44,19 +40,20 @@ get\-build\-deps ./package_list.txt
Reads the file Reads the file
.B package_list.txt .B package_list.txt
(relative to the current working directory), (relative to the current working directory),
where each line contains the name of a package, and installs the dependencies where each line contains the name of a package, and installs the
for the versions of all those that are in the repositories. dependencies for the versions of all those that are in the repositories.
.SH KNOWN BUGS AND LIMITATIONS .SH KNOWN BUGS AND LIMITATIONS
When it's being used to install the missing dependencies for a local source package When it's being used to install the missing dependencies for a local
(i.e., no arguments are passed to it) it doesn't check for the dependencies to match source package (i.e., no arguments are passed to it) it doesn't check
the indicated versions, but just installs the newest one available in the repositories. for the dependencies to match the indicated versions, but just installs
the newest one available in the repositories.
.SH SEE ALSO .SH SEE ALSO
.BR dpkg-checkbuilddeps (1), .BR dpkg-checkbuilddeps (1),
.BR apt-get (8) .BR apt-get (8)
.SH AUTHORS
.SH AUTHORS
\fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel \fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel
Gevatter Pujals <rainct@ubuntu.com>. Gevatter Pujals <rainct@ubuntu.com>. They are released under the GNU General Public
They are released under the GNU General Public License, version 3 or later. License, version 3 or later.

View File

@ -0,0 +1,49 @@
.TH PBUILDER\-DIST 1 "February 25, 2008" "ubuntu-dev-tools"
.SH NAME
pbuilder\-dist\-simple \- simple multi-distribution pbuilder wrapper
.SH SYNOPSIS
\fBpbuilder\-\fI<dist>\fR\fP \fIoperation\fR [\fI...\fR]
.SH DESCRIPTION
\fBpbuilder\-dist\fP is a wrapper that makes it easy to use pbuilder with
chroots for many different Ubuntu/Debian distributions. If you need more
features than \fBpbuilder\-dist\-simple\fP provides, have a look at
\fBpbuilder\-dist\fP.
.SH USAGE
Create one symlink to \fBpbuilder\-dist\-simple\fP for each distribution
for which you want a build environment, naming them like "pbuilder-hardy",
"pbuilder-gutsy", etc.
.PP
Replace \fIoperation\fP with the action you want \fBpbuilder\-dist\-simple\fP
to do (create, update, build, clean, login or execute).
.SH EXAMPLES
.TP
pbuilder\-gutsy create
Creates a \fBpbuilder\fP environment for Ubuntu Gutsy.
.TP
pbuilder\-sid update
Updates an existing Debian Sid environment.
.TP
pbuilder\-hardy build ./sample_1.0\-0ubuntu1.dsc
Builds the specified package on an already existing Ubuntu Hardy environment.
.SH FILES
By default, \fBpbuilder\-dist\-simple\fP will store all the files it
generates in \fB~/pbuilder/\fP. This can be changed by modifying the
BASE_DIR value on the top of the script to any other directory you want.
If the directory doesn't exit, it will be created at runtime.
.SH SEE ALSO
\fBpbuilder\fR, \fBpbuilderrc\fR
.SH AUTHORS
\fBpbuilder\-dist\fP was originally written by Jamin W. Collins
<jcollins@asgardsrealm.net> and Jordan Mantha <mantha@ubuntu.com>, and
this manpage by Siegfried-A. Gevatter <rainct@ubuntu.com>.
.PP
Both are released under the GNU General Public License, version 2 or
later.

View File

@ -1,7 +1,3 @@
.\" Title: pbuilder-dist
.\" Author: Siegfried-Angel Gevatter Pujals
.\" Contact details: rainct@ubuntu.com
.TH PBUILDER\-DIST 1 "August 16, 2007" "ubuntu-dev-tools" .TH PBUILDER\-DIST 1 "August 16, 2007" "ubuntu-dev-tools"
.SH NAME .SH NAME

View File

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
]>
<refentry>
<refentryinfo>
<author>
<firstname>Daniel</firstname>
<surname>Holbach</surname>
<email>daniel.holbach@ubuntu.com</email>
</author>
<copyright>
<year>2007</year>
<holder>Daniel Holbach</holder>
</copyright>
<!-- XXX IMPORTANT XXX -->
<!-- Keep this date up to date: -->
<date>2007-09-07</date>
<!-- ^^^^^^^^^^ -->
</refentryinfo>
<refmeta>
<refentrytitle>ppaput</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>ppaput</refname>
<refpurpose>A tool for uploading packages for sponsorship</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>ppaput</command>
<arg choice="opt">
<option>-n</option>
</arg>
<arg choice="opt">
<option>&lt;dput location&gt;</option>
</arg>
<arg choice="opt">
<option>&lt;debuild arguments&gt;</option>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>PREREQUISITES</title>
<para>
To use this tool, you will need to set up your PPA in Launchpad and
therefore carefully follow the instructions in the <ulink type="http"
url="https://help.launchpad.net/PPAQuickStart">PPA documentation</ulink>.
</para>
<para>
Also you need to copy your Launchpad cookie to
<filename>~/.lpcookie</filename>. Firefox uses
<filename>~/.mozilla/firefox/&lt;random&gt;cookies.txt</filename>,
Epiphany uses
<filename>~/.gnome2/epiphany/mozilla/epiphany/cookies.txt</filename>.
</para>
</refsect1>
<refsect1>
<title>OVERVIEW</title>
<para>
This tool aims to help with <ulink type="http"
url="https://wiki.ubuntu.com/SponsorshipProcess">the sponsoring
process</ulink> and is written by the MOTU team.
</para>
<para>
This tool will 1) build a source package of the current source tree
you're in, 2) upload the package to &lt;<productname>dput</productname>
location&gt; (using 'default' if not specified), 3) follow up on the bug
report (if specified in <filename>debian/changelog</filename> as per the
<ulink type="http"
url="https://wiki.ubuntu.com/ClosingBugsFromChangelog">changelog
spec</ulink>), 4) set the right status and subscribe the right people to
the bug report.
</para>
<para>
If you use the <arg choice="opt"><option>-n</option></arg> option, it
will also 1) file a bug and add 2) a (LP: #.....) header to the source
package.
</para>
<para>
<ulink type="http" url="https://wiki.ubuntu.com/SponsorshipProcess">The
sponsoring process</ulink> was complicated enough and package uploads
were done to either <productname>Malone</productname>,
<productname>REVU</productname> or personal web servers. This tool aims
to unify processes and make use of existing infrastructure such as
<productname>Launchpad Bugs (Malone)</productname> and
<productname>Launchpad PPA</productname>.
In September 2007, Daniel Holbach started working on this tool.
</para>
</refsect1>
<refsect1>
<title>DESCRIPTION</title>
<para>
This tool has lists of known strings for a given package that
it searches for in bug reports (even in the attachments uploaded),
thus helping to find duplicates, related bugs and other information,
but mainly making bug triagers job a lot easier.
</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<para>
These are all the options available so far:
</para>
<para>
<variablelist>
<title>ppaput options:</title>
<varlistentry>
<term><option>-n</option></term>
<listitem><para>files a new bug report and adds its number to
<filename>debian/changelog</filename>
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>&lt;dput location&gt;</option></term>
<listitem><para>specifies the location you upload the source package
to according to the alias you specified in either
<filename>/etc/dput.cf</filename> or
<filename>~/.dput.cf</filename></para></listitem>
</varlistentry>
<varlistentry>
<term><option>&lt;debuild arguments&gt;</option></term>
<listitem><para>will be passed to <productname>debuild</productname>
during source package creation
</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
<title>COPYRIGHT</title>
<para>
This manual page was written by the MOTU team for the
<productname>revutool</productname> bug tracking system.
Permission is granted to copy, distribute and/or modify this document
under the terms of the <acronym>GNU</acronym> General Public License,
Version 3 or any later version published by the Free Software Foundation.
</para>
<para>
On Debian systems (like Ubuntu), the complete text of the
GNU General Public License can be found in
<filename>/usr/share/common-licenses/GPL-3</filename>.
</para>
</refsect1>
</refentry>

View File

@ -1,30 +1,27 @@
.\" Title: suspicious-source
.\" Author: Siegfried-Angel Gevatter Pujals
.\" Contact details: rainct@ubuntu.com
.\"
.TH SUSPICIOUS\-SOURCE 1 "September 14, 2007" "ubuntu-dev-tools" .TH SUSPICIOUS\-SOURCE 1 "September 14, 2007" "ubuntu-dev-tools"
.\"
.SH NAME .SH NAME
suspicious\-source \- search for files that are not the GPL's "preferred form of modification" suspicious\-source \- search for files that are not the GPL's
.\" "preferred form of modification"
.SH SYNOPSIS .SH SYNOPSIS
\fBsuspicious\-source\fP \fBsuspicious\-source\fP
.\"
.SH DESCRIPTION .SH DESCRIPTION
\fBsuspicious\-source\fP is a script that outputs a list of files which are not common source files. \fBsuspicious\-source\fP is a script that outputs a list of files which
This should be run in the root of a source tree to find files which might not be the "preferred form of modification" are not common source files. This should be run in the root of a source
tree to find files which might not be the "preferred form of modification"
that the GPL and other licenses require. that the GPL and other licenses require.
.PP .PP
Neither the files inside version control system directories (like ".bzr/" or "CVS/"), nor those inside "debian/" are Neither the files inside version control system directories (like
considered. ".bzr/" or "CVS/"), nor those inside "debian/" are considered.
.\"
.SH AUTHORS
\fBsuspicious\-source\fP has been written by Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>, based upon
a script with the same name, by Martin Pitt <martin.pitt@ubuntu.com>.
.\"
.SH SEE ALSO .SH SEE ALSO
.BR find (1) .BR find (1)
.\"
.SH COPYRIGHT .SH AUTHORS
This manual page was written by Siegfried-Angel Gevatter Pujals (RainCT). \fBsuspicious\-source\fP and this manpage have been written by
It is released under the GNU General Public License, version 2 or later. Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>, based upon a
script with the same name from Martin Pitt <martin.pitt@ubuntu.com>.
.PP
Both are released under the GNU General Public License, version 3 or later.

34
doc/update-maintainer.1 Normal file
View File

@ -0,0 +1,34 @@
.TH UPDATE\-MAINTAINER "1" "February 17, 2008" "ubuntu-dev-tools"
.SH NAME
update\-maintainer \- change Maintainer field in a Debian source package
.SH SYNOPSIS
.B update\-maintainer [\fI\-\-path=<PATH>\fR] [\fI\-\-section=<SECTION>\fR] [\fI\-\-nochangelog\fR]
.SH DESCRIPTION
\fBupdate\-maintainer\fP updates the Maintainer field in the source of
an Ubuntu package to match the DebianMaintainerField specification.
.PP
See https://wiki.ubuntu.com/DebianMaintainerField for more information.
.SH OPTIONS
.TP
\fB\-\-path=<PATH>\fP
This option allows you to specify the path to the source directory.
.TP
\fB\-\-section=<SECTION>\fP
Manually specify the section of the package. This is necessary if the
package is not yet in the archive or if you don't have an Internet
connection available when you run \fBupdate\-maintainer\fP.
.TP
\fB\-\-nochangelog\fP, \fB\-\-no\-changelog\fP
By default, \fBupdate\-maintainer\fP adds an entry to the changelog
explaining that it changed the Maintainer field. If you don't want
that to happen, use this option.
.SH AUTHOR
\fBupdate-maintainer\fP has been written by Albin Tonnerre <lut1n.tne@gmail.com>
and this manual page by Siegfried-Angel Gevatter Pujals <rainct@ubuntu.com>.
.PP
Both are released under the GNU General Public License, version 2.

View File

@ -26,7 +26,7 @@ then
cd .. cd ..
elif [ ! -f ./debian/control ]; then elif [ ! -f ./debian/control ]; then
echo "\ echo "\
Couldn't find the file debian/control. You have to be inside the \ Couldn't find file debian/control. You have to be inside the \
source directory of a Debian package or pass the name of the \ source directory of a Debian package or pass the name of the \
package(s) whose build dependencies you want to install in order \ package(s) whose build dependencies you want to install in order \
to use this script." to use this script."

37
grab-attachments Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/python
#
# Copyright 2007, Canonical, Daniel Holbach
#
# GPL 3
#
import os
import sys
import urllib
import launchpadbugs.connector as Connector
USAGE = "grab-attachments <bug numbers>"
def main():
if len(sys.argv) == 1:
print >> sys.stderr, USAGE
sys.exit(1)
if sys.argv[1] in ["--help", "-h"]:
print USAGE
sys.exit(0)
Bug = Connector.ConnectBug(method="Text")
for arg in sys.argv[1:]:
try:
number = int(arg)
except:
print >> sys.stderr, "'%s' is not a valid bug number." % arg
sys.exit(1)
b = Bug(number)
for a in b.attachments:
filename = os.path.join(os.getcwd(), a.url.split("/")[-1])
urllib.urlretrieve(a.url, filename)
if __name__ == '__main__':
main()

View File

@ -20,7 +20,7 @@
# detect the chroot architecture: # detect the chroot architecture:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392992 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392992
# #
# Version: 0.11 # Version: 0.12
set -e set -e
@ -87,6 +87,7 @@ function usage()
echo "Options:" echo "Options:"
echo " --arch=ARCH What architecture to select" echo " --arch=ARCH What architecture to select"
echo " --name=NAME Base name for the schroot (arch is appended)" echo " --name=NAME Base name for the schroot (arch is appended)"
echo " --personality=PERSONALITY What personality to use (defaults to match --arch)"
echo " --debug Turn on script debugging" echo " --debug Turn on script debugging"
echo " --source-template=FILE Use FILE as the sources.list template" echo " --source-template=FILE Use FILE as the sources.list template"
echo " --debootstrap-mirror=URL Use URL as the debootstrap source" echo " --debootstrap-mirror=URL Use URL as the debootstrap source"
@ -97,7 +98,7 @@ function usage()
if [ -z "$1" ]; then if [ -z "$1" ]; then
usage usage
fi fi
OPTS=`getopt -o '' --long "help,debug,arch:,name:,source-template:,debootstrap-mirror:" -- "$@"` OPTS=`getopt -o '' --long "help,debug,arch:,name:,source-template:,debootstrap-mirror:,personality:" -- "$@"`
eval set -- "$OPTS" eval set -- "$OPTS"
name="" name=""
@ -111,6 +112,14 @@ while :; do
# By default, use the native architecture. # By default, use the native architecture.
arch_opt="--arch $2" arch_opt="--arch $2"
arch_suffix="-$2" arch_suffix="-$2"
if [ -z "$personality" -a "$2" = "i386" ]
then
personality="linux32"
fi
shift 2
;;
--personality)
personality="$2"
shift 2 shift 2
;; ;;
--name) --name)
@ -223,6 +232,9 @@ run-setup-scripts=true
run-exec-scripts=true run-exec-scripts=true
EOM EOM
fi fi
if [ ! -z "$personality" ]; then
echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
fi
cat "$TEMP_SCHROOTCONF" | sed \ cat "$TEMP_SCHROOTCONF" | sed \
-e "s|CHROOT_NAME|$CHROOT_NAME|g" \ -e "s|CHROOT_NAME|$CHROOT_NAME|g" \
-e "s|CHROOT_PATH|$CHROOT_PATH|g" \ -e "s|CHROOT_PATH|$CHROOT_PATH|g" \

View File

@ -1,271 +1,318 @@
#!/bin/sh #! /usr/bin/env python
# Copyright by: # -*- coding: utf-8 -*-
# Jamin W. Collins <jcollins@asgardsrealm.net> #
# Jordan Mantha <mantha@ubuntu.com> # Copyright (C) 2007-2008 Siegfried-A. Gevatter <rainct@ubuntu.com>
# Siegfried-A. Gevatter <rainct@ubuntu.com> # Based upon pbuilder-dist-simple by Jamin Collins and Jordan Mantha.
#
# License: GPLv2 or later # License: GPLv2 or later
# #
# This script is a wrapper to use pbuilder with many different # This script is a wrapper to be able to easily use pbuilder for
# distributions / versions. (It was originally created because of # different distributions (eg, Gutsy, Hardy, Debian unstable, etc).
# bug #255165 in Debian.)
# #
# If you want to use this copy of the script only for a single distribution # You can create symlinks to a pbuilder-dist executable to get different
# / version, rename it to 'pbuilder-dapper', 'pbuilder-feisty', 'pbuilder-gutsy', # configurations. For example, a symlink called pbuilder-hardy will assume
# or whatever it is. If you have an amd64, you can also use names like # that the target distribution is always meant to be Ubuntu Hardy.
# 'pbuilder-feisty-i386', etc.
# Base directory where pbuilder will put all the files it creates import sys
# This is overriden by the global variable $PBUILDFOLDER import os
BASE_DIR="$HOME/pbuilder"
# Enable additional components by default? (universe and multiverse in Ubuntu, class pbuilder_dist:
# contrib and non-free in Debian.)
EXTRACOMP=1
# Save the log of the last operation in a dot-file? ('.lastlog' in BASE_DIR) def __init__(self):
SAVELOG=0
# Allow this script to use /var/cache/apt/archives/ when possible # Base directory where pbuilder will put all the files it creates.
if [ -z $SYSCACHE ] self.base = None
then
SYSCACHE=1
fi
CALLDIR=`pwd` # Name of the operation which pbuilder should perform.
self.operation = None
# Wheter additional components should be used or not. That is,
# 'universe' and 'multiverse' for Ubuntu chroots and 'contrib'
# and 'non-free' for Debian.
self.extra_components = True
################################ # File where the log of the last operation will be saved.
self.logfile = None
ARCH=`dpkg-architecture -qDEB_HOST_ARCH` # System architecture
SYSDIST=`lsb_release -cs` self.system_architecture = None
if [ $PBUILDFOLDER ] && [ $PBUILDFOLDER != "" ] # Build architecture
then self.build_architecture = None
BASE_DIR=$PBUILDFOLDER
fi
help() # System's distribution
{ self.system_distro = None
echo "Insufficient number of arguments."
echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo "<distribution> " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] <operation>"
exit 1
}
if [ ! -z `echo \`basename $0\` | grep -- '-'` ] && [ `basename $0` != 'pbuilder-dist' ] # Target distribution
then self.target_distro = None
if [ $# -lt 1 ]
then
help
fi
BINARCH=`basename $0 | cut -f3 -d '-'` # This is an identificative string which will either take the form
DISTRIBUTION=`basename $0 | cut -f2 -d '-'` # 'distribution' or 'distribution-architecture'.
else self.chroot_string = None
if [ $# -lt 2 ]
then
help show-dist-flag
fi
DISTRIBUTION=$1 # Proxy
shift 1 self.proxy = None
fi
# Authentication method
self.auth = 'sudo'
if [ $1 = "i386" ] || [ $1 = "amd64" ] ##############################################################
then
if [ $ARCH = "amd64" ]; then
BINARCH=$1
else
echo "Warning: Architecture switching is not supported on your system; ignoring argument."
fi
shift 1 if 'PBUILDFOLDER' in os.environ:
fi self.base = os.environ['PBUILDFOLDER']
else:
self.base = os.path.expanduser('~/pbuilder/')
if 'PBUILDAUTH' in os.environ:
self.auth = os.environ['PBUILDAUTH']
if [ $1 = "mainonly" ]; then self.system_architecture = host_architecture()
EXTRACOMP=0
shift 1
elif [ $1 = "allcomp" ]; then
EXTRACOMP=1
shift 1
fi
if not self.system_architecture or 'not found' in self.system_architecture:
print 'Error: Not running on a Debian based system; could not detect its architecture.'
if [ $1 = "withlog" ]; then if not os.path.isfile('/etc/lsb-release'):
SAVELOG=1 print 'Error: Not running on a Debian based system; could not find /etc/lsb-release.'
shift 1 exit(1)
elif [ $1 = "nolog" ]; then
SAVELOG=0
shift 1
fi
for line in open('/etc/lsb-release'):
line = line.strip()
if line.startswith('DISTRIB_CODENAME'):
self.system_distro = line[17:]
break
distdata() if not self.system_distro:
{ print 'Error: Could not determine what distribution you are running.'
if [ "$1" = "debian" ] exit(1)
then
# Set Debian specific data
ISDEBIAN=True
if [ -z $ARCHIVE ]
then
ARCHIVE="http://ftp.debian.org"
fi
COMPONENTS="main"$( [ $EXTRACOMP = 0 ] || echo " contrib non-free" )
else
# Set Ubuntu specific data
ISDEBIAN=False
if [ -z $ARCHIVE ]
then
ARCHIVE="http://archive.ubuntu.com/ubuntu"
fi
COMPONENTS="main restricted"$( [ $EXTRACOMP = 0 ] || echo " universe multiverse" )
fi
}
self.target_distro = self.system_distro
case $DISTRIBUTION in if 'http_proxy' in os.environ:
dapper|edgy|feisty|gutsy|hardy) # warty|hoary|breezy self.base = os.environ['http_proxy']
distdata ubuntu elif 'HTTP_PROXY' in os.environ:
;; self.base = os.environ['HTTP_PROXY']
oldstable|sarge|stable|etch|testing|lenny|unstable|sid|experimental) ##############################################################
distdata debian
;;
*) def __getitem__(self, name):
if [ ! -d $BASE_DIR/${DISTRIBUTION}-* ]
then
echo -n "Warning: Unknown distribution «$DISTRIBUTION». Do you want to continue [y/N]? "
read continue
if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ] return getattr(self, name)
then
echo "Aborting..."
exit 1
fi
fi
distdata
;;
esac
def _calculate(self):
""" pbuilder_dist.calculate(distro) -> None
OPERATION=$1 Do all necessary variable changes (and therefore required checks)
before the string that will be executed is generated. At this
point it's expected that no more variables will be modified
outside this class.
case $OPERATION in """
create|update|build|clean|login|execute)
shift 1
;;
*) if not self.build_architecture:
if [ ${1##*.} = 'dsc' ] self.chroot_string = self.target_distro
then self.build_architecture = self.system_architecture
OPERATION=build else:
else self.chroot_string = '%(target_distro)s-%(build_architecture)s' % self
echo "Unrecognized argument. Please use one of those:"
echo " create"
echo " update"
echo " build"
echo " clean"
echo " login"
echo " execute"
exit 1
fi
;;
esac
FOLDERBASE="${DISTRIBUTION}-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )" if not self.logfile:
self.logfile = '%(base)s/.%(chroot_string)s.log' % self
if [ ! -d $BASE_DIR/${FOLDERBASE}_result ] def set_target_distro(self, distro):
then """ pbuilder_dist.set_target_distro(distro) -> None
mkdir -p $BASE_DIR/${FOLDERBASE}_result
fi
if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ] Check if the given target distribution name is correct, if it
then isn't know to the system ask the user for confirmation before
DEBCACHE='/var/cache/apt/archives/' proceeding, and finally either save the value into the appropiate
fi variable or finalize pbuilder-dist's execution.
"""
# Check what version of pbuilder is installed, and if if not distro.isalpha():
# it's supported, use the --components option print 'Error: «%s» is an invalid distribution codename.'
if dpkg --compare-versions $(dpkg-query -W -f='${Version}' pbuilder) ge 0.174 sys.exit(1)
then
COMPONENTS_LINE="--othermirror \"\" --components \"$COMPONENTS\""
else
# else, do it the old way
if [ $ISDEBIAN = True ]; then
echo "Warning: If this operation fails it might be because you changed the value of $COMPONENTS in the pbuilderrc file."
echo "See https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools/+bug/140964 for more information."
fi
COMPONENTS_LINE="--othermirror \"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\""
fi
if [ -n $http_proxy ] || [ -n $HTTP_PROXY ] if not os.path.isfile(os.path.join('/usr/share/debootstrap/scripts/', distro)):
then answer = ask('Warning: Unknown distribution «%s». Do you want to continue [y/N]? ' % distro)
if [ -n $http_proxy ] if answer not in ('y', 'Y'):
then sys.exit(0)
PROXY=$http_proxy
else
PROXY=$HTTP_PROXY
fi
fi
self.target_distro = distro
if [ $ISDEBIAN = "False" ] def set_operation(self, operation):
then """ pbuilder_dist.set_operation -> None
if [ ! -d $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ ]
then
mkdir -p $BASE_DIR/etc/$DISTRIBUTION/apt.conf
fi
if [ ! -e $BASE_DIR/etc/$DISTRIBUTION/apt.conf/sources.list ]
then
echo "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" > $BASE_DIR/etc/$DISTRIBUTION/apt.conf/sources.list
case $DISTRIBUTION in
dapper|edgy|feisty|gutsy )
cat >> $BASE_DIR/etc/$DISTRIBUTION/apt.conf/sources.list <<EOF
deb $ARCHIVE $DISTRIBUTION-security $COMPONENTS
deb $ARCHIVE $DISTRIBUTION-updates $COMPONENTS
EOF
;;
* )
;;
esac
fi
fi
if [ -z $PBUILDAUTH ] Check if the given string is a valid pbuilder operation and
then depending on this either save it into the appropiate variable
if [ -n $DESKTOP_SESSION ] or finalize pbuilder-dist's execution.
then
case $DESKTOP_SESSION in
gnome )
SUDOREPLACE="gksudo -D \"Pbuilder\" "
;;
kde|kde4 )
SUDOREPLACE="kdesudo -d --comment \"Pbuilder\""
;;
* )
SUDOREPLACE="sudo"
;;
esac
else
SUDOREPLACE=sudo
fi
else
SUDOREPLACE=$PBUILDAUTH
fi
echo $@ """
$SUDOREPLACE -- pbuilder $OPERATION \ arguments = ('create', 'update', 'build', 'clean', 'login', 'execute')
--basetgz $BASE_DIR/$FOLDERBASE-base.tgz \
--distribution $DISTRIBUTION \ if operation not in arguments:
--debootstrapopts --arch \ if item_ends_with(arguments, '.dsc'):
--debootstrapopts $BINARCH \ self.operation = 'build'
$( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ else:
$( [ -z $PROXY ] || echo "--http-proxy $PROXY" ) \ print 'Error: «%s» is not a recognized argument.' % operation
$( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ print 'Please use one of those: ' + ', '.join(arguments) + '.'
--buildresult $BASE_DIR/$FOLDERBASE_result \ sys.exit(1)
--mirror $ARCHIVE \ else:
--aptconfdir $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ $@ self.operation = operation
def get_command(self, remaining_arguments = None):
""" pbuilder_dist.get_command -> string
Generate the pbuilder command which matches the given configuration
and return it as a string.
"""
# Calculate variables which depend on arguments given at runtime.
self._calculate()
arguments = [
self.operation,
'--basetgz "%(base)s/%(chroot_string)s-base.tgz"' % self,
'--distribution "%(target_distro)s"' % self,
'--buildresult "%(base)s/%(chroot_string)s_result/"' % self,
'--logfile "%(logfile)s"' % self,
'--aptcache "/var/cache/apt/archives/"',
### --mirror "${ARCHIVE}" \
]
if self.build_architecture != self.system_architecture:
arguments.append('--debootstrapopts --arch')
arguments.append('--debootstrapopts "%(build_architecture)s"' % self)
if self.proxy:
arguments.append('--http-proxy "%(proxy)s"' % self)
### $( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \
# Append remaining arguments
if remaining_arguments:
arguments.extend(remaining_arguments)
return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments)
def host_architecture():
""" host_architecture -> string
Detect the host's architecture and return it as a string
(i386/amd64/other values).
"""
return os.uname()[4].replace('x86_64', 'amd64').replace('i586', 'i386').replace('i686', 'i386')
def item_ends_with(list, string):
""" item_ends_with(list, string) -> bool
Return True if one of the items in list ends with the given string,
or else return False.
"""
for item in list:
if item.endswith(string):
return True
return False
def ask(question):
""" ask(question) -> string
Ask the given question and return the answer. Also catch
KeyboardInterrupt (Ctrl+C) and EOFError (Ctrl+D) exceptions and
immediately return None if one of those is found.
"""
try:
answer = raw_input(question)
except (KeyboardInterrupt, EOFError):
print
answer = None
return answer
def help(exit_code = 0):
""" help() -> None
Print a help message for pbuilder-dist, and exit with the given code.
"""
print 'Bad...'
sys.exit(exit_code)
def main():
""" main() -> None
This is pbuilder-dist's main function. It creates a pbuilder_dist
object, modifies all necessary settings taking data from the
executable's name and command line options and finally either ends
the script and runs pbuilder itself or exists with an error message.
"""
script_name = os.path.basename(__name__ or sys.argv[0])
parts = script_name.split('-')
# Copy arguments into another list for save manipulation
args = sys.argv[1:]
if '-' in script_name and parts[0] != 'pbuilder' or len(parts) > 3:
print 'Error: «%s» is not a valid name for a «pbuilder-dist» executable.' % script_name
sys.exit(1)
if len(args) < 1:
print 'Insufficient number of arguments.'
help(1)
if args[0] in ('-h', '--help', 'help'):
help(0)
app = pbuilder_dist()
if len(parts) > 1:
app.set_target_distro(parts[1])
else:
app.set_target_distro(args.pop(0))
if len(parts) > 2:
requested_arch = parts[2]
elif args[0] in ('i386', 'amd64'):
requested_arch = args.pop(0)
else:
requested_arch = None
if requested_arch:
if requested_arch in ('i386', 'amd64') and app.system_architecture == 'amd64':
app.build_architecture = requested_arch
else:
print 'Error: Architecture switching is not supported on your system; wrong filename.'
sys.exit(1)
if 'mainonly' in sys.argv:
app.extra_components = False
args.remove('mainonly')
if len(args) < 1:
print 'Insufficient number of arguments.'
help(1)
# Parse the operation
app.set_operation(args.pop(0))
# Execute the pbuilder command
sys.exit(os.system(app.get_command(args)))
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print 'Manually aborted.'
sys.exit(1)

44
pbuilder-dist-simple Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
#
# Copyright (C) Jamin W. Collins <jcollins@asgardsrealm.net>
# Copyright (C) Jordan Mantha <mantha@ubuntu.com>
#
# License: GPLv2 or later
#
# This script is a wrapper to be able to easily use pbuilder for
# different distributions (eg, Gutsy, Hardy, Debian unstable, etc).
#
# Create symlinks to this script naming them 'pbuilder-feisty', 'pbuilder-
# gutsy', 'pbuilder-hardy', etc. If you want additional features try
# out the more advanced script 'pbuilder-dist'.
OPERATION=$1
DISTRIBUTION=`basename $0 | cut -f2 -d '-'`
PROCEED=false
BASE_DIR="$HOME/pbuilder"
case $OPERATION in
create|update|build|clean|login|execute )
PROCEED=true
;;
esac
if [ $PROCEED = true ]; then
shift
if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ]
then mkdir -p $BASE_DIR/${DISTRIBUTION}_result/
fi
sudo pbuilder $OPERATION \
--basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \
--distribution $DISTRIBUTION \
--buildresult $BASE_DIR/$DISTRIBUTION_result \
--othermirror "deb http://archive.ubuntu.com/ubuntu $DISTRIBUTION universe multiverse" $@
else
echo "Invalid command..."
echo "Valid commands are:"
echo " create"
echo " update"
echo " build"
echo " clean"
echo " login"
echo " execute"
exit 1
fi

View File

@ -1,31 +0,0 @@
# Debian GNU/Linux cowbuilder(1) completion
# Copyright 2007 Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
#
# This script can be distributed under the same license as the
# cowdancer or bash packages.
#
# adapted to pbuilderdist, the license is GPLv2 or later.
# Copyright 2008 Stephan Hermann <sh@sourcecode.de> for the Ubuntu MOTU Team
have pbuilder-dist &&
_pbuilder-dist()
{
local cur prev options
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
options='create update build login execute'
case $prev in
build)
COMPREPLY=( $( compgen -o filenames -G "$cur*.dsc" ) )
;;
*)
COMPREPLY=( $( compgen -W "$options" | grep "^$cur" ) )
;;
esac
return 0
}
[ "$have" ] && complete -F _pbuilder-dist -o filenames pbuilder-dist

View File

@ -19,18 +19,21 @@ setup(name='ubuntu-dev-tools',
'check-symbols', 'check-symbols',
'get-branches', 'get-branches',
'pbuilder-dist', 'pbuilder-dist',
'pbuilder-dist-simple',
'update-maintainer', 'update-maintainer',
'dch-repeat', 'dch-repeat',
'mk-sbuild-lv', 'mk-sbuild-lv',
'pull-debian-debdiff', 'pull-debian-debdiff',
'what-patch', 'what-patch',
'suspicious-source', 'suspicious-source',
'ppaput',
'requestsync', 'requestsync',
'hugdaylist', 'hugdaylist',
'massfile', 'massfile',
'submittodebian', 'submittodebian',
'get-build-deps', 'get-build-deps',
'dgetlp' 'dgetlp',
'reverse-build-depends',
'grab-attachments',
], ],
packages=['ubuntutools'],
) )

View File

@ -28,6 +28,10 @@ except ImportError:
print 'This utility requires modules from the «python-debian» package, which isn\'t currently installed.' print 'This utility requires modules from the «python-debian» package, which isn\'t currently installed.'
sys.exit(1) sys.exit(1)
if not os.path.exists('/usr/bin/reportbug'):
print 'This utility requires the «reportbug» package, which isn\'t currently installed.'
sys.exit(1)
def get_most_recent_debian_version(changelog): def get_most_recent_debian_version(changelog):
for v in changelog.get_versions(): for v in changelog.get_versions():
if not re.search('(ubuntu|build)', v.full_version): if not re.search('(ubuntu|build)', v.full_version):

View File

@ -13,7 +13,7 @@ FILES="*.h *.c *.cc *.cpp *.py *.sh *.txt *.text *.3 *.m4 *.xml *.html *.php \
configure.ac *.diff *.debdiff *.patch *.dpatch config.sub config.guess \ configure.ac *.diff *.debdiff *.patch *.dpatch config.sub config.guess \
depcomp *.docbook *.desktop *.menu AUTHORS INSTALL NEWS README TODO \ depcomp *.docbook *.desktop *.menu AUTHORS INSTALL NEWS README TODO \
COPYING LICENSE ChangeLog *.ui *.glade *.gladep *.po *.pot *.ts *.pro \ COPYING LICENSE ChangeLog *.ui *.glade *.gladep *.po *.pot *.ts *.pro \
*.svg *.png *.bmp *.gif *.xpm *.hh" *.svg *.png *.bmp *.gif *.xpm *.hh *.in"
IGNORE=".bzr CVS .svn debian" IGNORE=".bzr CVS .svn debian"

4
ubuntutools/__init__.py Normal file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
#
# Ubuntu Development Tools
# https://launchpad.net/ubuntu-dev-tools

View File

@ -1,19 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2007, Canonical, Daniel Holbach # Copyright 2007, Canonical, Daniel Holbach
# # Modified by Andrew Hunter
# GPL 3 # License: GPLv3
#
#
# 11:57:27 < dholbach> but what it does is: build a source package of
# the current source tree you're in, upload it to PPA
# and follow up on a bug report, subscribe the right
# sponsors, set the right status - if you pass "-n"
# it will file a bug report, add a (LP: #....) to
# the changelog also
# 11:57:37 < dholbach> I thought it'd help with our sponsoring process
#
import re import re
import os import os
@ -23,26 +12,15 @@ import string
try: try:
import launchpadbugs.connector as Connector import launchpadbugs.connector as Connector
except: except:
print >> sys.stderr, \ raise ImportError, "You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput."
"You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput."
sys.exit(1) sys.exit(1)
#try: #try:
# import apt # import apt
#except: #except:
# print >> sys.stderr, "You need python-apt installed to use ppaput." # raise ImportError, "You need python-apt installed to use ppaput."
# sys.exit(1) # sys.exit(1)
USAGE = \
"""Usage: ppaput [-n] [<location>] [<debuild options>]
-n to file a new bug
<location> dput alias
<debuild options> options that are passed to debuild(1)
"""
def dput_check(): def dput_check():
if not os.path.exists("/usr/bin/dput"): if not os.path.exists("/usr/bin/dput"):
print >> sys.stderr, "You need to install the dput package." print >> sys.stderr, "You need to install the dput package."
@ -112,11 +90,15 @@ def get_name_version_section_and_release():
release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0] release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0]
section = "main" section = "main"
for line in open(controlfile).readlines(): #
if line.startswith("Section"): #Is this nessicary? All ppa install to main now.
if line.split("Section: ")[1].count("/")>0: #
section = line.split("Section: ")[1].split("/")[0].strip()
return (name, version, section) # for line in open(controlfile).readlines():
# if line.startswith("Section"):
# if line.split("Section: ")[1].count("/")>0:
# section = line.split("Section: ")[1].split("/")[0].strip()
# return (name, version, section)
return (name, version, section, release) return (name, version, section, release)
@ -189,38 +171,6 @@ def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage,
bug.commit() bug.commit()
def check_arguments(args):
new_bug = False
location = 'default'
debuild_args = list()
if len(sys.argv) == 2 and sys.argv[1] in ["--help", "-H"]:
print USAGE
sys.exit(0)
if len(sys.argv) == 1:
return (new_bug, location, debuild_args)
if sys.argv[1] == "-n":
new_bug = True
if len(sys.argv)>2:
if sys.argv[2].startswith("-"):
debuild_args = sys.argv[2:]
else:
location = sys.argv[2]
if len(sys.argv)>3:
debuild_args = sys.argv[3:]
else:
if sys.argv[1].startswith("-"):
debuild_args.append(sys.argv[1:])
else:
location = sys.argv[1]
if len(sys.argv)>2:
debuild_args = sys.argv[2:]
return (new_bug, location, debuild_args)
def file_bug(sourcepackage, version): def file_bug(sourcepackage, version):
Bug = Connector.ConnectBug() Bug = Connector.ConnectBug()
Bug.authentication = os.path.expanduser("~/.lpcookie") Bug.authentication = os.path.expanduser("~/.lpcookie")
@ -242,36 +192,3 @@ def file_bug(sourcepackage, version):
(bug.bugnumber, bug.bugnumber) (bug.bugnumber, bug.bugnumber)
return bug.bugnumber return bug.bugnumber
def main():
(new_bug, location, debuild_args) = check_arguments(sys.argv)
(sourcepackage, version, \
section, release) = get_name_version_section_and_release()
if new_bug:
bugnumber = file_bug(sourcepackage, version)
os.system("dch -a 'Fixes (LP: #%s)'" % bugnumber)
if not call_debuild(debuild_args):
sys.exit(1)
changesfile = "../%s_%s_source.changes" % (sourcepackage, version)
if not os.path.exists(os.path.expanduser(changesfile)):
print >> sys.stderr, "%s does not exist." % \
os.path.expanduser(changesfile)
sys.exit(1)
host = lookup_dput_host(location)
(dput_res, incoming) = call_dput(location, changesfile)
if not dput_res:
print >> sys.stderr, "%s was not uploaded." % changesfile
sys.exit(1)
fixed_lp_bugs = find_fixed_launchpad_bug(changesfile)
if(fixed_lp_bugs):
deal_with_bugreport(fixed_lp_bugs, host, section, incoming,
sourcepackage, version, release)
if __name__ == '__main__':
main()

View File

@ -2,14 +2,14 @@
# Copyright 2007 (C) Albin Tonnerre (Lutin) <lut1n.tne@gmail.com> # Copyright 2007 (C) Albin Tonnerre (Lutin) <lut1n.tne@gmail.com>
# License: GPLv2 # License: GPLv2
# #
# This script is used to update the maintainer field of an Ubuntu package # This script is used to update the Maintainer field of an Ubuntu package
# to match the DebianMaintainerField specification. # to match the DebianMaintainerField specification.
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 [--path=PATH] [--section=SECTION] [--nochangelog] Usage: $0 [--path=PATH] [--section=SECTION] [--nochangelog]
--path=PATH specify the path of the source folder --path=PATH Specify the path of the source directory.
--section=SECTION specify the section of the package (if the package is --section=SECTION Specify the section of the package (if the package is
not yet in the archive. not yet in the archive.
--nochangelog Do not add to the changelog, only alter debian/control. --nochangelog Do not add to the changelog, only alter debian/control.
EOF EOF
@ -29,7 +29,7 @@ for argv in "$@"; do
[ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1 [ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1
section=$value section=$value
;; ;;
"--nochangelog") "--nochangelog"|"--no-changelog")
nochangelog=1 nochangelog=1
;; ;;
"--help") "--help")
@ -55,10 +55,17 @@ else
echo "Please execute «$0» in the source folder." >&2 && exit 1 echo "Please execute «$0» in the source folder." >&2 && exit 1
fi fi
[ -n "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ] && if [ -z "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ]
! grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null || \ then
{ echo "Not an Ubuntu package or already maintained by the Ubuntu team." >&2; \ echo "Latest changelog entry has no Ubuntu version number." >&2
exit 1; } exit 1
fi
if grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null
then
echo "Package already maintained by the Ubuntu team." >&2
exit 1
fi
if [ -z "$section" ]; then if [ -z "$section" ]; then
DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1) DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1)
@ -70,6 +77,7 @@ if [ -z "$section" ]; then
fi fi
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main
fi fi
case $section in case $section in
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;; "main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;;
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;; "universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;;