From ed1591648160c5e84cf06eef046b8402482af75d Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Thu, 28 May 2009 05:53:45 -0400 Subject: [PATCH] buildd: Implemented partial launchpadlib support (displays build status and arches for now). --- buildd | 15 ++++++++++++++- ubuntutools/lp/functions.py | 11 ++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/buildd b/buildd index 17e7337..87a9fbc 100755 --- a/buildd +++ b/buildd @@ -117,6 +117,16 @@ except ubuntutools.lp.udtexceptions.SeriesNotFoundException, e: print e sys.exit(1) +# Initialize ubuntu distribution collection. +ubuntuDist = lp_functions.getUbuntuDistribution() +# Get main Ubuntu archive. +archive = ubuntuDist.main_archive +# Get list of published sources for package in question. +sources = archive.getPublishedSources(source_name = package, + status = 'Published') +# Get list of builds for that package. +builds = sources[0].getBuilds() + # Find out the version in given release. (page, version) = packages.checkSourceExists(package, release) @@ -136,10 +146,13 @@ release = release.split('-')[0] # strip off pocket print "Current build status for this package:" +# Output list of arches for package and their status. +for build in builds: + print "%s: %s." % (build.arch_tag, build.buildstate) + for m in re.finditer('"/ubuntu/\+source/%s/%s(/\+build/\d+)"[^\n]+\n\s*(\w+).*?(\w+).*?\s*([^\n]+)\n' % (package.replace('+', '\+'), version.replace('+', '\+')), page, re.S): if m.group(2) == release: - print '%s: %s.' % (m.group(3), m.group(4)) buildstats[url + m.group(1)] = [m.group(3).strip(), m.group(4).strip()] # Check that there actually are builds for that release. diff --git a/ubuntutools/lp/functions.py b/ubuntutools/lp/functions.py index 602fdf8..8f2a55b 100644 --- a/ubuntutools/lp/functions.py +++ b/ubuntutools/lp/functions.py @@ -31,10 +31,15 @@ from re import findall # singleton-style (lazily). launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools") +def getUbuntuDistribution(): + ubuntu = launchpad.distributions['ubuntu'] + + return ubuntu + def ubuntuDevelopmentSeries(): """ Get the string repr of the current Ubuntu development series """ - ubuntu = launchpad.distributions['ubuntu'] + ubuntu = getUbuntuDistribution() return ubuntu.current_series.name def doesUbuntuReleaseExist(name): @@ -48,14 +53,14 @@ def _ubuntuSeries(name): If the series is not found: raise SeriesNotFoundException """ - ubuntu = launchpad.distributions['ubuntu'] + ubuntu = getUbuntuDistribution() try: return ubuntu.getSeries(name_or_version=name) except launchpadlib.errors.HTTPError: - raise SeriesNotFoundException("Error: Unknown Ubuntu release: '%s'." % name) + raise SeriesNotFoundException("Error: Unknown Ubuntu release: '%s'." % name) def _ubuntuSourcePackage(package, series): """ Finds an Ubuntu source package on LP