From 5df17d12fc5e5c27e592a6a65dcda181da12b531 Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Tue, 22 Jan 2008 20:11:59 +0100 Subject: [PATCH 01/33] Add a missing option to pbuilder-dist.bash_completion. --- pbuilder-dist.bash_completion | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pbuilder-dist.bash_completion b/pbuilder-dist.bash_completion index a00b951..a8c065f 100644 --- a/pbuilder-dist.bash_completion +++ b/pbuilder-dist.bash_completion @@ -1,11 +1,13 @@ -# Debian GNU/Linux cowbuilder(1) completion -# Copyright 2007 Cyril Brulebois +# pbuilder-dist completion # -# This script can be distributed under the same license as the -# cowdancer or bash packages. +# Copyright 2008 Stephan Hermann , created for +# the Ubuntu MOTU Team. # -# adapted to pbuilderdist, the license is GPLv2 or later. -# Copyright 2008 Stephan Hermann 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() @@ -15,7 +17,8 @@ _pbuilder-dist() COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - options='create update build login execute' + + options='create update build clean login execute' case $prev in build) From 3926737aab5b33ab10e70448622a611a6b92026b Mon Sep 17 00:00:00 2001 From: Andrew Hunter Date: Fri, 15 Feb 2008 12:22:35 -0500 Subject: [PATCH 02/33] Seperated ppaput into python module and script. --- ppaput | 273 +++++++----------------------------------------------- ppaput.py | 206 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+), 241 deletions(-) create mode 100755 ppaput.py diff --git a/ppaput b/ppaput index eb43837..7020e52 100755 --- a/ppaput +++ b/ppaput @@ -1,258 +1,48 @@ #!/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 -# -import re import os import sys -import string - -try: - import launchpadbugs.connector as Connector -except: - print >> sys.stderr, \ - "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." -# sys.exit(1) - +import ppaput +from optparse import OptionParser USAGE = \ """Usage: ppaput [-n] [] [] --n to file a new bug - dput alias - options that are passed to debuild(1) -""" +See debuild(1) for more information on debuild options.""" +parser = OptionParser(usage=USAGE) +parser.add_option('-n', action='store_true', dest='new_bug', help='File a new bug on Launchpad', default=False) +parser.disable_interspersed_args() +(options, args) = parser.parse_args() -def dput_check(): - if not os.path.exists("/usr/bin/dput"): - print >> sys.stderr, "You need to install the dput package." - sys.exit(1) - - -def find_fixed_launchpad_bug(changesfile): - changes = open(changesfile).readlines() - for line in changes: - if line.startswith("Launchpad-Bugs-Fixed"): - return line.split(":")[1].split() - return [] - - -def call_dput(location, changes): - dput_check() - - incoming = "" - res = False - - (dummy, output, dummy) = os.popen3("dput --debug %s %s" % (location, changes)) - text = output.readlines() - for line in text: - if line.startswith("D: Incoming: "): - incoming = line.split("D: Incoming: ")[1].strip() - if incoming[-1] == "/": - incoming = incoming[:-1] - if line.startswith("Successfully uploaded packages."): - res = True - return (res, incoming) - - -def lookup_dput_host(host): - dput_check() - (dummy, output, dummy) = os.popen3("dput -H | grep ^%s" % host) - text = output.read() - if text: - return text.split()[2] - return "" - - -def call_debuild(options): -# FIXME: this requires magic, that figures out when to use --native --working, -# etc. -# if os.path.exists(".bzr") and os.path.exists("/usr/bin/bzr-buildpackage"): -# return os.system("bzr bd -S --builder='-k%s %s'" % \ -# (os.getenv("DEBEMAIL"), \ -# string.join(options, " "))) == 0 -# else: - return os.system("debuild -S -k%s %s" % \ - (os.getenv("DEBEMAIL"), \ - string.join(options, " "))) == 0 - -def get_name_version_section_and_release(): - changelogfile = "debian/changelog" - if not os.path.exists(changelogfile): - print >> sys.stderr, "%s not found." % changelogfile - sys.exit(1) - controlfile = "debian/control" - if not os.path.exists(controlfile): - print >> sys.stderr, "%s not found." % controlfile - sys.exit(1) - - head = open(changelogfile).readline() - (name, \ - 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) - - return (name, version, section, release) - -def assemble_bug_comment_text(host, incoming, section, sourcepackage, version, - release): - if host == "ppa.launchpad.net": - dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \ - (host, incoming[1:], section, sourcepackage[0], sourcepackage, \ - sourcepackage, version) - else: -# FIXME: this needs to be much much cleverer at some stage - dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \ - (host, incoming, section, sourcepackage[0], sourcepackage, version) - return """A new version of %s was uploaded to fix this bug. - -To review the source the current version, please run - - dget -x %s - - -The package will get built by Launchpad in a while. If you want to test it, -please run the following commands: - - sudo -s - echo >> /etc/apt/sources.list - echo "deb http://%s/%s %s main universe multiverse restricted" >> /etc/apt/sources.list - apt-get update - apt-get install -""" % (sourcepackage, dsc_file_location, host, incoming[1:], release) - - -def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage, - version, release): - if not os.path.exists(os.path.expanduser("~/.lpcookie")): - print >> sys.stderr, \ - "You need your Launchpad Cookie to be stored in ~/.lpcookie" - sys.exit(1) - - #print apt.Cache()[sourcepackage].section.split("/")[0].count("verse") - (dummy, output, dummy) = os.popen3( -"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \ - sourcepackage) - component = output.read().strip() - - Bug = Connector.ConnectBug() - Bug.authentication = os.path.expanduser("~/.lpcookie") - - for bugnumber in bugnumbers: - bug = Bug(int(bugnumber)) - if component in ["main", "restricted"] and \ - 'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers]: - bug.subscribers.add('ubuntu-main-sponsors') - if component in ["universe", "multiverse"] and \ - 'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers]: - bug.subscribers.add('ubuntu-universe-sponsors') - if not component: - bug.tags.append("needs-packaging") - - comment = Bug.NewComment(text=assemble_bug_comment_text(host, incoming, - section, - sourcepackage, - version, - release), - subject="Fix in %s (%s)" % \ - (sourcepackage, version)) - bug.comments.add(comment) - - if bug.status != "Fix Committed": - bug.status = "Fix Committed" - bug.commit() - - -def check_arguments(args): - new_bug = False +def check_arguments(): 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") + debuild_args = [] try: - bug = Bug.New(product={"name": sourcepackage, "target": "ubuntu"}, - summary="Please sponsor %s %s" % \ - (sourcepackage, version), - description=\ - "The new package will be uploaded to PPA shortly.") - except: - bug = Bug.New(product={"name": "ubuntu"}, - summary="Please sponsor %s %s" % \ - (sourcepackage, version), - description=\ - "The new package will be uploaded to PPA shortly.") + if args[0].startswith("-"): + debuild_args = args + else: + location = args[0] + debuild_args = args[1:] + except IndexError: + print "No location or arguments given, using defaults" - print "Successfully filed bug %s: http://launchpad.net/bugs/%s" % \ - (bug.bugnumber, bug.bugnumber) - - return bug.bugnumber - + return (location, debuild_args) 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) + (location, debuild_args) = check_arguments() + print location + print debuild_args + + (sourcepackage, version, \ + section, release) = ppaput.get_name_version_section_and_release() + + if options.new_bug: + bugnumber = ppaput.file_bug(sourcepackage, version) os.system("dch -a 'Fixes (LP: #%s)'" % bugnumber) - if not call_debuild(debuild_args): + if not ppaput.call_debuild(debuild_args): sys.exit(1) changesfile = "../%s_%s_source.changes" % (sourcepackage, version) @@ -261,17 +51,18 @@ def main(): os.path.expanduser(changesfile) sys.exit(1) - host = lookup_dput_host(location) - (dput_res, incoming) = call_dput(location, changesfile) + host = ppaput.lookup_dput_host(location) + (dput_res, incoming) = ppaput.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): + fixed_lp_bugs = ppaput.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/ppaput.py b/ppaput.py new file mode 100755 index 0000000..66ebecf --- /dev/null +++ b/ppaput.py @@ -0,0 +1,206 @@ +#!/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 +# + +import re +import os +import sys +import string + +try: + import launchpadbugs.connector as Connector +except: + print >> sys.stderr, \ + "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." +# sys.exit(1) + +def dput_check(): + if not os.path.exists("/usr/bin/dput"): + print >> sys.stderr, "You need to install the dput package." + sys.exit(1) + + +def find_fixed_launchpad_bug(changesfile): + changes = open(changesfile).readlines() + for line in changes: + if line.startswith("Launchpad-Bugs-Fixed"): + return line.split(":")[1].split() + return [] + + +def call_dput(location, changes): + dput_check() + + incoming = "" + res = False + + (dummy, output, dummy) = os.popen3("dput --debug %s %s" % (location, changes)) + text = output.readlines() + for line in text: + if line.startswith("D: Incoming: "): + incoming = line.split("D: Incoming: ")[1].strip() + if incoming[-1] == "/": + incoming = incoming[:-1] + if line.startswith("Successfully uploaded packages."): + res = True + return (res, incoming) + + +def lookup_dput_host(host): + dput_check() + (dummy, output, dummy) = os.popen3("dput -H | grep ^%s" % host) + text = output.read() + if text: + return text.split()[2] + return "" + + +def call_debuild(options): +# FIXME: this requires magic, that figures out when to use --native --working, +# etc. +# if os.path.exists(".bzr") and os.path.exists("/usr/bin/bzr-buildpackage"): +# return os.system("bzr bd -S --builder='-k%s %s'" % \ +# (os.getenv("DEBEMAIL"), \ +# string.join(options, " "))) == 0 +# else: + return os.system("debuild -S -k%s %s" % \ + (os.getenv("DEBEMAIL"), \ + string.join(options, " "))) == 0 + +def get_name_version_section_and_release(): + changelogfile = "debian/changelog" + if not os.path.exists(changelogfile): + print >> sys.stderr, "%s not found." % changelogfile + sys.exit(1) + controlfile = "debian/control" + if not os.path.exists(controlfile): + print >> sys.stderr, "%s not found." % controlfile + sys.exit(1) + + head = open(changelogfile).readline() + (name, \ + version, \ + release) = re.findall(r'^(.*)\ \((.*)\)\ (.*?)\;\ .*', head)[0] + section = "main" + +# +#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) + +def assemble_bug_comment_text(host, incoming, section, sourcepackage, version, + release): + if host == "ppa.launchpad.net": + dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \ + (host, incoming[1:], section, sourcepackage[0], sourcepackage, \ + sourcepackage, version) + else: +# FIXME: this needs to be much much cleverer at some stage + dsc_file_location = "http://%s/%s/pool/%s/%s/%s/%s_%s.dsc" % \ + (host, incoming, section, sourcepackage[0], sourcepackage, version) + return """A new version of %s was uploaded to fix this bug. + +To review the source the current version, please run + + dget -x %s + + +The package will get built by Launchpad in a while. If you want to test it, +please run the following commands: + + sudo -s + echo >> /etc/apt/sources.list + echo "deb http://%s/%s %s main universe multiverse restricted" >> /etc/apt/sources.list + apt-get update + apt-get install +""" % (sourcepackage, dsc_file_location, host, incoming[1:], release) + + +def deal_with_bugreport(bugnumbers, host, section, incoming, sourcepackage, + version, release): + if not os.path.exists(os.path.expanduser("~/.lpcookie")): + print >> sys.stderr, \ + "You need your Launchpad Cookie to be stored in ~/.lpcookie" + sys.exit(1) + + #print apt.Cache()[sourcepackage].section.split("/")[0].count("verse") + (dummy, output, dummy) = os.popen3( +"apt-cache showsrc %s | grep Directory | cut -d' ' -f2 | cut -d'/' -f2" % \ + sourcepackage) + component = output.read().strip() + + Bug = Connector.ConnectBug() + Bug.authentication = os.path.expanduser("~/.lpcookie") + + for bugnumber in bugnumbers: + bug = Bug(int(bugnumber)) + if component in ["main", "restricted"] and \ + 'ubuntu-main-sponsors' not in [str(s) for s in bug.subscribers]: + bug.subscribers.add('ubuntu-main-sponsors') + if component in ["universe", "multiverse"] and \ + 'ubuntu-universe-sponsors' not in [str(s) for s in bug.subscribers]: + bug.subscribers.add('ubuntu-universe-sponsors') + if not component: + bug.tags.append("needs-packaging") + + comment = Bug.NewComment(text=assemble_bug_comment_text(host, incoming, + section, + sourcepackage, + version, + release), + subject="Fix in %s (%s)" % \ + (sourcepackage, version)) + bug.comments.add(comment) + + if bug.status != "Fix Committed": + bug.status = "Fix Committed" + bug.commit() + + +def file_bug(sourcepackage, version): + Bug = Connector.ConnectBug() + Bug.authentication = os.path.expanduser("~/.lpcookie") + + try: + bug = Bug.New(product={"name": sourcepackage, "target": "ubuntu"}, + summary="Please sponsor %s %s" % \ + (sourcepackage, version), + description=\ + "The new package will be uploaded to PPA shortly.") + except: + bug = Bug.New(product={"name": "ubuntu"}, + summary="Please sponsor %s %s" % \ + (sourcepackage, version), + description=\ + "The new package will be uploaded to PPA shortly.") + + print "Successfully filed bug %s: http://launchpad.net/bugs/%s" % \ + (bug.bugnumber, bug.bugnumber) + + return bug.bugnumber From 83415fb564fe3291ad38b32354b691c1abc4a1ac Mon Sep 17 00:00:00 2001 From: Andrew Hunter Date: Fri, 15 Feb 2008 13:09:34 -0500 Subject: [PATCH 03/33] Updated debian packaging. --- debian/changelog | 10 +++++++++- debian/control | 11 ++++++++++- setup.py | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e358834..9020568 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,7 +12,15 @@ 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 02:23:44 +0100 + [ Andrew Hunter ] + * Use install files as we have multiple binaries now. + * ppaput: + * Separated ppaput script from backend python modules (shipped in + python-ppaput). (LP: #192184) + * Switched from homegrown option parseing to Optparse, much more + robust and less code duplication. + + -- Andrew Hunter Fri, 15 Feb 2008 13:08:12 -0500 ubuntu-dev-tools (0.25) hardy; urgency=low diff --git a/debian/control b/debian/control index 5e18b06..64d904a 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ 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 +Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), reportbug (>= 3.39ubuntu1), python-debian, dctrl-tools, lsb-release, python-ppaput Recommends: bzr, pbuilder Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) @@ -22,3 +22,12 @@ 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. + +Package: python-ppaput +Architecture: all +Section: python +Depends: ${python:Depends} +XB-Python-Version: ${python:Versions} +Description: python module for uploading to PPAs. + python-ppaput is a python module that abstracts the process of creating and + uploading Debian source packages to Personal Package Archives. diff --git a/setup.py b/setup.py index ecd01a3..b42befe 100755 --- a/setup.py +++ b/setup.py @@ -33,4 +33,5 @@ setup(name='ubuntu-dev-tools', 'get-build-deps', 'dgetlp' ], + py_modules=['ppaput'], ) From a728639b4eb3c4f236cf071df4bb0aa78cc570f6 Mon Sep 17 00:00:00 2001 From: Andrew Hunter Date: Fri, 15 Feb 2008 13:16:14 -0500 Subject: [PATCH 04/33] Forgot to add .install files... --- debian/python-ppaput.install | 1 + debian/ubuntu-dev-tools.install | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 debian/python-ppaput.install create mode 100644 debian/ubuntu-dev-tools.install diff --git a/debian/python-ppaput.install b/debian/python-ppaput.install new file mode 100644 index 0000000..bd6b984 --- /dev/null +++ b/debian/python-ppaput.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/python2.5/site-packages/ppaput.py diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install new file mode 100644 index 0000000..9e3c460 --- /dev/null +++ b/debian/ubuntu-dev-tools.install @@ -0,0 +1,17 @@ +debian/tmp/usr/bin/404main +debian/tmp/usr/bin/check-symbols +debian/tmp/usr/bin/dch-repeat +debian/tmp/usr/bin/dgetlp +debian/tmp/usr/bin/get-branches +debian/tmp/usr/bin/get-build-deps +debian/tmp/usr/bin/hugdaylist +debian/tmp/usr/bin/massfile +debian/tmp/usr/bin/mk-sbuild-lv +debian/tmp/usr/bin/pbuilder-dist +debian/tmp/usr/bin/ppaput +debian/tmp/usr/bin/pull-debian-debdiff +debian/tmp/usr/bin/requestsync +debian/tmp/usr/bin/submittodebian +debian/tmp/usr/bin/suspicious-source +debian/tmp/usr/bin/update-maintainer +debian/tmp/usr/bin/what-patch From abaa5f068a192eb8458f0ad437c9a7361767492e Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 17 Feb 2008 18:29:47 +0100 Subject: [PATCH 05/33] Many changes (most related to manpages). --- .../pbuilder-dist | 1 - check-symbols | 2 +- debian/changelog | 6 ++- debian/rules | 4 -- debian/ubuntu-dev-tools.install | 1 + doc/404main.1 | 21 +++++++++ doc/check-symbols.1 | 26 +++++------ doc/get-build-deps.1 | 43 ++++++++++--------- doc/suspicious-source.1 | 39 ++++++++--------- doc/update-maintainer.1 | 34 +++++++++++++++ 10 files changed, 113 insertions(+), 64 deletions(-) rename pbuilder-dist.bash_completion => bash_completion/pbuilder-dist (99%) create mode 100644 doc/404main.1 create mode 100644 doc/update-maintainer.1 diff --git a/pbuilder-dist.bash_completion b/bash_completion/pbuilder-dist similarity index 99% rename from pbuilder-dist.bash_completion rename to bash_completion/pbuilder-dist index a8c065f..3011775 100644 --- a/pbuilder-dist.bash_completion +++ b/bash_completion/pbuilder-dist @@ -8,7 +8,6 @@ # Based upon cobwuilder's autocompletion, Copyright 2007 Cyril # Brulebois - have pbuilder-dist && _pbuilder-dist() { diff --git a/check-symbols b/check-symbols index 5498107..ccc74c7 100755 --- a/check-symbols +++ b/check-symbols @@ -63,4 +63,4 @@ do diff -u /tmp/$LIBNAME.{1,2}; rm /tmp/$LIBNAME.{1,2}; done; -done +done diff --git a/debian/changelog b/debian/changelog index a4c2827..292b63e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,10 +21,14 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low robust and less code duplication. [ Siegfried-Angel Gevatter Pujals (RainCT) ] - * Add a manpage for update-maintainer. + * 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. -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 17:36:11 +0100 diff --git a/debian/rules b/debian/rules index c9d7a1c..c2b9d93 100755 --- a/debian/rules +++ b/debian/rules @@ -10,9 +10,5 @@ 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 diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install index 9e3c460..f410afb 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -15,3 +15,4 @@ debian/tmp/usr/bin/submittodebian debian/tmp/usr/bin/suspicious-source debian/tmp/usr/bin/update-maintainer debian/tmp/usr/bin/what-patch +bash_completion/* etc/bash_completion.d/pbuilder-dist diff --git a/doc/404main.1 b/doc/404main.1 new file mode 100644 index 0000000..f661f6d --- /dev/null +++ b/doc/404main.1 @@ -0,0 +1,21 @@ +.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> + +.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 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 66ad7b4..2077f8b 100644 --- a/doc/get-build-deps.1 +++ b/doc/get-build-deps.1 @@ -7,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 @@ -40,13 +40,14 @@ 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), @@ -54,5 +55,5 @@ the indicated versions, but just installs the newest one available in the reposi .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/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..8d19e15 --- /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 +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. From 498b7d681dc3dfc22101e000f7fd6e10fc941fef Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 17 Feb 2008 19:27:32 +0100 Subject: [PATCH 06/33] Fixes in pbuilder-dist (seems it works now, but needs testing) --- debian/changelog | 1 + pbuilder-dist | 37 ++++++++++--------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/debian/changelog b/debian/changelog index 292b63e..dbc7ab0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,6 +29,7 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low 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 17:36:11 +0100 diff --git a/pbuilder-dist b/pbuilder-dist index 982f32d..644f9a7 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -186,21 +186,6 @@ 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 ] @@ -211,7 +196,6 @@ then fi fi - if [ $ISDEBIAN = "False" ] then if [ ! -d $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ ] @@ -234,9 +218,9 @@ EOF fi fi -if [ -z $PBUILDAUTH ] +if [ -z "$PBUILDAUTH" ] then - if [ -n $DESKTOP_SESSION ] + if [ -n "$DESKTOP_SESSION" ] then case $DESKTOP_SESSION in gnome ) @@ -256,16 +240,15 @@ else SUDOREPLACE=$PBUILDAUTH fi -echo $@ - -$SUDOREPLACE -- pbuilder $OPERATION \ ---basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ ---distribution $DISTRIBUTION \ +sudo pbuilder $OPERATION \ +--basetgz "$BASE_DIR/$FOLDERBASE-base.tgz" \ +--distribution "$DISTRIBUTION" \ --debootstrapopts --arch \ ---debootstrapopts $BINARCH \ +--debootstrapopts "$BINARCH" \ $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ $( [ -z $PROXY ] || echo "--http-proxy $PROXY" ) \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ ---buildresult $BASE_DIR/$FOLDERBASE_result \ ---mirror $ARCHIVE \ ---aptconfdir $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ $@ +--buildresult "$BASE_DIR/$FOLDERBASE_result" \ +--mirror "$ARCHIVE" \ +--aptconfdir "$BASE_DIR/etc/$DISTRIBUTION/apt.conf/" \ +$@ From b0aa6da47262d077db9218bba255ad3815a3eff4 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 17 Feb 2008 20:22:23 +0100 Subject: [PATCH 07/33] Use wildcards in debian/*.install. --- debian/python-ppaput.install | 2 +- debian/ubuntu-dev-tools.install | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/debian/python-ppaput.install b/debian/python-ppaput.install index bd6b984..9ecadfb 100644 --- a/debian/python-ppaput.install +++ b/debian/python-ppaput.install @@ -1 +1 @@ -debian/tmp/usr/lib/python2.5/site-packages/ppaput.py +debian/tmp/usr/lib/python2.5/site-packages/*.py diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install index f410afb..83e5341 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -1,18 +1,2 @@ -debian/tmp/usr/bin/404main -debian/tmp/usr/bin/check-symbols -debian/tmp/usr/bin/dch-repeat -debian/tmp/usr/bin/dgetlp -debian/tmp/usr/bin/get-branches -debian/tmp/usr/bin/get-build-deps -debian/tmp/usr/bin/hugdaylist -debian/tmp/usr/bin/massfile -debian/tmp/usr/bin/mk-sbuild-lv -debian/tmp/usr/bin/pbuilder-dist -debian/tmp/usr/bin/ppaput -debian/tmp/usr/bin/pull-debian-debdiff -debian/tmp/usr/bin/requestsync -debian/tmp/usr/bin/submittodebian -debian/tmp/usr/bin/suspicious-source -debian/tmp/usr/bin/update-maintainer -debian/tmp/usr/bin/what-patch +debian/tmp/usr/bin/* bash_completion/* etc/bash_completion.d/pbuilder-dist From 737d0f8ad4663770f9f22cf97c78f4d4f2335086 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 17 Feb 2008 23:39:10 +0100 Subject: [PATCH 08/33] Released version 0.26 (with only some of the current changes); updated changelog. Other changes. --- debian/changelog | 34 +++++++++++++++++++-------- debian/control | 17 +++++++++----- debian/pycompat | 1 - debian/rules | 2 +- doc/ppaput.1.docbook | 2 +- doc/update-maintainer.1 | 2 +- ppaput | 16 ++++++++++++- ppaput.py => python_modules/ppaput.py | 20 ++++------------ setup.py | 2 +- submittodebian | 4 ++++ 10 files changed, 62 insertions(+), 38 deletions(-) delete mode 100644 debian/pycompat rename ppaput.py => python_modules/ppaput.py (90%) diff --git a/debian/changelog b/debian/changelog index dbc7ab0..a6e555b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,26 @@ -ubuntu-dev-tools (0.26) UNRELEASED; urgency=low +ubuntu-dev-tools (0.27) UNRELEASED; urgency=low + + [ Andrew Hunter ] + * Use install files as we have multiple binaries now. + * ppaput: + * Separated ppaput script from backend python modules (shipped in + python-ppaput). (LP: #192184) + * Switched from homegrown option parseing to Optparse, much more + robust and less code duplication. + + [ Siegfried-Angel Gevatter Pujals (RainCT) ] + * Remove wrong element from doc/ppaput.1.docbook. + * Move ppaput.py into new python_modules/directory and remove + it's shabang. + * Write a description for the new python-ubuntu-utils binary + package in debian/control. Add a "Suggests: ubuntu-dev-tools". + * Check for reportbug being installed in submittodebian. Replace + reportbug dependency with a Recommends. + * Remove debian/pycompat. + + -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 22:05:00 +0100 + +ubuntu-dev-tools (0.26) hardy; urgency=low [ Stephan Hermann ] * pbuild-dist: fixed a bug with the *sudo call. @@ -12,14 +34,6 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low (LP: #190351) * Exit, if versions in Ubuntu and Debian are the same already. - [ Andrew Hunter ] - * Use install files as we have multiple binaries now. - * ppaput: - * Separated ppaput script from backend python modules (shipped in - python-ppaput). (LP: #192184) - * Switched from homegrown option parseing to Optparse, much more - robust and less code duplication. - [ Siegfried-Angel Gevatter Pujals (RainCT) ] * Add manpages for update-maintainer and 404main. * Move pbuilder-dist.bash_completion into new bash_completion/ @@ -31,7 +45,7 @@ ubuntu-dev-tools (0.26) UNRELEASED; urgency=low doc/suspicious-source.1. * Fix some issues with the new pbuilder-dist code. - -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 17:36:11 +0100 + -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 19:35:46 +0100 ubuntu-dev-tools (0.25) hardy; urgency=low diff --git a/debian/control b/debian/control index 64d904a..fde21ab 100644 --- a/debian/control +++ b/debian/control @@ -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, python-ppaput -Recommends: bzr, pbuilder +Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), python-debian, dctrl-tools, lsb-release +Recommends: bzr, pbuilder, python-ubuntu-utils, reportbug (>= 3.39ubuntu1) Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) XB-Python-Version: ${python:Versions} @@ -23,11 +23,16 @@ Description: useful tools for Ubuntu developers make their packaging work a lot easier. Such tools can include bug filing, packaging preparation, package analysis, etc. -Package: python-ppaput +Package: python-ubuntu-utils Architecture: all Section: python Depends: ${python:Depends} +Suggests: ubuntu-dev-tools XB-Python-Version: ${python:Versions} -Description: python module for uploading to PPAs. - python-ppaput is a python module that abstracts the process of creating and - uploading Debian source packages to Personal Package Archives. +Description: useful Python modules for Ubuntu developers + This is a collection of useful Python modules that people interested + in Ubuntu development might find interesting. Those include: + . + * ppaput: a Python module that abstracts the process of creating and + uploading Debian source packages to Launchpad's Personal Package + Archives. 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 c2b9d93..623e240 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,6 @@ #!/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 diff --git a/doc/ppaput.1.docbook b/doc/ppaput.1.docbook index a415680..75b9bb8 100644 --- a/doc/ppaput.1.docbook +++ b/doc/ppaput.1.docbook @@ -73,7 +73,7 @@ the bug report. - If you use the option, it + If you use the option, it will also 1) file a bug and add 2) a (LP: #.....) header to the source package. diff --git a/doc/update-maintainer.1 b/doc/update-maintainer.1 index 8d19e15..351656a 100644 --- a/doc/update-maintainer.1 +++ b/doc/update-maintainer.1 @@ -22,7 +22,7 @@ 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\-\-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. diff --git a/ppaput b/ppaput index 7020e52..baab521 100755 --- a/ppaput +++ b/ppaput @@ -1,10 +1,24 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2007, Canonical, Daniel Holbach +# License: GPLv3 +# +# Builds a source package from the source tree you're currently in, +# uploads it to PPA and follow up on a bug report, subscribe the right +# sponsors and sets the right status - if you pass "-n" it will file a +# bug report and add "(LP: #....)" and to the changelog. import os import sys -import ppaput from optparse import OptionParser +try: + import ppaput +except ImportError: + print 'You need python-ubuntu-utils installed to use ppaput.' + sys.exit(1) + USAGE = \ """Usage: ppaput [-n] [] [] diff --git a/ppaput.py b/python_modules/ppaput.py similarity index 90% rename from ppaput.py rename to python_modules/ppaput.py index 66ebecf..7e291aa 100755 --- a/ppaput.py +++ b/python_modules/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,14 +12,13 @@ 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) def dput_check(): diff --git a/setup.py b/setup.py index b42befe..8b663c2 100755 --- a/setup.py +++ b/setup.py @@ -33,5 +33,5 @@ setup(name='ubuntu-dev-tools', 'get-build-deps', 'dgetlp' ], - py_modules=['ppaput'], + py_modules=['modules/ppaput.py'], ) 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): From ba584a26993cc6c326595724af70f137c22c6eaa Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Mon, 18 Feb 2008 17:33:02 +0100 Subject: [PATCH 09/33] Rename new binary to python-ubuntutools (ubuntutools is a namespace now). Minor changes. --- TODO | 3 +++ debian/changelog | 7 ++++--- debian/control | 8 ++++---- debian/copyright | 9 +++++---- ppaput | 2 +- .../python-ppaput.install => python-ubuntutools.install | 0 setup.py | 2 +- ubuntutools/__init__.py | 4 ++++ {python_modules => ubuntutools}/ppaput.py | 0 9 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 TODO rename debian/python-ppaput.install => python-ubuntutools.install (100%) create mode 100644 ubuntutools/__init__.py rename {python_modules => ubuntutools}/ppaput.py (100%) diff --git a/TODO b/TODO new file mode 100644 index 0000000..5593b44 --- /dev/null +++ b/TODO @@ -0,0 +1,3 @@ +- Create missing manpages (for all commands). +- Document ubuntutools Python modules. +- Add the process-interdiff script to ubuntu-dev-tools. diff --git a/debian/changelog b/debian/changelog index a6e555b..733dfc7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,12 +10,13 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low [ Siegfried-Angel Gevatter Pujals (RainCT) ] * Remove wrong element from doc/ppaput.1.docbook. - * Move ppaput.py into new python_modules/directory and remove + * Move ppaput.py into new ubuntutools/ directory and remove it's shabang. - * Write a description for the new python-ubuntu-utils binary + * Write a description for the new python-ubuntutools binary package in debian/control. Add a "Suggests: ubuntu-dev-tools". * Check for reportbug being installed in submittodebian. Replace reportbug dependency with a Recommends. + * Add ppaput to debian/copyright. * Remove debian/pycompat. -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 22:05:00 +0100 @@ -23,7 +24,7 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low 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 ] diff --git a/debian/control b/debian/control index fde21ab..97e91c1 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ 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), 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, python-ubuntu-utils, reportbug (>= 3.39ubuntu1) Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) @@ -23,15 +23,15 @@ Description: useful tools for Ubuntu developers make their packaging work a lot easier. Such tools can include bug filing, packaging preparation, package analysis, etc. -Package: python-ubuntu-utils +Package: python-ubuntutools Architecture: all Section: python Depends: ${python:Depends} Suggests: ubuntu-dev-tools XB-Python-Version: ${python:Versions} Description: useful Python modules for Ubuntu developers - This is a collection of useful Python modules that people interested - in Ubuntu development might find interesting. Those include: + This is a namespace of Python modules that people interested in + Ubuntu development might find useful. It include: . * ppaput: a Python module that abstracts the process of creating and uploading Debian source packages to Launchpad's Personal Package diff --git a/debian/copyright b/debian/copyright index f8c14e1..c558d70 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 Holbach @@ -17,8 +18,8 @@ Upstream Author: Steve Kowalik Terence Simpson - Copyright: + Copyright 2006-2007 (C) Canonical Ltd. Albert Damen 2007 Albin Tonnerre 2006-2007 @@ -49,8 +50,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/ppaput b/ppaput index baab521..ced3f57 100755 --- a/ppaput +++ b/ppaput @@ -14,7 +14,7 @@ import sys from optparse import OptionParser try: - import ppaput + import ubuntutools.ppaput except ImportError: print 'You need python-ubuntu-utils installed to use ppaput.' sys.exit(1) diff --git a/debian/python-ppaput.install b/python-ubuntutools.install similarity index 100% rename from debian/python-ppaput.install rename to python-ubuntutools.install diff --git a/setup.py b/setup.py index 8b663c2..dafc11d 100755 --- a/setup.py +++ b/setup.py @@ -33,5 +33,5 @@ setup(name='ubuntu-dev-tools', 'get-build-deps', 'dgetlp' ], - py_modules=['modules/ppaput.py'], + packages=['ubuntutools'], ) 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/python_modules/ppaput.py b/ubuntutools/ppaput.py similarity index 100% rename from python_modules/ppaput.py rename to ubuntutools/ppaput.py From 3e97b9f176bb02969943bf212b7bd64fd6091bba Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Mon, 18 Feb 2008 17:35:54 +0100 Subject: [PATCH 10/33] Remove empty usr/lib directory. --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index 623e240..5350360 100755 --- a/debian/rules +++ b/debian/rules @@ -10,5 +10,8 @@ DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 build/ubuntu-dev-tools:: docbook2x-man doc/ppaput.1.docbook; mv ppaput.1 doc +binary-install/python-ubuntutools:: + rm -rf debian/python-ubuntutools/usr/lib + clean:: rm -f doc/ppaput.1 From 36772683d0c97f8ef64b5b5e4b7b9a2184a1a867 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Fri, 22 Feb 2008 18:57:56 +0100 Subject: [PATCH 11/33] * 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. --- README | 6 -- debian/changelog | 7 ++- debian/rules | 6 -- doc/ppaput.1.docbook | 145 ------------------------------------------- ppaput | 82 ------------------------ setup.py | 1 - 6 files changed, 6 insertions(+), 241 deletions(-) delete mode 100644 doc/ppaput.1.docbook delete mode 100755 ppaput 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/debian/changelog b/debian/changelog index 733dfc7..9ed3fdd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,7 +19,12 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low * Add ppaput to debian/copyright. * Remove debian/pycompat. - -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 17 Feb 2008 22:05:00 +0100 + [ 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. + + -- Daniel Holbach Fri, 22 Feb 2008 18:55:21 +0100 ubuntu-dev-tools (0.26) hardy; urgency=low diff --git a/debian/rules b/debian/rules index 5350360..b43537e 100755 --- a/debian/rules +++ b/debian/rules @@ -7,11 +7,5 @@ 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 - binary-install/python-ubuntutools:: rm -rf debian/python-ubuntutools/usr/lib - -clean:: - rm -f doc/ppaput.1 diff --git a/doc/ppaput.1.docbook b/doc/ppaput.1.docbook deleted file mode 100644 index 75b9bb8..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/ppaput b/ppaput deleted file mode 100755 index ced3f57..0000000 --- a/ppaput +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright 2007, Canonical, Daniel Holbach -# License: GPLv3 -# -# Builds a source package from the source tree you're currently in, -# uploads it to PPA and follow up on a bug report, subscribe the right -# sponsors and sets the right status - if you pass "-n" it will file a -# bug report and add "(LP: #....)" and to the changelog. - -import os -import sys -from optparse import OptionParser - -try: - import ubuntutools.ppaput -except ImportError: - print 'You need python-ubuntu-utils installed to use ppaput.' - sys.exit(1) - -USAGE = \ -"""Usage: ppaput [-n] [] [] - -See debuild(1) for more information on debuild options.""" -parser = OptionParser(usage=USAGE) - -parser.add_option('-n', action='store_true', dest='new_bug', help='File a new bug on Launchpad', default=False) -parser.disable_interspersed_args() -(options, args) = parser.parse_args() - -def check_arguments(): - location = 'default' - debuild_args = [] - - try: - if args[0].startswith("-"): - debuild_args = args - else: - location = args[0] - debuild_args = args[1:] - except IndexError: - print "No location or arguments given, using defaults" - - return (location, debuild_args) - -def main(): - - (location, debuild_args) = check_arguments() - print location - print debuild_args - - (sourcepackage, version, \ - section, release) = ppaput.get_name_version_section_and_release() - - if options.new_bug: - bugnumber = ppaput.file_bug(sourcepackage, version) - os.system("dch -a 'Fixes (LP: #%s)'" % bugnumber) - if not ppaput.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 = ppaput.lookup_dput_host(location) - (dput_res, incoming) = ppaput.call_dput(location, changesfile) - if not dput_res: - print >> sys.stderr, "%s was not uploaded." % changesfile - sys.exit(1) - - fixed_lp_bugs = ppaput.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/setup.py b/setup.py index dafc11d..2a7bd96 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ setup(name='ubuntu-dev-tools', 'pull-debian-debdiff', 'what-patch', 'suspicious-source', - 'ppaput', 'requestsync', 'hugdaylist', 'massfile', From 98724c64e36d4980929853b5a7b3fe233410d899 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Fri, 22 Feb 2008 20:24:38 +0100 Subject: [PATCH 12/33] Merge dgetlp fixes from Terence Simpson. Remove the python-ubuntutools binary for now. Minor changes. --- debian/changelog | 39 +++-- debian/control | 20 +-- debian/rules | 3 - .../{examples => ubuntu-dev-tools.examples} | 0 debian/ubuntu-dev-tools.install | 1 - dgetlp | 138 +++++++++++++----- 6 files changed, 125 insertions(+), 76 deletions(-) rename debian/{examples => ubuntu-dev-tools.examples} (100%) diff --git a/debian/changelog b/debian/changelog index 9ed3fdd..d275dd8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,30 +1,38 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low [ Andrew Hunter ] - * Use install files as we have multiple binaries now. * ppaput: - * Separated ppaput script from backend python modules (shipped in - python-ppaput). (LP: #192184) - * Switched from homegrown option parseing to Optparse, much more + - Separated ppaput script from backend python modules (LP: #192184). + - Switched from homegrown option parseing to Optparse, much more robust and less code duplication. [ Siegfried-Angel Gevatter Pujals (RainCT) ] - * Remove wrong element from doc/ppaput.1.docbook. - * Move ppaput.py into new ubuntutools/ directory and remove - it's shabang. - * Write a description for the new python-ubuntutools binary - package in debian/control. Add a "Suggests: ubuntu-dev-tools". - * Check for reportbug being installed in submittodebian. Replace - reportbug dependency with a Recommends. - * Add ppaput to debian/copyright. - * Remove debian/pycompat. + * 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. + * debian/copyright. + - Add ppaput (the executable has been removed for now -see below-, + 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. [ 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. - -- Daniel Holbach Fri, 22 Feb 2008 18:55:21 +0100 + -- Siegfried-Angel Gevatter Pujals (RainCT) Fri, 22 Feb 2008 19:52:59 +0100 ubuntu-dev-tools (0.26) hardy; urgency=low @@ -67,7 +75,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 97e91c1..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 @@ -14,7 +14,7 @@ Package: ubuntu-dev-tools Architecture: all Section: devel Depends: ${python:Depends}, binutils, devscripts, sudo, python-launchpad-bugs (>= 0.2.25), python-debian, dctrl-tools, lsb-release -Recommends: bzr, pbuilder, python-ubuntu-utils, reportbug (>= 3.39ubuntu1) +Recommends: bzr, pbuilder, reportbug (>= 3.39ubuntu1) Conflicts: devscripts (<< 2.10.7ubuntu5) Replaces: devscripts (<< 2.10.7ubuntu5) XB-Python-Version: ${python:Versions} @@ -22,17 +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. - -Package: python-ubuntutools -Architecture: all -Section: python -Depends: ${python:Depends} -Suggests: ubuntu-dev-tools -XB-Python-Version: ${python:Versions} -Description: useful Python modules for Ubuntu developers - This is a namespace of Python modules that people interested in - Ubuntu development might find useful. It include: - . - * ppaput: a Python module that abstracts the process of creating and - uploading Debian source packages to Launchpad's Personal Package - Archives. diff --git a/debian/rules b/debian/rules index b43537e..c10c010 100755 --- a/debian/rules +++ b/debian/rules @@ -6,6 +6,3 @@ 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 - -binary-install/python-ubuntutools:: - rm -rf debian/python-ubuntutools/usr/lib 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 index 83e5341..635757e 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -1,2 +1 @@ -debian/tmp/usr/bin/* bash_completion/* etc/bash_completion.d/pbuilder-dist 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; From db65dc10809a1d3df94c988b15bade54e0e61b41 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 23 Feb 2008 13:22:38 +0100 Subject: [PATCH 13/33] Close bugs in changelog; chmod -x AUTHORS. --- debian/changelog | 5 ++++- python-ubuntutools.install | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 python-ubuntutools.install diff --git a/debian/changelog b/debian/changelog index d275dd8..16e4d99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low robust and less code duplication. [ 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. @@ -30,7 +33,7 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low [ 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. + sponsoring process (LP: #194634). -- Siegfried-Angel Gevatter Pujals (RainCT) Fri, 22 Feb 2008 19:52:59 +0100 diff --git a/python-ubuntutools.install b/python-ubuntutools.install deleted file mode 100644 index 9ecadfb..0000000 --- a/python-ubuntutools.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/lib/python2.5/site-packages/*.py From 5eb5427dc25dc925deb87e89671db9c052357357 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 23 Feb 2008 17:53:22 +0100 Subject: [PATCH 14/33] Commit patch from Adrien Cunin for 404main. --- 404main | 6 +++--- debian/changelog | 2 ++ pbuilder-dist | 29 ++++++++++++++--------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/404main b/404main index 34ac278..336dd86 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 hardy | grep Packages | head -n 1', 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 ^Depends | head -n 1", 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 ^Build-Depends | head -n 1", shell=True, stdout=subprocess.PIPE).stdout.readlines() deps = [] for builddep in deps1: diff --git a/debian/changelog b/debian/changelog index 16e4d99..226af78 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low remove it's shabang. * submittodebian: - Check if reportbug is installed and if it isn't throw an error. + * 404main: + - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) * debian/copyright. - Add ppaput (the executable has been removed for now -see below-, but there is still the module in the source package). diff --git a/pbuilder-dist b/pbuilder-dist index 644f9a7..65a8609 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -5,24 +5,24 @@ # Siegfried-A. Gevatter # 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 with +# differentd istributions (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 Ubuntu Hardy. -# Base directory where pbuilder will put all the files it creates +# 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 components by default? (universe and multiverse in Ubuntu, -# contrib and non-free in Debian.) +# Change this to 0 if you don't want additional components to be used. +# That is, 'universe' and 'multiverse' for Ubuntu chroots and 'contrib' +# and 'non-free' for Debian. EXTRACOMP=1 -# Save the log of the last operation in a dot-file? ('.lastlog' in BASE_DIR) +# Change this to 1 if you want the log for the last operation to be saved +# in the base directory by default (it will be named '.lastlog'). SAVELOG=0 # Allow this script to use /var/cache/apt/archives/ when possible @@ -31,8 +31,6 @@ then SYSCACHE=1 fi -CALLDIR=`pwd` - ################################ @@ -66,6 +64,7 @@ else help show-dist-flag fi + BINARCH=$ARCH ## DISTRIBUTION=$1 shift 1 fi @@ -241,14 +240,14 @@ else fi sudo pbuilder $OPERATION \ ---basetgz "$BASE_DIR/$FOLDERBASE-base.tgz" \ +--basetgz "$BASE_DIR/${FOLDERBASE}-base.tgz" \ --distribution "$DISTRIBUTION" \ --debootstrapopts --arch \ --debootstrapopts "$BINARCH" \ $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ $( [ -z $PROXY ] || echo "--http-proxy $PROXY" ) \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ ---buildresult "$BASE_DIR/$FOLDERBASE_result" \ +--buildresult "$BASE_DIR/${FOLDERBASE}_result" \ --mirror "$ARCHIVE" \ --aptconfdir "$BASE_DIR/etc/$DISTRIBUTION/apt.conf/" \ $@ From 1db357f778b9b2074de726d6c427ffca1867e53d Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 23 Feb 2008 21:40:39 +0100 Subject: [PATCH 15/33] Fixes (presumably) in pbuilder-dist and comment the code better. Fix a regression in update-maintainer. Other changes? --- 404main | 6 +- debian/changelog | 2 + debian/copyright | 4 +- pbuilder-dist | 207 +++++++++++++++++++++++++++------------------- suspicious-source | 2 +- update-maintainer | 2 +- 6 files changed, 129 insertions(+), 94 deletions(-) diff --git a/404main b/404main index 336dd86..88b488d 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 + ' | grep hardy | grep Packages | head -n 1', shell=True, stdout=subprocess.PIPE).stdout.read() + out = subprocess.Popen('apt-cache madison ' + pack + ' | grep hardy | 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 | head -n 1", 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 | head -n 1", 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: diff --git a/debian/changelog b/debian/changelog index 226af78..b129a1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low remove it's shabang. * submittodebian: - Check if reportbug is installed and if it isn't throw an error. + * suspicious-sources: + - Ignore .in files. * 404main: - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) * debian/copyright. diff --git a/debian/copyright b/debian/copyright index c558d70..6f9a5a6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -20,7 +20,7 @@ Upstream Authors: Copyright: - Copyright 2006-2007 (C) Canonical Ltd. + Canonical Ltd. 2006-2007 Albert Damen 2007 Albin Tonnerre 2006-2007 Daniel Holbach 2006-2007 @@ -29,7 +29,7 @@ Copyright: Michael Bienia 2006-2007 Kees Cook 2006-2007 Pete Savage 2006-2007 - Siegfried-A. Gevatter 2007 + Siegfried-A. Gevatter 2007-2008 Terence Simpson 2007 Licenses: diff --git a/pbuilder-dist b/pbuilder-dist index 65a8609..ed8a06f 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -1,8 +1,9 @@ #!/bin/sh -# Copyright by: -# Jamin W. Collins -# Jordan Mantha -# Siegfried-A. Gevatter +# +# Copyright (C) Jamin W. Collins +# Copyright (C) Jordan Mantha +# Copyright (C) 2007-2008 Siegfried-A. Gevatter +# # License: GPLv2 or later # # This script is a wrapper to be able to easily use pbuilder with @@ -12,119 +13,158 @@ # configurations. For example, a symlink called pbuilder-hardy will assume # that the target distribution is always 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" # Change this to 0 if you don't want additional components to be used. # That is, 'universe' and 'multiverse' for Ubuntu chroots and 'contrib' -# and 'non-free' for Debian. +# and 'non-free' for Debian. (This option can be overwriten at runtime). EXTRACOMP=1 # Change this to 1 if you want the log for the last operation to be saved # in the base directory by default (it will be named '.lastlog'). SAVELOG=0 -# Allow this script to use /var/cache/apt/archives/ when possible +# Allow this script to use /var/cache/apt/archives/ when possible. if [ -z $SYSCACHE ] then SYSCACHE=1 fi +###################################################################### -################################ +# Detect system architecture +REALARCH=$(dpkg-architecture -qDEB_HOST_ARCH) -ARCH=`dpkg-architecture -qDEB_HOST_ARCH` -SYSDIST=`lsb_release -cs` +# Detect Ubuntu distribution (wheter it is gutsy, hardy, etc.) +SYSDIST=$(lsb_release -cs 2>/dev/null) +# Overwrite hardcoded base directory by that one in the global variable 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' ] +# Abort if the name of the executable has hypens but it doesn't +# start with "pbuilder-". +if [ -n $(basename $0 | grep '-') ] && [ $(basename $0 | cut -d'-' -f1) != 'pbuilder' ] then - if [ $# -lt 1 ] - then - help - fi - - BINARCH=`basename $0 | cut -f3 -d '-'` - DISTRIBUTION=`basename $0 | cut -f2 -d '-'` + echo "Error: " $(basename $0) " is not a valid name for a pbuilder-dist executable." + exit 1 +fi + +# Detect if the script has it's original name or if a symlink is being used, +# and if it's a symlink extract the information that it contains. +if [ -n $(basename $0 | grep '-') ] && [ `basename $0` != 'pbuilder-dist' ] +then + ORIGINAL_NAME=0 + DISTRIBUTION=$(basename $0 | cut -d'-' -f2) + ARCHITECTURE=$(basename $0 | cut -d'-' -f3) else - if [ $# -lt 2 ] - then - help show-dist-flag - fi - - BINARCH=$ARCH ## - DISTRIBUTION=$1 - shift 1 + ORIGINAL_NAME=1 + DISTRIBUTION=$1 + ARCHITECTURE=$REALARCH + shift 1 fi - -if [ $1 = "i386" ] || [ $1 = "amd64" ] +# Check if the choosen architecture is supported on the user's system. +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 [ $REALARCH = 'amd64' ]; then + ARCHITECTURE=$1 + else + echo "Warning: Architecture switching is not supported on your system; ignoring argument '$1'." + fi + + shift 1 fi - -if [ $1 = "mainonly" ]; then +# Check if there's a component modifier +if [ "$1" = 'mainonly' ]; then EXTRACOMP=0 shift 1 -elif [ $1 = "allcomp" ]; then +elif [ "$1" = 'allcomp' ]; then EXTRACOMP=1 shift 1 fi - -if [ $1 = "withlog" ]; then +# Check if the default logging preferences should be overwriten +if [ "$1" = 'withlog' ]; then SAVELOG=1 shift 1 -elif [ $1 = "nolog" ]; then +elif [ "$1" = 'nolog' ]; then SAVELOG=0 shift 1 fi +# Check if some proxy should be used. +if [ -n "$http_proxy" ] +then + PROXY=$http_proxy +fi + +if [ -z "$PROXY" ] && [ -n "$HTTP_PROXY" ] +then + PROXY=$HTTP_PROXY +fi + +###################################################################### + +usage() +{ + echo "Usage: $0 "$( [ $ORIGINAL_NAME = 0 ] || echo " " )$( [ $ARCHITECTURE != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] " +} distdata() { - if [ "$1" = "debian" ] - then - # Set Debian specific data - ISDEBIAN=True - if [ -z $ARCHIVE ] + # Populate variables with Debian / Ubuntu specific data + if [ "$1" = "debian" ] then - ARCHIVE="http://ftp.debian.org" + # 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 - 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 } +###################################################################### +# Check if there is at least one argument remaining. +if [ $# -lt 1 ] +then + echo "You provided an insufficent number of arguments." + usage + exit 1 +fi + +###################################################################### + +# Check if the distribution exists, and fill the variables that change +# depending on wheter the target distribution is Ubuntu or Debian. case $DISTRIBUTION in - dapper|edgy|feisty|gutsy|hardy) # warty|hoary|breezy + dapper|edgy|feisty|gutsy|hardy) distdata ubuntu ;; @@ -144,20 +184,20 @@ case $DISTRIBUTION in exit 1 fi fi - distdata + + distdata ubuntu ;; esac - +# Check if the selected operation is correct OPERATION=$1 - -case $OPERATION in +case "$OPERATION" in create|update|build|clean|login|execute) shift 1 ;; *) - if [ ${1##*.} = 'dsc' ] + if [ ${OPERATION##*.} = 'dsc' ] then OPERATION=build else @@ -173,28 +213,21 @@ case $OPERATION in ;; esac -FOLDERBASE="${DISTRIBUTION}-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )" +FOLDERBASE="${DISTRIBUTION}-$ARCHITECTURE" +# Create the folder where the resulting files will be placed (if the +# option is build), if it doesn't exist yet. if [ ! -d $BASE_DIR/${FOLDERBASE}_result ] then mkdir -p $BASE_DIR/${FOLDERBASE}_result fi -if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ] +# Determine wheter system cache should be used or not. +if [ $SYSCACHE = 1 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$REALARCH" = "$ARCHITECTURE"] then DEBCACHE='/var/cache/apt/archives/' 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/ ] @@ -243,11 +276,11 @@ sudo pbuilder $OPERATION \ --basetgz "$BASE_DIR/${FOLDERBASE}-base.tgz" \ --distribution "$DISTRIBUTION" \ --debootstrapopts --arch \ ---debootstrapopts "$BINARCH" \ -$( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ -$( [ -z $PROXY ] || echo "--http-proxy $PROXY" ) \ -$( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ ---buildresult "$BASE_DIR/${FOLDERBASE}_result" \ ---mirror "$ARCHIVE" \ ---aptconfdir "$BASE_DIR/etc/$DISTRIBUTION/apt.conf/" \ +--debootstrapopts "$ARCHITECTURE" \ +$( [ "$SAVELOG" = 0 ] || echo "--logfile ${BASE_DIR}/.lastlog" ) \ +$( [ -z "$PROXY" ] || echo "--http-proxy ${PROXY}" ) \ +$( [ -z "$DEBCACHE" ] || echo "--aptcache ${DEBCACHE}" ) \ +--buildresult "${BASE_DIR}/${FOLDERBASE}_result" \ +--mirror "${ARCHIVE}" \ +--aptconfdir "${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/" \ $@ 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/update-maintainer b/update-maintainer index 37b9789..808ee7b 100755 --- a/update-maintainer +++ b/update-maintainer @@ -75,7 +75,7 @@ if [ -z "$section" ]; then echo "--section argument. Run $0 --help for more information." >&2 exit 1 fi - section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=universe + section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main fi case $section in From 71391dec33ce9fbbf3bb28ad72079cf36cc38a22 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 23 Feb 2008 21:56:05 +0100 Subject: [PATCH 16/33] Explain pbuilder-dist changes in changelog. --- debian/changelog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debian/changelog b/debian/changelog index b129a1d..e4b11a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,11 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low - 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 (LP: #194633). + - Escape many variables to avoid possible problems there. + - Reorganize the code a bit and comment it. * 404main: - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) * debian/copyright. From 53cef1a28532c197f20fcfca0c94ebe8fab2cf88 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 24 Feb 2008 14:08:48 +0100 Subject: [PATCH 17/33] pbuilder-dist: more fixes (thanks to Adrien Cunin), accept 'upgrade' as an alias for 'update', comment out not used stuff (authenticacion method detection), etc. --- debian/changelog | 4 +++ pbuilder-dist | 80 +++++++++++++++++++++++++++++++----------------- 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index e4b11a1..3c67b9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,8 +23,12 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low * pbuilder-dist: - Apply patch from James Westby to fix a problem where it always wanted to get the architecture to use as an option (LP: #194633). + - Fix a recently introduced problem where pbuilder-dist would always + want to know the architecture. Thanks to Adrien Cunin for finding + where the problem was! - Escape many variables to avoid possible problems there. - Reorganize the code a bit and comment it. + - Accept "upgrade" as an alias for "update". * 404main: - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) * debian/copyright. diff --git a/pbuilder-dist b/pbuilder-dist index ed8a06f..e8a3f56 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -6,8 +6,8 @@ # # License: GPLv2 or later # -# This script is a wrapper to be able to easily use pbuilder with -# differentd istributions (eg, Gutsy, Hardy, Debian unstable, etc). +# This script is a wrapper to be able to easily use pbuilder for +# different distributions (eg, Gutsy, Hardy, Debian unstable, etc). # # You can create symlinks to a pbuilder-dist executable to get different # configurations. For example, a symlink called pbuilder-hardy will assume @@ -68,7 +68,6 @@ then else ORIGINAL_NAME=1 DISTRIBUTION=$1 - ARCHITECTURE=$REALARCH shift 1 fi @@ -84,6 +83,12 @@ then shift 1 fi +# If architecture hasn't been set yet, use the system's one. +if [ -z "$ARCHITECTURE" ] +then + ARCHITECTURE=$REALARCH +fi + # Check if there's a component modifier if [ "$1" = 'mainonly' ]; then EXTRACOMP=0 @@ -189,19 +194,34 @@ case $DISTRIBUTION in ;; esac -# Check if the selected operation is correct +# Save the selected operation in a variable. OPERATION=$1 +shift 1 + +# Check if the selected operation is an alias for another one. +case "$OPERATION" in + upgrade) + OPERATION=update + ;; +esac + +# Check if the selected operation is correct, or if it is an alias for +# another one. case "$OPERATION" in create|update|build|clean|login|execute) - shift 1 + # Allright. ;; + upgrade) + OPERATION=update + ;; + *) if [ ${OPERATION##*.} = 'dsc' ] then OPERATION=build else - echo "Unrecognized argument. Please use one of those:" + echo "Unrecognized argument '$OPERATION'. Please use one of those:" echo " create" echo " update" echo " build" @@ -213,6 +233,8 @@ case "$OPERATION" in ;; esac +# Determine the base name for the chroot tarball and the folder where the +# resulting files will be stored. FOLDERBASE="${DISTRIBUTION}-$ARCHITECTURE" # Create the folder where the resulting files will be placed (if the @@ -228,6 +250,8 @@ then DEBCACHE='/var/cache/apt/archives/' fi +# If it's an Ubuntu system, create an editable configuration file, +# and if it's a stable release add the -security and -updates repositories. if [ $ISDEBIAN = "False" ] then if [ ! -d $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ ] @@ -250,27 +274,27 @@ EOF fi fi -if [ -z "$PBUILDAUTH" ] -then - if [ -n "$DESKTOP_SESSION" ] - 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 +#if [ -z "$PBUILDAUTH" ] +#then +# if [ -n "$DESKTOP_SESSION" ] +# 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 sudo pbuilder $OPERATION \ --basetgz "$BASE_DIR/${FOLDERBASE}-base.tgz" \ @@ -282,5 +306,5 @@ $( [ -z "$PROXY" ] || echo "--http-proxy ${PROXY}" ) \ $( [ -z "$DEBCACHE" ] || echo "--aptcache ${DEBCACHE}" ) \ --buildresult "${BASE_DIR}/${FOLDERBASE}_result" \ --mirror "${ARCHIVE}" \ ---aptconfdir "${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/" \ +$( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \ $@ From 8a518715e0166f2cf5fb7550f606b5bf266b0db5 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 24 Feb 2008 18:50:01 +0100 Subject: [PATCH 18/33] 404main changes --- 404main | 58 ++++++++++++++++++++++++++++++++---------------- TODO | 1 + debian/changelog | 4 ++++ doc/404main.1 | 10 ++++++++- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/404main b/404main index 88b488d..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 + ' | grep hardy | grep -m 1 Packages', 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 -m 1 ^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 -m 1 ^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/TODO b/TODO index 5593b44..2d40c5b 100644 --- a/TODO +++ b/TODO @@ -1,3 +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/debian/changelog b/debian/changelog index 3c67b9e..f0321bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,8 +29,12 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low - 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: - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) + - Add limited support for multiple distributions (and update it's manpage). + - TODO: Use python-apt instead of lots of pipes. * debian/copyright. - Add ppaput (the executable has been removed for now -see below-, but there is still the module in the source package). diff --git a/doc/404main.1 b/doc/404main.1 index f661f6d..e34af04 100644 --- a/doc/404main.1 +++ b/doc/404main.1 @@ -4,12 +4,20 @@ 404main \- check if all build dependencies of a package are in main .SH SYNOPSIS -\fB404main\fP <\fIpackage name\fP> +\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) From 632f7bb274380d7a8370e4d11f7f2cc0b8a64a84 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 24 Feb 2008 19:52:29 +0100 Subject: [PATCH 19/33] Release version 0.27. --- debian/changelog | 35 ++++++++++++++++++++++------------- debian/rules | 3 +++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index f0321bb..5721722 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,10 @@ -ubuntu-dev-tools (0.27) UNRELEASED; urgency=low +ubuntu-dev-tools (0.28) UNRELEASED; urgency=low + + * + + -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 24 Feb 2008 19:52:06 +0100 + +ubuntu-dev-tools (0.27) hardy; urgency=low [ Andrew Hunter ] * ppaput: @@ -6,6 +12,11 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low - 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). @@ -22,21 +33,24 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low - 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 (LP: #194633). + 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. Thanks to Adrien Cunin for finding - where the problem was! + 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: - - Filter out entries from Debian, thanks to Adrien Cunin! (LP: #194704) - - Add limited support for multiple distributions (and update it's manpage). + - 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 below-, + - 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. @@ -47,12 +61,7 @@ ubuntu-dev-tools (0.27) UNRELEASED; urgency=low name contains hypens. - Add support for native packages. - [ 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) Fri, 22 Feb 2008 19:52:59 +0100 + -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 24 Feb 2008 19:11:06 +0100 ubuntu-dev-tools (0.26) hardy; urgency=low diff --git a/debian/rules b/debian/rules index c10c010..6a071b0 100755 --- a/debian/rules +++ b/debian/rules @@ -6,3 +6,6 @@ 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 + +binary-install/ubuntu-dev-tools:: + rm -rf debian/ubuntu-dev-tools/usr/lib From 670db8f99d9509f908a2b8aacb513ee8d4b56870 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Mon, 25 Feb 2008 21:11:24 +0100 Subject: [PATCH 20/33] Add pbuilder-dist-simple. --- debian/changelog | 3 ++- doc/pbuilder-dist-simple.1 | 49 ++++++++++++++++++++++++++++++++++++++ doc/pbuilder-dist.1 | 4 ---- pbuilder-dist-simple | 44 ++++++++++++++++++++++++++++++++++ setup.py | 1 + 5 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 doc/pbuilder-dist-simple.1 create mode 100755 pbuilder-dist-simple diff --git a/debian/changelog b/debian/changelog index 5721722..c399be7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ubuntu-dev-tools (0.28) UNRELEASED; urgency=low - * + * pbuilder-dist-simple, doc/pbuilder-dist-simple.1, setup.py: + - Add the original pbuilder-dist script as pbuilder-dist-simple. -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 24 Feb 2008 19:52:06 +0100 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/pbuilder-dist-simple b/pbuilder-dist-simple new file mode 100755 index 0000000..3210226 --- /dev/null +++ b/pbuilder-dist-simple @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (C) Jamin W. Collins +# 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/setup.py b/setup.py index 2a7bd96..1c71cf0 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ setup(name='ubuntu-dev-tools', 'check-symbols', 'get-branches', 'pbuilder-dist', + 'pbuilder-dist-simple', 'update-maintainer', 'dch-repeat', 'mk-sbuild-lv', From b2903d5b7efc863c3de799dfa9308919a8c21bac Mon Sep 17 00:00:00 2001 From: Adrien Cunin Date: Sun, 2 Mar 2008 15:33:10 +0100 Subject: [PATCH 21/33] * pbuilder-dist: - Fixed minor bash syntax error - Removed quotes around the path when using --aptconfdir, otherwise pbuilder create fails --- debian/changelog | 6 +++++- pbuilder-dist | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5721722..73cad76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ ubuntu-dev-tools (0.28) UNRELEASED; urgency=low - * + [ Adrien Cunin ] + * pbuilder-dist: + - Fixed minor bash syntax error + - Removed quotes around the path when using --aptconfdir, otherwise + pbuilder create fails -- Siegfried-Angel Gevatter Pujals (RainCT) Sun, 24 Feb 2008 19:52:06 +0100 diff --git a/pbuilder-dist b/pbuilder-dist index e8a3f56..47e54da 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -245,7 +245,7 @@ then fi # Determine wheter system cache should be used or not. -if [ $SYSCACHE = 1 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$REALARCH" = "$ARCHITECTURE"] +if [ $SYSCACHE = 1 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$REALARCH" = "$ARCHITECTURE" ] then DEBCACHE='/var/cache/apt/archives/' fi @@ -306,5 +306,5 @@ $( [ -z "$PROXY" ] || echo "--http-proxy ${PROXY}" ) \ $( [ -z "$DEBCACHE" ] || echo "--aptcache ${DEBCACHE}" ) \ --buildresult "${BASE_DIR}/${FOLDERBASE}_result" \ --mirror "${ARCHIVE}" \ -$( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \ +$( [ $ISDEBIAN != "False" ] || echo "--aptconfdir ${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/" ) \ $@ From 4b2ee427ccad5c1524a124ebe86158aa31b4d14d Mon Sep 17 00:00:00 2001 From: Jamie Strandboge Date: Thu, 6 Mar 2008 11:34:43 -0500 Subject: [PATCH 22/33] added --personality to mk-sbuild-lvm and bump version number --- mk-sbuild-lv | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mk-sbuild-lv b/mk-sbuild-lv index 51b1829..3ae3f79 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" 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="" @@ -113,6 +114,10 @@ while :; do arch_suffix="-$2" shift 2 ;; + --personality) + personality="$2" + shift 2 + ;; --name) name="$2" shift 2 @@ -223,6 +228,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" \ From 2eadaaa63f0ee72be61d2897ca5e9dc263596f60 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 6 Mar 2008 10:59:11 -0800 Subject: [PATCH 23/33] tweak check-symbols to use .old/.new instead of .1/.2 which is confusing when reading .so names. :) --- check-symbols | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check-symbols b/check-symbols index 5498107..e69e597 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 From e2635051ffcbc63c48bb93b5345dcf452d200afa Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Fri, 7 Mar 2008 11:14:31 -0800 Subject: [PATCH 24/33] released 0.28 --- .bzrignore | 1 + debian/changelog | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .bzrignore 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/debian/changelog b/debian/changelog index 5f319c5..5bbf502 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ubuntu-dev-tools (0.28) UNRELEASED; urgency=low +ubuntu-dev-tools (0.28) hardy; urgency=low [ Adrien Cunin ] * pbuilder-dist: From 2e08014414ca5326807f76041dd61ef3c24b7353 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Fri, 7 Mar 2008 22:51:11 +0100 Subject: [PATCH 25/33] Give --personality a better default. --- mk-sbuild-lv | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mk-sbuild-lv b/mk-sbuild-lv index 3ae3f79..e3104c1 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild-lv @@ -87,7 +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" + echo " --personality=PERSONALITY What personality to use (defaults 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" @@ -112,6 +112,10 @@ 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) From 6026f454109cf49b4d3ab6b6a7da779fe95e1e30 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Mon, 10 Mar 2008 11:36:17 +0100 Subject: [PATCH 26/33] * grab-attachments, setup.py: added grab-attachments tool. You give it bug numbers, it gets you their attachments. Useful for sponsoring. --- debian/changelog | 7 +++++++ grab-attachments | 37 +++++++++++++++++++++++++++++++++++++ setup.py | 3 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 grab-attachments diff --git a/debian/changelog b/debian/changelog index 5bbf502..81db3f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +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 ] 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/setup.py b/setup.py index 2a7bd96..82a952c 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,8 @@ setup(name='ubuntu-dev-tools', 'massfile', 'submittodebian', 'get-build-deps', - 'dgetlp' + 'dgetlp', + 'grab-attachments' ], packages=['ubuntutools'], ) From 0592685c0c52287d97ce4b44c0220e7f73f75567 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 11 Mar 2008 09:23:50 +0100 Subject: [PATCH 27/33] Grammer and indentation fixes. --- mk-sbuild-lv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mk-sbuild-lv b/mk-sbuild-lv index e3104c1..d0f6a1e 100755 --- a/mk-sbuild-lv +++ b/mk-sbuild-lv @@ -87,7 +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 match --arch)" + 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" @@ -112,10 +112,10 @@ 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 + if [ -z "$personality" -a "$2" = "i386" ] + then + personality="linux32" + fi shift 2 ;; --personality) From eb67a7bbac9c33bceb1fde83a123911fcb4563a5 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Wed, 12 Mar 2008 00:40:45 +0100 Subject: [PATCH 28/33] Reimplement pbuilder-dist in python. --- pbuilder-dist | 571 +++++++++++++++++++++++++------------------------- 1 file changed, 284 insertions(+), 287 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index e8a3f56..fb24cf8 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -1,8 +1,8 @@ -#!/bin/sh +#! /usr/bin/env python +# -*- coding: utf-8 -*- # -# Copyright (C) Jamin W. Collins -# Copyright (C) Jordan Mantha # Copyright (C) 2007-2008 Siegfried-A. Gevatter +# Based upon pbuilder-dist-simple by Jamin Collins and Jordan Mantha. # # License: GPLv2 or later # @@ -11,300 +11,297 @@ # # 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 Ubuntu Hardy. +# that the target distribution is always meant to be Ubuntu Hardy. -###################################################################### +import sys +import os -# Base directory where pbuilder will put all the files it creates. -# This is overriden by the global variable $PBUILDFOLDER -BASE_DIR="$HOME/pbuilder" - -# Change this to 0 if you don't want additional components to be used. -# That is, 'universe' and 'multiverse' for Ubuntu chroots and 'contrib' -# and 'non-free' for Debian. (This option can be overwriten at runtime). -EXTRACOMP=1 - -# Change this to 1 if you want the log for the last operation to be saved -# in the base directory by default (it will be named '.lastlog'). -SAVELOG=0 - -# Allow this script to use /var/cache/apt/archives/ when possible. -if [ -z $SYSCACHE ] -then - SYSCACHE=1 -fi - -###################################################################### - -# Detect system architecture -REALARCH=$(dpkg-architecture -qDEB_HOST_ARCH) - -# Detect Ubuntu distribution (wheter it is gutsy, hardy, etc.) -SYSDIST=$(lsb_release -cs 2>/dev/null) - -# Overwrite hardcoded base directory by that one in the global variable -if [ $PBUILDFOLDER ] && [ $PBUILDFOLDER != "" ] -then - BASE_DIR=$PBUILDFOLDER -fi - -###################################################################### - -# Abort if the name of the executable has hypens but it doesn't -# start with "pbuilder-". -if [ -n $(basename $0 | grep '-') ] && [ $(basename $0 | cut -d'-' -f1) != 'pbuilder' ] -then - echo "Error: " $(basename $0) " is not a valid name for a pbuilder-dist executable." - exit 1 -fi - -# Detect if the script has it's original name or if a symlink is being used, -# and if it's a symlink extract the information that it contains. -if [ -n $(basename $0 | grep '-') ] && [ `basename $0` != 'pbuilder-dist' ] -then - ORIGINAL_NAME=0 - DISTRIBUTION=$(basename $0 | cut -d'-' -f2) - ARCHITECTURE=$(basename $0 | cut -d'-' -f3) -else - ORIGINAL_NAME=1 - DISTRIBUTION=$1 - shift 1 -fi - -# Check if the choosen architecture is supported on the user's system. -if [ "$1" = 'i386' ] || [ "$1" = 'amd64' ] -then - if [ $REALARCH = 'amd64' ]; then - ARCHITECTURE=$1 - else - echo "Warning: Architecture switching is not supported on your system; ignoring argument '$1'." - fi - - shift 1 -fi - -# If architecture hasn't been set yet, use the system's one. -if [ -z "$ARCHITECTURE" ] -then - ARCHITECTURE=$REALARCH -fi - -# Check if there's a component modifier -if [ "$1" = 'mainonly' ]; then - EXTRACOMP=0 - shift 1 -elif [ "$1" = 'allcomp' ]; then - EXTRACOMP=1 - shift 1 -fi - -# Check if the default logging preferences should be overwriten -if [ "$1" = 'withlog' ]; then - SAVELOG=1 - shift 1 -elif [ "$1" = 'nolog' ]; then - SAVELOG=0 - shift 1 -fi - -# Check if some proxy should be used. -if [ -n "$http_proxy" ] -then - PROXY=$http_proxy -fi - -if [ -z "$PROXY" ] && [ -n "$HTTP_PROXY" ] -then - PROXY=$HTTP_PROXY -fi - -###################################################################### - -usage() -{ - echo "Usage: $0 "$( [ $ORIGINAL_NAME = 0 ] || echo " " )$( [ $ARCHITECTURE != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] " -} - -distdata() -{ - # Populate variables with Debian / Ubuntu specific data - if [ "$1" = "debian" ] - then - # Set Debian specific data +class pbuilder_dist: + + def __init__(self): - ISDEBIAN=True + # Base directory where pbuilder will put all the files it creates. + self.base = None - if [ -z $ARCHIVE ] - then - ARCHIVE="http://ftp.debian.org" - fi + # Name of the operation which pbuilder should perform. + self.operation = None - COMPONENTS="main"$( [ $EXTRACOMP = 0 ] || echo " contrib non-free" ) - else - # Set Ubuntu specific data + # 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 - ISDEBIAN=False + # Wheter the log for the last operation should be saved in the + # base directory by default. If False, it will be saved in /tmp. + self.save_log = False - if [ -z $ARCHIVE ] - then - ARCHIVE="http://archive.ubuntu.com/ubuntu" - fi + # File where the log of the last operation will be saved. + self.logfile = None - COMPONENTS="main restricted"$( [ $EXTRACOMP = 0 ] || echo " universe multiverse" ) - fi -} + # 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 = '/etc/pbuilder-%(chroot_string)s.log' % self + else: + 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: + print 'Error: «%s» is not a recognized argument.' % operation + print 'Please use one of those: ' + ', '.join(arguments) + '.' + sys.exit(1) + + 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/"', + ] + + 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) + + return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments) + + """ + --mirror "${ARCHIVE}" \ + $( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \ + $@""" -###################################################################### +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') -# Check if there is at least one argument remaining. -if [ $# -lt 1 ] -then - echo "You provided an insufficent number of arguments." - usage - exit 1 -fi +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) -# Check if the distribution exists, and fill the variables that change -# depending on wheter the target distribution is Ubuntu or Debian. -case $DISTRIBUTION in - dapper|edgy|feisty|gutsy|hardy) - 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 ubuntu - ;; -esac +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 'withlog' in sys.argv: + app.save_log = True + args.remove('withlog') + + if len(args) < 1: + print 'Insufficient number of arguments.' + help(1) + + app.set_operation(args.pop(0)) + + sys.exit(os.system(app.get_command(args))) -# Save the selected operation in a variable. -OPERATION=$1 -shift 1 - -# Check if the selected operation is an alias for another one. -case "$OPERATION" in - upgrade) - OPERATION=update - ;; -esac - -# Check if the selected operation is correct, or if it is an alias for -# another one. -case "$OPERATION" in - create|update|build|clean|login|execute) - # Allright. - ;; - - upgrade) - OPERATION=update - ;; - - *) - if [ ${OPERATION##*.} = 'dsc' ] - then - OPERATION=build - else - echo "Unrecognized argument '$OPERATION'. Please use one of those:" - echo " create" - echo " update" - echo " build" - echo " clean" - echo " login" - echo " execute" - exit 1 - fi - ;; -esac - -# Determine the base name for the chroot tarball and the folder where the -# resulting files will be stored. -FOLDERBASE="${DISTRIBUTION}-$ARCHITECTURE" - -# Create the folder where the resulting files will be placed (if the -# option is build), if it doesn't exist yet. -if [ ! -d $BASE_DIR/${FOLDERBASE}_result ] -then - mkdir -p $BASE_DIR/${FOLDERBASE}_result -fi - -# Determine wheter system cache should be used or not. -if [ $SYSCACHE = 1 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$REALARCH" = "$ARCHITECTURE"] -then - DEBCACHE='/var/cache/apt/archives/' -fi - -# If it's an Ubuntu system, create an editable configuration file, -# and if it's a stable release add the -security and -updates repositories. -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 < Date: Thu, 13 Mar 2008 22:56:27 +0100 Subject: [PATCH 29/33] Further progress with the pbuilder-dist rewrite. --- pbuilder-dist | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index fb24cf8..9a80f6c 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -156,11 +156,14 @@ class pbuilder_dist: arguments = ('create', 'update', 'build', 'clean', 'login', 'execute') if operation not in arguments: - print 'Error: «%s» is not a recognized argument.' % operation - print 'Please use one of those: ' + ', '.join(arguments) + '.' - sys.exit(1) - - self.operation = operation + 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 @@ -180,6 +183,7 @@ class pbuilder_dist: '--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: @@ -189,12 +193,13 @@ class pbuilder_dist: if self.proxy: arguments.append('--http-proxy "%(proxy)s"' % self) - return self.auth + ' /usr/sbin/pbuilder ' + ' '.join(arguments) + ### $( [ $ISDEBIAN != "False" ] || echo "--aptconfdir \"${BASE_DIR}/etc/${DISTRIBUTION}/apt.conf/\"" ) \ - """ - --mirror "${ARCHIVE}" \ - $( [ $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 @@ -206,6 +211,20 @@ def host_architecture(): 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 @@ -294,8 +313,10 @@ def main(): 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__': From 1bdfd1a73b15dfeacef75017f4430b867f0c2d8e Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Tue, 18 Mar 2008 14:08:33 +0100 Subject: [PATCH 30/33] Really install reverse-build-depends. --- debian/changelog | 2 ++ setup.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c7d7a48..8e6810b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ubuntu-dev-tools (0.30) UNRELEASED; urgency=low - Add the original pbuilder-dist script as pbuilder-dist-simple. * pbuilder-dist: - Rewrite the script in Python to make it more robust and faster. + * setup.py: + - Really install reverse-build-depends (LP: #203523). -- Siegfried-Angel Gevatter Pujals (RainCT) Wed, 12 Mar 2008 00:42:55 +0100 diff --git a/setup.py b/setup.py index 0af1761..7b18fdb 100755 --- a/setup.py +++ b/setup.py @@ -32,7 +32,8 @@ setup(name='ubuntu-dev-tools', 'submittodebian', 'get-build-deps', 'dgetlp', - 'grab-attachments' + 'reverse-build-depends', + 'grab-attachments', ], packages=['ubuntutools'], ) From 622ffce6a156c36bbb50db2703b7dc3b64b1823f Mon Sep 17 00:00:00 2001 From: Adrien Cunin Date: Sun, 23 Mar 2008 22:13:09 +0100 Subject: [PATCH 31/33] * 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.} --- bash_completion/pbuilder-dist | 4 +++- debian/changelog | 9 ++++++++- debian/ubuntu-dev-tools.install | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bash_completion/pbuilder-dist b/bash_completion/pbuilder-dist index 3011775..0eb20d0 100644 --- a/bash_completion/pbuilder-dist +++ b/bash_completion/pbuilder-dist @@ -30,4 +30,6 @@ _pbuilder-dist() return 0 } -[ "$have" ] && complete -F _pbuilder-dist -o filenames pbuilder-dist +[ "$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/debian/changelog b/debian/changelog index 8e6810b..0e087b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ ubuntu-dev-tools (0.30) UNRELEASED; 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. * pbuilder-dist: @@ -7,7 +8,13 @@ ubuntu-dev-tools (0.30) UNRELEASED; urgency=low * setup.py: - Really install reverse-build-depends (LP: #203523). - -- Siegfried-Angel Gevatter Pujals (RainCT) Wed, 12 Mar 2008 00:42:55 +0100 + [ 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.} + + -- Adrien Cunin Sun, 23 Mar 2008 21:51:28 +0100 ubuntu-dev-tools (0.29) hardy; urgency=low diff --git a/debian/ubuntu-dev-tools.install b/debian/ubuntu-dev-tools.install index 635757e..40fadd6 100644 --- a/debian/ubuntu-dev-tools.install +++ b/debian/ubuntu-dev-tools.install @@ -1 +1 @@ -bash_completion/* etc/bash_completion.d/pbuilder-dist +bash_completion/* etc/bash_completion.d/ From 0869bcb2b96ec82eb91cfd2e756b37f054fe8dc0 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Tue, 8 Apr 2008 16:22:31 +0200 Subject: [PATCH 32/33] pbuilder-dist (rewrite): always save the last log. --- pbuilder-dist | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index 9a80f6c..9790f87 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -31,10 +31,6 @@ class pbuilder_dist: # and 'non-free' for Debian. self.extra_components = True - # Wheter the log for the last operation should be saved in the - # base directory by default. If False, it will be saved in /tmp. - self.save_log = False - # File where the log of the last operation will be saved. self.logfile = None @@ -119,8 +115,6 @@ class pbuilder_dist: self.chroot_string = '%(target_distro)s-%(build_architecture)s' % self if not self.logfile: - self.logfile = '/etc/pbuilder-%(chroot_string)s.log' % self - else: self.logfile = '%(base)s/.%(chroot_string)s.log' % self def set_target_distro(self, distro): @@ -305,10 +299,6 @@ def main(): app.extra_components = False args.remove('mainonly') - if 'withlog' in sys.argv: - app.save_log = True - args.remove('withlog') - if len(args) < 1: print 'Insufficient number of arguments.' help(1) From 5ffa62013b4f8698935bc8d3928c81b0d6b0b8a7 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Tue, 8 Apr 2008 16:50:12 +0200 Subject: [PATCH 33/33] Released version 0.30 (doesn't include the new pbuilder-dist rewrite). Add a lintian source override. --- debian/changelog | 15 +++++++++++---- debian/source.lintian-overrides | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 debian/source.lintian-overrides diff --git a/debian/changelog b/debian/changelog index 0e087b5..6c956a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,19 @@ -ubuntu-dev-tools (0.30) UNRELEASED; urgency=low +ubuntu-dev-tools (0.31) UNRELEASED; urgency=low + + * pbuilder-dist: + - Rewrite the script in Python to make it more robust and faster. + + -- Siegfried-Angel Gevatter Pujals (RainCT) Tue, 08 Apr 2008 16:48:35 +0200 + +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. - * pbuilder-dist: - - Rewrite the script in Python to make it more robust and faster. * 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 @@ -14,7 +21,7 @@ ubuntu-dev-tools (0.30) UNRELEASED; urgency=low * bash_completion/pbuilder-dist: apply the completion not only to pbuilder-dist but also to pbuilder-{hardy,sid,etc.} - -- Adrien Cunin Sun, 23 Mar 2008 21:51:28 +0100 + -- Siegfried-Angel Gevatter Pujals (RainCT) Tue, 08 Apr 2008 16:33:52 +0200 ubuntu-dev-tools (0.29) hardy; urgency=low 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