diff --git a/404main b/404main index 7e4a7a7..fb7c01e 100755 --- a/404main +++ b/404main @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # The author of this script is unknown # License: Public Domain # @@ -63,5 +64,3 @@ find_main(pkg,0) for j in packages: if packages[(j)] == "Not in main": print j + ": "+packages[(j)] - - diff --git a/debian/changelog b/debian/changelog index 410482c..3aa1845 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,20 @@ ubuntu-dev-tools (0.21) UNRELEASED; urgency=low [ Siegfried-Angel Gevatter Pujals (RainCT) ] * Add get-build-deps and it's documentation. + * Change the character encoding on all Python scripts to UTF-8 + * submittodebian: better changelog location detection + * submittodebian: user-friendly error if python-debian isn't installed + * hugdaylist: improve error handling (less backtraces, more nice messages) + * pbuilder-dist: look for global variable $PBUILDFOLDER (LP: #160769) + * pbuilder-dist: check pbuilder version and only use --components if supported + * pbuilder-dist: don't chown "unknown distribution" warning if an environment + of that release already exists (LP: #160769) - -- Siegfried-Angel Gevatter Pujals (RainCT) Sat, 27 Oct 2007 23:03:42 +0200 + [ Luke Yelavich ] + * debian/control: + - Move homepage to its own field in source package section. + + -- Luke Yelavich Thu, 08 Nov 2007 09:38:46 +1100 ubuntu-dev-tools (0.20) hardy; urgency=low diff --git a/debian/control b/debian/control index 4108050..b82e819 100644 --- a/debian/control +++ b/debian/control @@ -7,6 +7,7 @@ XS-Vcs-Browser: http://codebrowse.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/tru Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5), python-central (>= 0.5), python-all-dev (>= 2.4) Build-Depends-Indep: docbook2x XS-Python-Version: all +Homepage: https://launchpad.net/ubuntu-dev-tools/ Standards-Version: 3.7.2 Package: ubuntu-dev-tools @@ -21,5 +22,3 @@ Description: useful tools for Ubuntu developers This is a collection of useful tools that Ubuntu developers use to make their packaging work a lot easier. Such tools can include bug filing, packaging preparation, package analysis, etc. - . - Homepage: https://launchpad.net/ubuntu-dev-tools/ diff --git a/get-branches b/get-branches index b168ea4..58ec3c5 100755 --- a/get-branches +++ b/get-branches @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # Copyright 2007 (C) Canonical Ltd. # Created by Daniel Holbach # License: GPLv3 diff --git a/hugdaylist b/hugdaylist index ec7cdd3..42b2fe2 100755 --- a/hugdaylist +++ b/hugdaylist @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # Copyright 2007, Canonical, Daniel Holbach # @@ -18,6 +19,7 @@ import string try: import launchpadbugs.connector as Connector + import launchpadbugs.bughelper_error as ConnectorErrors BugList = Connector.ConnectBugList() Bug = Connector.ConnectBug() except: @@ -35,13 +37,16 @@ def check_args(): if len(sys.argv) < 2: print >> sys.stderr, USAGE sys.exit(1) - + if sys.argv[1] == "-n": howmany = int(sys.argv[2]) + if len(sys.argv) < 4: + print USAGE + sys.exit(1) url = sys.argv[3] else: url = sys.argv[1] - + return (howmany, url) def filter_unsolved(bugs): @@ -59,7 +64,13 @@ def filter_unsolved(bugs): def main(): (howmany, url) = check_args() - l = BugList(url).filter(func=[filter_unsolved]) + try: + l = BugList(url).filter(func=[filter_unsolved]) + except ConnectorErrors.LPUrlError: + print "Couldn't load «%s»." % url + sys.exit(1) + except KeyboardInterrupt: + sys.exit(1) # User aborted, no need to print a backtrace if not l.bugs: print "BugList of %s is empty." % url diff --git a/massfile b/massfile index b8861d9..e927a82 100755 --- a/massfile +++ b/massfile @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # (C) Canonical, 2007, GPL v3 diff --git a/pbuilder-dist b/pbuilder-dist index 1b65b47..17bb323 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -14,9 +14,10 @@ # 'pbuilder-feisty-i386', etc. # Base directory where pbuilder will put all the files it creates +# This is overriden by the global variable $PBUILDFOLDER BASE_DIR="$HOME/pbuilder" -# Enable additional repositories by default? (universe and multiverse in Ubuntu, +# Enable additional components by default? (universe and multiverse in Ubuntu, # contrib and non-free in Debian.) EXTRACOMP=1 @@ -32,6 +33,11 @@ SYSCACHE=1 ARCH=`dpkg-architecture -qDEB_HOST_ARCH` SYSDIST=`lsb_release -cs` +if [ $PBUILDFOLDER ] && [ $PBUILDFOLDER != "" ] +then + BASE_DIR=$PBUILDFOLDER +fi + help() { echo "Insufficient number of arguments." @@ -94,10 +100,12 @@ distdata() if [ "$1" = "debian" ] then # Set Debian specific data + ISDEBIAN=True ARCHIVE="http://ftp.debian.org" COMPONENTS="main"$( [ $EXTRACOMP = 0 ] || echo " contrib non-free" ) else # Set Ubuntu specific data + ISDEBIAN=False ARCHIVE="http://archive.ubuntu.com/ubuntu" COMPONENTS="main restricted"$( [ $EXTRACOMP = 0 ] || echo " universe multiverse" ) fi @@ -114,16 +122,17 @@ case $DISTRIBUTION in ;; *) - echo "Warning: Unknown distribution «$DISTRIBUTION»." - echo -n "Continue [y/N]? " - read continue - - if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ] + if [ ! -d $BASE_DIR/${DISTRIBUTION}-* ] then - echo "Aborting..." - exit 1 + 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 @@ -160,6 +169,20 @@ 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 + 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 \"\" --components \"$COMPONENTS\"" +else + # else, do it the old way + COMPONENTS_LINE="--othermirror \"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\"" +fi + sudo pbuilder $OPERATION \ --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ --distribution $DISTRIBUTION \ @@ -168,6 +191,5 @@ sudo pbuilder $OPERATION \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ --buildresult $BASE_DIR/${FOLDERBASE}_result \ --mirror "$ARCHIVE" \ - --othermirror "" \ - --components "$COMPONENTS" \ + $COMPONENTS_LINE \ $@ diff --git a/ppaput b/ppaput index 71991da..eb43837 100755 --- a/ppaput +++ b/ppaput @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # Copyright 2007, Canonical, Daniel Holbach # diff --git a/requestsync b/requestsync index 64da9a4..24f4525 100755 --- a/requestsync +++ b/requestsync @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # (C) 2007 Canonical Ltd, Steve Kowalik # Authors: diff --git a/submittodebian b/submittodebian index b29b1fd..8899ff8 100755 --- a/submittodebian +++ b/submittodebian @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # submittodebian - tool to submit patches to Debian's bts # Copyright (C) 2007 Canonical Ltd. @@ -18,11 +19,15 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -from debian_bundle.changelog import Changelog import re, os, sys from tempfile import mkstemp +try: + from debian_bundle.changelog import Changelog +except ImportError: + print 'This utility requires modules from the «python-debian» 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): @@ -54,11 +59,14 @@ def gen_debdiff(changelog): return debdiff -def check_file(fname): - if not os.path.exists(fname): - print "Couldn't find %s\n" % fname +def check_file(fname, critical = True): + if os.path.exists(fname): + return fname + else: + if not critical: return False + print "Couldn't find «%s».\n" % fname sys.exit(1) - + def edit_debdiff(debdiff): cmd = 'sensible-editor %s' % (debdiff) run_cmd(cmd) @@ -72,9 +80,8 @@ def run_cmd(cmd): print "%s\n" % cmd os.system(cmd) -check_file('debian/changelog') - -changelog = Changelog(file('debian/changelog').read()) +changelog_file = check_file('debian/changelog', critical = no) or check_file('../debian/changelog') +changelog = Changelog(file(changelog_file).read()) deb_version = get_most_recent_debian_version(changelog) bug_body = get_bug_body(changelog)