diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 0000000..cb2ebab --- /dev/null +++ b/.bzrignore @@ -0,0 +1 @@ +debian/pycompat diff --git a/404main b/404main index 34ac278..604e759 100755 --- a/404main +++ b/404main @@ -31,7 +31,7 @@ def find_main(pack): global packages # 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: packages[pack] = True @@ -41,12 +41,12 @@ def find_main(pack): packages[pack] = False # 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) # 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 = [] for builddep in deps1: @@ -56,35 +56,55 @@ def find_main(pack): process_deps(deps) -if __name__ == '__main__': +def main(): + + global packages, distro # Check if the amount of arguments is correct - if len(sys.argv) != 2 or sys.argv[1] in ('help', '-h', '--help'): - print "Usage: %s " % sys.argv[0] - sys.exit(1) - - # Global variable to hold the status of all packages - packages = {} - - if subprocess.Popen("apt-cache show " + sys.argv[1] + " 2>/dev/null", shell=True, stdout=subprocess.PIPE).stdout.read() == '': - print "Package «%s» doesn't exist." % sys.argv[1] + if len(sys.argv) < 2 or len(sys.argv) > 3 or sys.argv[1] in ('help', '-h', '--help'): + print 'Usage: %s []' % sys.argv[0] sys.exit(1) - try: - find_main(sys.argv[1]) - except KeyboardInterrupt: - print 'Aborted.' + if len(sys.argv) == 3 and sys.argv[2]: + 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 not subprocess.Popen('apt-cache madison ' + sys.argv[1] + ' | grep ' + distro, shell=True, stdout=subprocess.PIPE).stdout.read(): + print 'Can\'t find package «%s» in distribution «%s».' % (sys.argv[1], distro) sys.exit(1) + print 'Checking package «%s» in distribution «%s»...' % (sys.argv[1], distro) + + find_main(sys.argv[1]) + # True if everything checked until the point is in main all_in_main = True for package in packages: if not packages[package]: if all_in_main: - print "Following packages aren't in main:" + print 'The following packages aren\'t in main:' all_in_main = False print ' ', package 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) diff --git a/README b/README index 34c918f..8cf4e00 100644 --- a/README +++ b/README @@ -46,12 +46,6 @@ pbuilder-dist [withlog] [create|update|build|clean|login|execute] Debian releases. It's recommended to symlink as pbuilder-feisty, pbuilder-gutsy, etc. -ppaput [-n] [] - ... will build a source package using , upload it - to 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 ... will attempt to find and download a specific version of a Debian package and its immediate parent to generate a debdiff. diff --git a/TODO b/TODO new file mode 100644 index 0000000..2d40c5b --- /dev/null +++ b/TODO @@ -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. diff --git a/bash_completion/pbuilder-dist b/bash_completion/pbuilder-dist new file mode 100644 index 0000000..0eb20d0 --- /dev/null +++ b/bash_completion/pbuilder-dist @@ -0,0 +1,35 @@ +# pbuilder-dist completion +# +# Copyright 2008 Stephan Hermann , created for +# the Ubuntu MOTU Team. +# +# Released under the GNU General Public License, version 2 +# +# Based upon cobwuilder's autocompletion, Copyright 2007 Cyril +# Brulebois + +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 diff --git a/check-symbols b/check-symbols index 5498107..a6bfbd7 100755 --- a/check-symbols +++ b/check-symbols @@ -30,7 +30,7 @@ do for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; do 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; DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "; done @@ -58,9 +58,9 @@ do for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; do 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"; - diff -u /tmp/$LIBNAME.{1,2}; - rm /tmp/$LIBNAME.{1,2}; + diff -u /tmp/$LIBNAME.{old,new}; + rm /tmp/$LIBNAME.{old,new}; done; -done +done diff --git a/debian/changelog b/debian/changelog index 4a211d7..88e7df0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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: - Use debian_bundle.changelog.Version for version comparison in debian_changelog. @@ -18,12 +23,110 @@ ubuntu-dev-tools (0.31) hardy; urgency=low - post_bug: Catch IOError when setting bug importance (LP: #190061) - mail_bug: Catch socket.error (LP: #190739) - -- Daniel Hahler Wed, 16 Apr 2008 01:57:41 +0200 + -- Daniel Hahler 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) 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 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 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) Sun, 24 Feb 2008 19:11:06 +0100 + +ubuntu-dev-tools (0.26) hardy; urgency=low [ 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 ... [ Daniel Hahler ] @@ -34,7 +137,18 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low (LP: #190351) * Exit, if versions in Ubuntu and Debian are the same already. - -- Daniel Hahler 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) Sun, 17 Feb 2008 19:35:46 +0100 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) ] * 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 proper exit values. * debian/control: diff --git a/debian/control b/debian/control index 5e18b06..b51804f 100644 --- a/debian/control +++ b/debian/control @@ -2,10 +2,10 @@ Source: ubuntu-dev-tools Section: devel Priority: optional Maintainer: Ubuntu MOTU Developers -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 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 Homepage: https://launchpad.net/ubuntu-dev-tools/ Standards-Version: 3.7.3 @@ -13,8 +13,8 @@ Standards-Version: 3.7.3 Package: ubuntu-dev-tools Architecture: all 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 -Recommends: bzr, pbuilder +Depends: ${python:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), python-debian, dctrl-tools, lsb-release +Recommends: bzr, pbuilder, reportbug (>= 3.39ubuntu1) Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) XB-Python-Version: ${python:Versions} diff --git a/debian/copyright b/debian/copyright index 07c6416..c97e920 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,8 @@ This package was re-debianized by Daniel Holbach on Fri, 01 Jun 2007 11:30:08 +0200. -Upstream Author: +Upstream Authors: + Albert Damen Albin Tonnerre Daniel Hahler @@ -18,18 +19,18 @@ Upstream Author: Steve Kowalik Terence Simpson - Copyright: - Copyright 2006-2007 (C) Canonical Ltd. + + Canonical Ltd. 2006-2008 Albert Damen 2007 Albin Tonnerre 2006-2007 Daniel Holbach 2006-2007 Luke Yelavich 2006-2007 Martin Pitt 2007 Michael Bienia 2006-2007 - Kees Cook 2006-2007 + Kees Cook 2006-2008 Pete Savage 2006-2007 - Siegfried-A. Gevatter 2007 + Siegfried-A. Gevatter 2007-2008 Terence Simpson 2007 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 can be found in `/usr/share/common-licenses/GPL-2'. -get-branches, get-build-deps, massfile andsuspicious-source are licensed -under GPLv3: +get-branches, get-build-deps, massfile, ppaput and suspicious-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 diff --git a/debian/pycompat b/debian/pycompat deleted file mode 100644 index 0cfbf08..0000000 --- a/debian/pycompat +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/debian/rules b/debian/rules index c9d7a1c..6a071b0 100755 --- a/debian/rules +++ b/debian/rules @@ -1,18 +1,11 @@ #!/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/class/python-distutils.mk DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 -build/ubuntu-dev-tools:: - docbook2x-man doc/ppaput.1.docbook; mv ppaput.1 doc - -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 +binary-install/ubuntu-dev-tools:: + rm -rf debian/ubuntu-dev-tools/usr/lib diff --git a/debian/source.lintian-overrides b/debian/source.lintian-overrides new file mode 100644 index 0000000..17ccc05 --- /dev/null +++ b/debian/source.lintian-overrides @@ -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 diff --git a/debian/examples b/debian/ubuntu-dev-tools.examples similarity index 100% rename from debian/examples rename to debian/ubuntu-dev-tools.examples diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install new file mode 100644 index 0000000..40fadd6 --- /dev/null +++ b/debian/ubuntu-dev-tools.install @@ -0,0 +1 @@ +bash_completion/* etc/bash_completion.d/ diff --git a/dgetlp b/dgetlp index 4659877..38b5502 100755 --- a/dgetlp +++ b/dgetlp @@ -1,7 +1,20 @@ #!/bin/bash -# Copyright 2007 (C) Terence Simpson +# Copyright (C) 2008 Terence Simpson # Modified by Siegfried-A. Gevatter -# 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 # launchpadlibrarian.net. @@ -15,6 +28,7 @@ GET="wget" UNPACK="dpkg-source -x {dsc-file}" +DIRECT_TO_NULL="/dev/null" usage() { @@ -24,27 +38,41 @@ Usage: $0 [-d] This scripts simulates «dget»'s behaviour for files hostead at launchpadlibrarian.net. -If you specify the -d option then it won't do anything, but just -print the commands it would run otherwise. +If you specify the -d option then it won't do anything, except download the +.dsc file, but just print the commands it would run otherwise. 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 } -if [ $1 ] && [ $1 = "-d" ] || [ $1 = "--debug" ] -then - # Debug Mode - GET="echo "${GET} - UNPACK="echo "${UNPACK} - shift -fi - -if [ $1 ] && [ $1 = "-h" ] || [ $1 = "--help" ] -then - usage - exit 0 -fi +while [ $# -ne 1 ]; do +case "$1" in + -d|--debug) + # Debug Mode + OUTPUT="/tmp/" + GET="echo ${GET}" + UNPACK="echo ${UNPACK}" + shift + ;; + -v|--verbose) + DIRECT_TO_NULL="$(tty)" + shift + ;; + -h|--help) + usage + exit 0 + ;; + -*) + echo "Unknown option: \`$1'" + usage >&2 + exit 1 + ;; + *) + break + ;; +esac +done if [ $# -ne 1 ] then @@ -52,6 +80,43 @@ then exit 1 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 URL=$1 @@ -77,35 +142,28 @@ then exit 1 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)" FILE="$(echo $URL|cut -d '/' -f 5)" UNPACK=$(echo $UNPACK | sed s/{dsc-file}/${FILE}/g) -echo "Getting ${BASE}/${NUMBER}/${FILE}" -if ! $GET ${BASE}/${NUMBER}/${FILE} +if [ -f "$FILE" ]; then rm -f $FILE; fi +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 - echo "Failed to fetch «.dsc» file, aborting." - exit 1 + getUrl ${BASE}/$((${NUMBER}-1))/ "$(echo $FILE|sed 's,\.dsc,.diff.gz,')" "diff.gz" + 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 -echo "Getting ${BASE}/$(($NUMBER-1))/$(echo $FILE|sed 's,\.dsc$,.diff.gz,')" -if ! $GET ${BASE}/$(($NUMBER-1))/$(echo $FILE | sed 's,\.dsc$,.diff.gz,') -then - echo "Failed to fetch «.diff.gz» file, aborting." - exit 1 +if [ "x${OUTPUT}" != "x" ] +then rm -f ${OUTPUT}${FILE} fi -echo "Getting ${BASE}/$(($NUMBER-2))/$(echo $FILE|sed 's,\-[0-9]*.*$,.orig.tar.gz,')" -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 +unpack; diff --git a/doc/404main.1 b/doc/404main.1 new file mode 100644 index 0000000..e34af04 --- /dev/null +++ b/doc/404main.1 @@ -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 and +this manpage by Siegfried-Angel Gevatter Pujals . +.PP +Both are released under the GNU General Public License, version 2 or +later. diff --git a/doc/check-symbols.1 b/doc/check-symbols.1 index 84857aa..8abb439 100644 --- a/doc/check-symbols.1 +++ b/doc/check-symbols.1 @@ -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" + .SH "NAME" check\-symbols \- verify symbols exported by a new library version -.\" + .SH "SYNOPSIS" \fBcheck\-symbols\fP <\fIsource\-package\fR\> [\fIDEBDIR\fR] -.\" + .SH "DESCRIPTION" To verify the symbols exported by a new library version, run \fBcheck-symbols\fP with the name of the source package as argument. @@ -32,9 +24,8 @@ the exported symbols of the libraries. .PP If no value is given for DEBDIR, the script will assume the new library deb files are stored in /var/cache/pbuilder/result. -.\" + .SH "EXAMPLES" -.TP \fBcheck\-symbols\fP telepathy-glib . .TP This will: @@ -51,12 +42,17 @@ output of the old version. .TP 2 \(bu List the result in diff format. .RE -.\" + .SH "BUGS" .nf Please report bugs on: https://bugs.launchpad.net/ubuntu/+source/ubuntu\-dev\-tools/ .fi -.\" + .SH "SEE ALSO" .BR nm (1) + +.SH "AUTHOR" +\fBcheck\-symbols\fP was written by Daniel Holbach +and this manpage by Albert Damen . Both are licensed +under the GNU General Public License, version 2. diff --git a/doc/get-build-deps.1 b/doc/get-build-deps.1 index 42747e5..2077f8b 100644 --- a/doc/get-build-deps.1 +++ b/doc/get-build-deps.1 @@ -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" .SH NAME @@ -11,28 +7,28 @@ get\-build\-deps \- install build dependencies for one or more packages \fBget\-build\-deps\fP [\fIpackage name\fR] .SH DESCRIPTION -\fBget\-build\-deps\fP is a script to install the build dependencies for either a -local source package or one or more packages from the repositories. +\fBget\-build\-deps\fP is a script to install the build dependencies for +either a local source package or one or more packages from the repositories. .PP -In order to obtain all missing build dependencies for a package on which source -you are currently working, just run this script without any argument, and it'll -read its debian/control file to determine the missing build dependencies. +In order to obtain all missing build dependencies for a package on +which source you are currently working, just run this script without +any argument, and it'll read its debian/control file to determine the +missing build dependencies. .PP -Alternatively, you can call it with a list of space-separated package names, or the -name of a single file which contains the package names each on a line. -Then it will install the missing dependencies for those packages using -"apt-get build-dep". +Alternatively, you can call it with a list of space-separated package +names, or the name of a single file which contains the package names +each on a line. Then it will install the missing dependencies for those +packages using "apt-get build-dep". .SH EXAMPLES .TP get\-build\-deps -Looks for a debian/control file in the current working directory and installs the -dependencies listed there. +Looks for a debian/control file in the current working directory and +installs the dependencies listed there. .TP get\-build\-deps geany -Installs the build dependencies for the version of -.B geany -that's in the repositories. +Installs the build dependencies for the version of \fBgeany\fP that's +in the repositories. .TP get\-build\-deps geany epiphany-browser rhythmbox Same as the previous example but also with the dependencies for @@ -44,19 +40,20 @@ get\-build\-deps ./package_list.txt Reads the file .B package_list.txt (relative to the current working directory), -where each line contains the name of a package, and installs the dependencies -for the versions of all those that are in the repositories. +where each line contains the name of a package, and installs the +dependencies for the versions of all those that are in the repositories. .SH KNOWN BUGS AND LIMITATIONS -When it's being used to install the missing dependencies for a local source package -(i.e., no arguments are passed to it) it doesn't check for the dependencies to match -the indicated versions, but just installs the newest one available in the repositories. +When it's being used to install the missing dependencies for a local +source package (i.e., no arguments are passed to it) it doesn't check +for the dependencies to match the indicated versions, but just installs +the newest one available in the repositories. .SH SEE ALSO .BR dpkg-checkbuilddeps (1), .BR apt-get (8) -.SH AUTHORS +.SH AUTHORS \fBget\-build\-deps\fP and this manual page have been written by Siegfried-Angel -Gevatter Pujals . -They are released under the GNU General Public License, version 3 or later. +Gevatter Pujals . They are released under the GNU General Public +License, version 3 or later. diff --git a/doc/pbuilder-dist-simple.1 b/doc/pbuilder-dist-simple.1 new file mode 100644 index 0000000..1ed6954 --- /dev/null +++ b/doc/pbuilder-dist-simple.1 @@ -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\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 + and Jordan Mantha , and +this manpage by Siegfried-A. Gevatter . +.PP +Both are released under the GNU General Public License, version 2 or +later. diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index d271128..1cbd1a6 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -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" .SH NAME diff --git a/doc/ppaput.1.docbook b/doc/ppaput.1.docbook deleted file mode 100644 index a415680..0000000 --- a/doc/ppaput.1.docbook +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - Daniel - Holbach - daniel.holbach@ubuntu.com - - - 2007 - Daniel Holbach - - - - 2007-09-07 - - - - ppaput - 1 - - - ppaput - A tool for uploading packages for sponsorship - - - - ppaput - - - - - - - - - - - - - PREREQUISITES - - To use this tool, you will need to set up your PPA in Launchpad and - therefore carefully follow the instructions in the PPA documentation. - - - Also you need to copy your Launchpad cookie to - ~/.lpcookie. Firefox uses - ~/.mozilla/firefox/<random>cookies.txt, - Epiphany uses - ~/.gnome2/epiphany/mozilla/epiphany/cookies.txt. - - - - OVERVIEW - - This tool aims to help with the sponsoring - process and is written by the MOTU team. - - - This tool will 1) build a source package of the current source tree - you're in, 2) upload the package to <dput - location> (using 'default' if not specified), 3) follow up on the bug - report (if specified in debian/changelog as per the - changelog - spec), 4) set the right status and subscribe the right people to - the bug report. - - - If you use the option, it - will also 1) file a bug and add 2) a (LP: #.....) header to the source - package. - - - The - sponsoring process was complicated enough and package uploads - were done to either Malone, - REVU or personal web servers. This tool aims - to unify processes and make use of existing infrastructure such as - Launchpad Bugs (Malone) and - Launchpad PPA. - In September 2007, Daniel Holbach started working on this tool. - - - - DESCRIPTION - - 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. - - - - OPTIONS - - These are all the options available so far: - - - - ppaput options: - - - files a new bug report and adds its number to - debian/changelog - - - - - specifies the location you upload the source package - to according to the alias you specified in either - /etc/dput.cf or - ~/.dput.cf - - - - will be passed to debuild - during source package creation - - - - - - - COPYRIGHT - - This manual page was written by the MOTU team for the - revutool bug tracking system. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU General Public License, - Version 3 or any later version published by the Free Software Foundation. - - - On Debian systems (like Ubuntu), the complete text of the - GNU General Public License can be found in - /usr/share/common-licenses/GPL-3. - - - diff --git a/doc/suspicious-source.1 b/doc/suspicious-source.1 index 2b39695..967fba5 100644 --- a/doc/suspicious-source.1 +++ b/doc/suspicious-source.1 @@ -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" -.\" + .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 \fBsuspicious\-source\fP -.\" + .SH DESCRIPTION -\fBsuspicious\-source\fP is a script that outputs a list of files which 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" +\fBsuspicious\-source\fP is a script that outputs a list of files which +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. .PP -Neither the files inside version control system directories (like ".bzr/" or "CVS/"), nor those inside "debian/" are -considered. -.\" -.SH AUTHORS -\fBsuspicious\-source\fP has been written by Siegfried-Angel Gevatter Pujals , based upon -a script with the same name, by Martin Pitt . -.\" +Neither the files inside version control system directories (like +".bzr/" or "CVS/"), nor those inside "debian/" are considered. + .SH SEE ALSO .BR find (1) -.\" -.SH COPYRIGHT -This manual page was written by Siegfried-Angel Gevatter Pujals (RainCT). -It is released under the GNU General Public License, version 2 or later. + +.SH AUTHORS +\fBsuspicious\-source\fP and this manpage have been written by +Siegfried-Angel Gevatter Pujals , based upon a +script with the same name from Martin Pitt . +.PP +Both are released under the GNU General Public License, version 3 or later. diff --git a/doc/update-maintainer.1 b/doc/update-maintainer.1 new file mode 100644 index 0000000..351656a --- /dev/null +++ b/doc/update-maintainer.1 @@ -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=\fR] [\fI\-\-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=\fP +This option allows you to specify the path to the source directory. +.TP +\fB\-\-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 +and this manual page by Siegfried-Angel Gevatter Pujals . +.PP +Both are released under the GNU General Public License, version 2. diff --git a/get-build-deps b/get-build-deps index d4b9b2c..3f2c6f7 100755 --- a/get-build-deps +++ b/get-build-deps @@ -26,7 +26,7 @@ then cd .. elif [ ! -f ./debian/control ]; then 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 \ package(s) whose build dependencies you want to install in order \ to use this script." diff --git a/grab-attachments b/grab-attachments new file mode 100755 index 0000000..dbda6f2 --- /dev/null +++ b/grab-attachments @@ -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 " + +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() + diff --git a/mk-sbuild-lv b/mk-sbuild-lv index 51b1829..d0f6a1e 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild-lv @@ -20,7 +20,7 @@ # detect the chroot architecture: # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392992 # -# Version: 0.11 +# Version: 0.12 set -e @@ -87,6 +87,7 @@ function usage() echo "Options:" echo " --arch=ARCH What architecture to select" 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 " --source-template=FILE Use FILE as the sources.list template" echo " --debootstrap-mirror=URL Use URL as the debootstrap source" @@ -97,7 +98,7 @@ function usage() if [ -z "$1" ]; then usage 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" name="" @@ -111,6 +112,14 @@ while :; do # By default, use the native architecture. arch_opt="--arch $2" arch_suffix="-$2" + if [ -z "$personality" -a "$2" = "i386" ] + then + personality="linux32" + fi + shift 2 + ;; + --personality) + personality="$2" shift 2 ;; --name) @@ -223,6 +232,9 @@ run-setup-scripts=true run-exec-scripts=true EOM fi +if [ ! -z "$personality" ]; then + echo "personality=$personality" >> "$TEMP_SCHROOTCONF" +fi cat "$TEMP_SCHROOTCONF" | sed \ -e "s|CHROOT_NAME|$CHROOT_NAME|g" \ -e "s|CHROOT_PATH|$CHROOT_PATH|g" \ diff --git a/pbuilder-dist b/pbuilder-dist index 982f32d..9790f87 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -1,271 +1,318 @@ -#!/bin/sh -# Copyright by: -# Jamin W. Collins -# Jordan Mantha -# Siegfried-A. Gevatter +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2008 Siegfried-A. Gevatter +# Based upon pbuilder-dist-simple by Jamin Collins and Jordan Mantha. +# # License: GPLv2 or later # -# This script is a wrapper to use pbuilder with many different -# distributions / versions. (It was originally created because of -# bug #255165 in Debian.) +# This script is a wrapper to be able to easily use pbuilder for +# different distributions (eg, Gutsy, Hardy, Debian unstable, etc). # -# If you want to use this copy of the script only for a single distribution -# / version, rename it to 'pbuilder-dapper', 'pbuilder-feisty', 'pbuilder-gutsy', -# or whatever it is. If you have an amd64, you can also use names like -# 'pbuilder-feisty-i386', etc. +# You can create symlinks to a pbuilder-dist executable to get different +# configurations. For example, a symlink called pbuilder-hardy will assume +# that the target distribution is always meant to be Ubuntu Hardy. -# Base directory where pbuilder will put all the files it creates -# This is overriden by the global variable $PBUILDFOLDER -BASE_DIR="$HOME/pbuilder" +import sys +import os -# Enable additional components by default? (universe and multiverse in Ubuntu, -# contrib and non-free in Debian.) -EXTRACOMP=1 +class pbuilder_dist: + + def __init__(self): + + # Base directory where pbuilder will put all the files it creates. + self.base = None + + # 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 + + # System architecture + self.system_architecture = None + + # Build architecture + self.build_architecture = None + + # System's distribution + self.system_distro = None + + # Target distribution + self.target_distro = None + + # This is an identificative string which will either take the form + # 'distribution' or 'distribution-architecture'. + self.chroot_string = None + + # Proxy + self.proxy = None + + # Authentication method + self.auth = 'sudo' + + ############################################################## + + if 'PBUILDFOLDER' in os.environ: + self.base = os.environ['PBUILDFOLDER'] + else: + self.base = os.path.expanduser('~/pbuilder/') + + if 'PBUILDAUTH' in os.environ: + self.auth = os.environ['PBUILDAUTH'] + + self.system_architecture = host_architecture() + + 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 not os.path.isfile('/etc/lsb-release'): + print 'Error: Not running on a Debian based system; could not find /etc/lsb-release.' + exit(1) + + for line in open('/etc/lsb-release'): + line = line.strip() + if line.startswith('DISTRIB_CODENAME'): + self.system_distro = line[17:] + break + + if not self.system_distro: + print 'Error: Could not determine what distribution you are running.' + exit(1) + + self.target_distro = self.system_distro + + if 'http_proxy' in os.environ: + self.base = os.environ['http_proxy'] + elif 'HTTP_PROXY' in os.environ: + self.base = os.environ['HTTP_PROXY'] + + ############################################################## + + def __getitem__(self, name): + + return getattr(self, name) + + def _calculate(self): + """ pbuilder_dist.calculate(distro) -> None + + 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. + + """ + + if not self.build_architecture: + self.chroot_string = self.target_distro + self.build_architecture = self.system_architecture + else: + self.chroot_string = '%(target_distro)s-%(build_architecture)s' % self + + if not self.logfile: + self.logfile = '%(base)s/.%(chroot_string)s.log' % self + + def set_target_distro(self, distro): + """ pbuilder_dist.set_target_distro(distro) -> None + + Check if the given target distribution name is correct, if it + isn't know to the system ask the user for confirmation before + proceeding, and finally either save the value into the appropiate + variable or finalize pbuilder-dist's execution. + + """ + + if not distro.isalpha(): + print 'Error: «%s» is an invalid distribution codename.' + sys.exit(1) + + if not os.path.isfile(os.path.join('/usr/share/debootstrap/scripts/', distro)): + answer = ask('Warning: Unknown distribution «%s». Do you want to continue [y/N]? ' % distro) + if answer not in ('y', 'Y'): + sys.exit(0) + + self.target_distro = distro + + def set_operation(self, operation): + """ pbuilder_dist.set_operation -> None + + Check if the given string is a valid pbuilder operation and + depending on this either save it into the appropiate variable + or finalize pbuilder-dist's execution. + + """ + + arguments = ('create', 'update', 'build', 'clean', 'login', 'execute') + + if operation not in arguments: + if item_ends_with(arguments, '.dsc'): + self.operation = 'build' + else: + print 'Error: «%s» is not a recognized argument.' % operation + print 'Please use one of those: ' + ', '.join(arguments) + '.' + sys.exit(1) + else: + 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) -# Save the log of the last operation in a dot-file? ('.lastlog' in BASE_DIR) -SAVELOG=0 +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') -# Allow this script to use /var/cache/apt/archives/ when possible -if [ -z $SYSCACHE ] -then - SYSCACHE=1 -fi +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 -CALLDIR=`pwd` +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))) -ARCH=`dpkg-architecture -qDEB_HOST_ARCH` -SYSDIST=`lsb_release -cs` - -if [ $PBUILDFOLDER ] && [ $PBUILDFOLDER != "" ] -then - BASE_DIR=$PBUILDFOLDER -fi - -help() -{ - echo "Insufficient number of arguments." - echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo " " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] " - exit 1 -} - -if [ ! -z `echo \`basename $0\` | grep -- '-'` ] && [ `basename $0` != 'pbuilder-dist' ] -then - if [ $# -lt 1 ] - then - help - fi - - BINARCH=`basename $0 | cut -f3 -d '-'` - DISTRIBUTION=`basename $0 | cut -f2 -d '-'` -else - if [ $# -lt 2 ] - then - help show-dist-flag - fi - - DISTRIBUTION=$1 - shift 1 -fi - - -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 -fi - - -if [ $1 = "mainonly" ]; then - EXTRACOMP=0 - shift 1 -elif [ $1 = "allcomp" ]; then - EXTRACOMP=1 - shift 1 -fi - - -if [ $1 = "withlog" ]; then - SAVELOG=1 - shift 1 -elif [ $1 = "nolog" ]; then - SAVELOG=0 - shift 1 -fi - - -distdata() -{ - if [ "$1" = "debian" ] - 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 -} - - -case $DISTRIBUTION in - dapper|edgy|feisty|gutsy|hardy) # warty|hoary|breezy - distdata ubuntu - ;; - - oldstable|sarge|stable|etch|testing|lenny|unstable|sid|experimental) - distdata debian - ;; - - *) - 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' ] - then - echo "Aborting..." - exit 1 - fi - fi - distdata - ;; -esac - - -OPERATION=$1 - -case $OPERATION in - create|update|build|clean|login|execute) - shift 1 - ;; - - *) - if [ ${1##*.} = 'dsc' ] - then - OPERATION=build - else - 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 [ ! -d $BASE_DIR/${FOLDERBASE}_result ] -then - mkdir -p $BASE_DIR/${FOLDERBASE}_result -fi - -if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ] -then - DEBCACHE='/var/cache/apt/archives/' -fi - - -# Check what version of pbuilder is installed, and if -# it's supported, use the --components option -if dpkg --compare-versions $(dpkg-query -W -f='${Version}' pbuilder) ge 0.174 -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 ] -then - if [ -n $http_proxy ] - then - PROXY=$http_proxy - else - PROXY=$HTTP_PROXY - fi -fi - - -if [ $ISDEBIAN = "False" ] -then - 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 < +# Copyright (C) Jordan Mantha +# +# 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 diff --git a/pbuilder-dist.bash_completion b/pbuilder-dist.bash_completion deleted file mode 100644 index a00b951..0000000 --- a/pbuilder-dist.bash_completion +++ /dev/null @@ -1,31 +0,0 @@ -# Debian GNU/Linux cowbuilder(1) completion -# Copyright 2007 Cyril Brulebois -# -# 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 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 diff --git a/setup.py b/setup.py index ecd01a3..7b18fdb 100755 --- a/setup.py +++ b/setup.py @@ -19,18 +19,21 @@ setup(name='ubuntu-dev-tools', 'check-symbols', 'get-branches', 'pbuilder-dist', + 'pbuilder-dist-simple', 'update-maintainer', 'dch-repeat', 'mk-sbuild-lv', 'pull-debian-debdiff', 'what-patch', 'suspicious-source', - 'ppaput', 'requestsync', 'hugdaylist', 'massfile', 'submittodebian', 'get-build-deps', - 'dgetlp' + 'dgetlp', + 'reverse-build-depends', + 'grab-attachments', ], + packages=['ubuntutools'], ) diff --git a/submittodebian b/submittodebian index 1288f71..209fe7b 100755 --- a/submittodebian +++ b/submittodebian @@ -28,6 +28,10 @@ except ImportError: print 'This utility requires modules from the «python-debian» package, which isn\'t currently installed.' 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): for v in changelog.get_versions(): if not re.search('(ubuntu|build)', v.full_version): diff --git a/suspicious-source b/suspicious-source index c6cbe35..a45d2f3 100755 --- a/suspicious-source +++ b/suspicious-source @@ -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 \ depcomp *.docbook *.desktop *.menu AUTHORS INSTALL NEWS README TODO \ 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" diff --git a/ubuntutools/__init__.py b/ubuntutools/__init__.py new file mode 100644 index 0000000..40a7c42 --- /dev/null +++ b/ubuntutools/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# +# Ubuntu Development Tools +# https://launchpad.net/ubuntu-dev-tools diff --git a/ppaput b/ubuntutools/ppaput.py similarity index 65% rename from ppaput rename to ubuntutools/ppaput.py index eb43837..7e291aa 100755 --- a/ppaput +++ b/ubuntutools/ppaput.py @@ -1,19 +1,8 @@ -#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2007, Canonical, Daniel Holbach -# -# GPL 3 -# -# -# 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 -# +# Modified by Andrew Hunter +# License: GPLv3 import re import os @@ -23,26 +12,15 @@ import string try: import launchpadbugs.connector as Connector except: - print >> sys.stderr, \ - "You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput." + raise ImportError, "You need python-launchpad-bugs (>= 0.2.14) installed to use ppaput." sys.exit(1) #try: # import apt #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) - -USAGE = \ -"""Usage: ppaput [-n] [] [] - --n to file a new bug - dput alias - options that are passed to debuild(1) -""" - - def dput_check(): if not os.path.exists("/usr/bin/dput"): print >> sys.stderr, "You need to install the dput package." @@ -111,12 +89,16 @@ def get_name_version_section_and_release(): version, \ release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0] section = "main" - - 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) + +# +#Is this nessicary? All ppa install to main now. +# + +# 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) @@ -189,38 +171,6 @@ def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage, 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): Bug = Connector.ConnectBug() Bug.authentication = os.path.expanduser("~/.lpcookie") @@ -242,36 +192,3 @@ def file_bug(sourcepackage, version): (bug.bugnumber, 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() diff --git a/update-maintainer b/update-maintainer index b2c41a1..808ee7b 100755 --- a/update-maintainer +++ b/update-maintainer @@ -2,14 +2,14 @@ # Copyright 2007 (C) Albin Tonnerre (Lutin) # 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. usage() { cat <&2 && exit 1 section=$value ;; - "--nochangelog") + "--nochangelog"|"--no-changelog") nochangelog=1 ;; "--help") @@ -55,10 +55,17 @@ else echo "Please execute «$0» in the source folder." >&2 && exit 1 fi -[ -n "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ] && -! grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null || \ -{ echo "Not an Ubuntu package or already maintained by the Ubuntu team." >&2; \ -exit 1; } +if [ -z "$(head -1 $DEBIANDIR/changelog | grep -E '\(*ubuntu.*\)')" ] +then + echo "Latest changelog entry has no Ubuntu version number." >&2 + 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 DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1) @@ -70,6 +77,7 @@ if [ -z "$section" ]; then fi section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main fi + case $section in "main"|"restricted") email="Ubuntu Core Developers " ;; "universe"|"multiverse") email="Ubuntu MOTU Developers " ;;