Rev 66: Use trace.note for most PPA outputs, as stderr isn't buffered. Also handly FULLYBUILT properly. in http://people.canonical.com/~robertc/baz2.0/plugins/builder/blocking
Robert Collins
robertc at robertcollins.net
Wed Oct 28 00:35:34 GMT 2009
At http://people.canonical.com/~robertc/baz2.0/plugins/builder/blocking
------------------------------------------------------------
revno: 66
revision-id: robertc at robertcollins.net-20091028003533-j47cs0qslhaov6q8
parent: robertc at robertcollins.net-20091028003419-rtg5fy624twn7l0e
committer: Robert Collins <robertc at robertcollins.net>
branch nick: blocking
timestamp: Wed 2009-10-28 11:35:33 +1100
message:
Use trace.note for most PPA outputs, as stderr isn't buffered. Also handly FULLYBUILT properly.
=== modified file 'ppa.py'
--- a/ppa.py 2009-10-23 20:43:22 +0000
+++ b/ppa.py 2009-10-28 00:35:33 +0000
@@ -23,12 +23,19 @@
Launchpad, STAGING_SERVICE_ROOT, EDGE_SERVICE_ROOT)
from launchpadlib.credentials import Credentials
+from bzrlib import (
+ errors,
+ trace,
+ )
+
def watch(target, package_name, version):
"""Watch a package build.
:return: 0 once the package built and published completely ok or 2
otherwise.
"""
+ version = str(version)
+ trace.note("logging into launchpad")
# See https://help.launchpad.net/API
credentials = Credentials()
oauth_file = os.path.expanduser('~/.cache/edge_oauth.txt')
@@ -51,14 +58,11 @@
archive = owner.getPPAByName(name=archive_name)
end_states = ['failedtobuild', 'fullybuilt']
important_arches = ['amd64', 'i386', 'lpia', 'armel']
- print "Waiting for", version, "of", package_name, "to build."
+ trace.note("Waiting for %s of %s to build." % (version, package_name))
start = time.time()
while True:
- sourceRecords = [s for s in
- archive.getPublishedSources(source_name=package_name)]
- # print [s.source_package_version for s in sourceRecords]
- sourceRecords = [s for s in sourceRecords
- if s.source_package_version == version]
+ sourceRecords = list(archive.getPublishedSources(
+ source_name=package_name, version=version))
if not sourceRecords:
if time.time() - 900 > start:
# Over 15 minutes and no source yet, upload FAIL.
@@ -66,10 +70,12 @@
"package %s=%s after 15 minutes." % (target, package_name,
version))
return 2
+ trace.note("Source not available yet - waiting.")
time.sleep(60)
continue
pkg = sourceRecords[0]
if pkg.status.lower() not in ('published', 'pending'):
+ trace.note("pkg status: %s" % (pkg.status,))
time.sleep(60)
continue
source_id = str(pkg.self).rsplit('/', 1)[1]
@@ -88,11 +94,14 @@
if not missing:
break
extra = ', '.join(missing)
+ elif buildSummaries['status'] == 'FULLYBUILT':
+ break
else:
extra = ''
- print "%s: %s" % (pkg.display_name, buildSummaries['status']), extra
+ trace.note("%s: %s %s" % (pkg.display_name, buildSummaries['status'],
+ extra))
time.sleep(60)
- print "%s: %s" % (pkg.display_name, buildSummaries['status'])
+ trace.note("%s: %s" % (pkg.display_name, buildSummaries['status']))
result = 0
if pkg.status.lower() != 'published':
result = 2
More information about the bazaar-commits
mailing list