From 7515ca30e3ae6869e0f81b47b46e5e1463be8358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 16 Apr 2010 11:26:53 +0200 Subject: [PATCH 1/6] bash_completion/pbuilder-dist, dch-repeat: list maverick in possible Ubuntu dists; the default dist for reverse-build-depends and submittodebian should be changed in maverick. --- bash_completion/pbuilder-dist | 2 +- dch-repeat | 2 +- debian/changelog | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bash_completion/pbuilder-dist b/bash_completion/pbuilder-dist index 933e043..994d608 100644 --- a/bash_completion/pbuilder-dist +++ b/bash_completion/pbuilder-dist @@ -31,5 +31,5 @@ _pbuilder-dist() return 0 } [ "$have" ] && complete -F _pbuilder-dist -o filenames \ -{pbuilder,cowbuilder}-{dist,dapper,edgy,feisty,gutsy,hardy,intrepid,jaunty,karmic,lucid,sarge,etch,lenny,squeeze,sid} +{pbuilder,cowbuilder}-{dist,dapper,edgy,feisty,gutsy,hardy,intrepid,jaunty,karmic,lucid,maverick,sarge,etch,lenny,squeeze,sid} # Make it pbuilder-* if you know how to do it diff --git a/dch-repeat b/dch-repeat index 61801b7..6703ffc 100755 --- a/dch-repeat +++ b/dch-repeat @@ -47,7 +47,7 @@ EOM exit(0); } -my @releases = ('dapper', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid'); +my @releases = ('dapper', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', 'maverick'); #Getopt::Long::Configure("bundling", "no_ignore_case"); our $opt_build_tree = "/scratch/ubuntu/build"; diff --git a/debian/changelog b/debian/changelog index aa27327..e3edf5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,11 @@ ubuntu-dev-tools (0.98) UNRELEASED; urgency=low * lp-shell: Use "udt-lp-shell" as LP API consumer instead of the non-unique "test" (lp: #558531). + [ Loïc Minier ] + * bash_completion/pbuilder-dist, dch-repeat: list maverick in possible + Ubuntu dists; the default dist for reverse-build-depends and + submittodebian should be changed in maverick. + -- Michael Bienia Tue, 13 Apr 2010 18:41:36 +0200 ubuntu-dev-tools (0.97) lucid; urgency=low From 299c397d639045aeb6b5694065774f5d0a8ef36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 16 Apr 2010 11:28:18 +0200 Subject: [PATCH 2/6] Release 0.98 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e3edf5a..c157142 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ubuntu-dev-tools (0.98) UNRELEASED; urgency=low +ubuntu-dev-tools (0.98) lucid; urgency=low [ Ryan Kavanagh ] * Added the merge-changelog script from @@ -18,7 +18,7 @@ ubuntu-dev-tools (0.98) UNRELEASED; urgency=low Ubuntu dists; the default dist for reverse-build-depends and submittodebian should be changed in maverick. - -- Michael Bienia Tue, 13 Apr 2010 18:41:36 +0200 + -- Loïc Minier Fri, 16 Apr 2010 11:28:12 +0200 ubuntu-dev-tools (0.97) lucid; urgency=low From a2a92f02d378f27974ca141a65db08049fd76ad4 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Fri, 16 Apr 2010 12:29:02 +0200 Subject: [PATCH 3/6] [ Michael Bienia ] get-branches: Use the LP API to obtain a list of branches of a team. --- debian/changelog | 7 +++ get-branches | 120 +++++++++++++++++------------------------------ 2 files changed, 51 insertions(+), 76 deletions(-) diff --git a/debian/changelog b/debian/changelog index c157142..764ac25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ubuntu-dev-tools (0.99) UNRELEASED; urgency=low + + [ Michael Bienia ] + * get-branches: Use the LP API to obtain a list of branches of a team. + + -- Michael Bienia Fri, 16 Apr 2010 12:25:35 +0200 + ubuntu-dev-tools (0.98) lucid; urgency=low [ Ryan Kavanagh ] diff --git a/get-branches b/get-branches index 68dde7e..3698ca5 100755 --- a/get-branches +++ b/get-branches @@ -25,11 +25,10 @@ # import os -import re import subprocess import sys -import urllib2 from optparse import OptionParser +from ubuntutools.lp.lpapicache import PersonTeam def main(): usage = "Usage: %prog [-d ] -t [-o ]" @@ -49,97 +48,66 @@ def main(): (options, args) = optParser.parse_args() - # Parse our options. - if len(args) != 1 and options.lpteam == None: - optParser.error("No team has been specified.") - - # Launchpad team setting. - if options.lpteam: - team = str(options.lpteam).lower() - if args: - team = str(args[0]).lower() - - directory = options.directory - - # Dictionary settings. - if not os.path.isdir(directory): # Check that it is a directory. - optParser.error("%s is not a valid directory." % directory) - - # Type of Bazaar operation to perform. - operation_type = str(options.operation).lower() - - # Got an argument, check if it is valid. - if operation_type not in ("branch", "checkout"): - optParser.error("Invalid operation '%s' for '-o' flag." % \ - operation_type) - - # Fetch our current directory to return to later. pwd = os.getcwd() - # Change to the specified directory. + # Parse our options. + if len(args) != 1 and options.lpteam == None: + optParser.error("No team has been specified.") + + # Dictionary settings. + directory = options.directory + if not os.path.isdir(directory): # Check that it is a directory. + optParser.error("%s is not a valid directory." % directory) os.chdir(directory) - # Try to open the teams code page. - try: - sock = urllib2.urlopen("https://code.launchpad.net/~%s" % team) - except urllib2.HTTPError: - print >> sys.stderr, "The page https://code.launchpad.net/~%s does " \ - "not exist." % team - print >> sys.stderr, "Perhaps invalid team name?" - sys.exit(1) + # Type of Bazaar operation to perform. + operation_type = options.operation.lower() + if operation_type not in ("branch", "checkout"): + optParser.error("Invalid operation '%s' for '-o' flag." % \ + operation_type) - branch_list_page = sock.read() - sock.close() - - branch_page_urls_regex = r'.*href="/(~%s/.*)">lp:.*' % team - branch_page_urls = re.findall(branch_page_urls_regex, branch_list_page) - - # Check the team actually has branches. - if len(branch_page_urls) == 0: - print "The team '%s' does not have any branches on Launchpad." % team - sys.exit(0) - - print "Downloading all branches for the team '%s'. This may take some " \ - "time." % team + # Launchpad team setting. + if options.lpteam: + team = options.lpteam.lower() + if args: + team = args[0].lower() + try: + team = PersonTeam(team) + except KeyError: + print >> sys.stderr, "E: The team '%s' doesn't exist." % team + + # Get a list of branches + branches = team.getBranches() + + print "Downloading all branches for the '%s' team. This may take some " \ + "time." % team.display_name try: - os.makedirs(team) + os.makedirs(team.name) except: pass - os.chdir(team) - - for url in branch_page_urls: - sock = urllib2.urlopen("https://code.launchpad.net/%s" % url) - branch_page = sock.read() - sock.close() + os.chdir(team.name) - branch_url_regex = r'
bzr branch lp:(.*)
' - branch_url = re.findall(branch_url_regex, branch_page) + for branch in branches: + project_name = branch.project.name + if not os.path.exists(project_name): + os.makedirs(project_name) + os.chdir(project_name) - if branch_url[0]: - print "Downloading branch: lp:%s (%s)." % (branch_url[0], url) - product = url.split("/")[-2] - branch_nick = url.split("/")[-1] + if not os.path.exists(branch.name): + print "Branching %s ..." % branch.display_name + subprocess.call(["bzr", operation_type, branch.bzr_identity, branch.name]) else: - continue - - print branch_nick, product, os.getcwd() - if not os.path.exists(product): - os.makedirs(product) - os.chdir(product) - - if not os.path.exists(branch_nick): - subprocess.call(["bzr", operation_type, "lp:%s" % url]) - else: - os.chdir(branch_nick) + print "Merging %s ..." % branch.display_name + os.chdir(branch.name) subprocess.call(["bzr", "merge", "--pull", "--remember"]) - os.chdir(os.path.join(directory, team)) - + os.chdir(os.path.join(directory, team.name)) + os.chdir(pwd) sys.exit(0) - + if __name__ == "__main__": try: main() From 9c5632cb622e19a51187d4e0463533bdd1a4d771 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Fri, 16 Apr 2010 12:53:07 +0200 Subject: [PATCH 4/6] doc/get-branches.1: Mention that get-branches now uses the LP API instead of screen scraping. --- doc/get-branches.1 | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/get-branches.1 b/doc/get-branches.1 index aa5ca85..95c3477 100644 --- a/doc/get-branches.1 +++ b/doc/get-branches.1 @@ -1,32 +1,39 @@ -.TH GET\-BRANCHES "1" "11 August 2008" "ubuntu-dev-tools" +.TH get\-branches "1" "11 August 2008" "ubuntu-dev-tools" .SH NAME -get\-branches \- downloads all branches related to a Launchpad team or person +get\-branches - downloads all branches related to a Launchpad team or person .SH SYNOPSIS -.B get\-branches [\-d directory] [\-o branch|checkout] \-t +.B get\-branches +.RB [ \-d +.IR directory ] +.RB [ \-o +.BR branch | checkout ] +.B \-t +.I team .br -.B get\-branches +.B get\-branches +.I team .br .B get\-branches \-\-help .SH DESCRIPTION -\fBget\-branches\fR examines the code page of a Launchpad team/person, -parses it, and calls Bazaar to download all branches on that page. +\fBget\-branches\fR uses the LP API to get a list of branches for a person or +team and calls Bazaar to download all branches. .SH OPTIONS Listed below are the command line options for \fBget\-branches\fR: .TP -.B \-h or \-\-help +.BR \-h ", " \-\-help Display a help message and exit. .TP -.B \-d or \-\-directory +.BR \-d ", " \-\-directory Download branches to a directory other than the current directory. .TP -.B \-o or \-\-operation +.BR \-o ", " \-\-operation Specifies which Bazaar operation to use when downloading the branches; may be either \fIbranch\fR or \fIcheckout\fR. .TP -.B \-t or \-\-team +.BR \-t ", " \-\-team Specifies which Launchpad team/person to download branches from. This option is required. From 89766c353b216b54548e5f2f3bebad9458f74a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 16 Apr 2010 12:57:57 +0200 Subject: [PATCH 5/6] Redo 0.98 taking into account latest changes and adding a changelog entry for Soren's changes: * Update get-branches to account for changes in LP's web UI. Really, someone should update it to use the LP API, but for now, this will have to do. --- debian/changelog | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 764ac25..0a57ef0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,4 @@ -ubuntu-dev-tools (0.99) UNRELEASED; urgency=low - - [ Michael Bienia ] - * get-branches: Use the LP API to obtain a list of branches of a team. - - -- Michael Bienia Fri, 16 Apr 2010 12:25:35 +0200 - -ubuntu-dev-tools (0.98) lucid; urgency=low +ubuntu-dev-tools (0.98) UNRELEASED; urgency=low [ Ryan Kavanagh ] * Added the merge-changelog script from @@ -13,12 +6,17 @@ ubuntu-dev-tools (0.98) lucid; urgency=low who need to manually merge packages. * Fixed typo in doc/grab-merge.1 + [ Soren Hansen ] + * Update get-branches to account for changes in LP's web UI. Really, someone + should update it to use the LP API, but for now, this will have to do. + [ Emmet Hikory ] * doc/mk-sbuild.1: add missing options to summary [ Michael Bienia ] * lp-shell: Use "udt-lp-shell" as LP API consumer instead of the non-unique "test" (lp: #558531). + * get-branches: Use the LP API to obtain a list of branches of a team. [ Loïc Minier ] * bash_completion/pbuilder-dist, dch-repeat: list maverick in possible From 06f8f62948f2c071da2fccb6dc1abe18956db4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 16 Apr 2010 12:58:24 +0200 Subject: [PATCH 6/6] Re-release 0.98 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0a57ef0..60eb98f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ubuntu-dev-tools (0.98) UNRELEASED; urgency=low +ubuntu-dev-tools (0.98) lucid; urgency=low [ Ryan Kavanagh ] * Added the merge-changelog script from @@ -23,7 +23,7 @@ ubuntu-dev-tools (0.98) UNRELEASED; urgency=low Ubuntu dists; the default dist for reverse-build-depends and submittodebian should be changed in maverick. - -- Loïc Minier Fri, 16 Apr 2010 11:28:12 +0200 + -- Loïc Minier Fri, 16 Apr 2010 12:58:22 +0200 ubuntu-dev-tools (0.97) lucid; urgency=low