Rev 63: Add a timeout on watching, don't check that dput specs are ppas unless --watch is requested. in http://people.canonical.com/~robertc/baz2.0/plugins/builder/blocking
Robert Collins
robertc at robertcollins.net
Fri Oct 23 21:37:39 BST 2009
At http://people.canonical.com/~robertc/baz2.0/plugins/builder/blocking
------------------------------------------------------------
revno: 63
revision-id: robertc at robertcollins.net-20091023203724-4ekzxm9g5qp39suy
parent: robertc at robertcollins.net-20091023070311-00ctfa4iqwfchs95
committer: Robert Collins <robertc at robertcollins.net>
branch nick: blocking
timestamp: Sat 2009-10-24 07:37:24 +1100
message:
Add a timeout on watching, don't check that dput specs are ppas unless --watch is requested.
=== modified file '__init__.py'
--- a/__init__.py 2009-10-23 01:46:39 +0000
+++ b/__init__.py 2009-10-23 20:37:24 +0000
@@ -263,11 +263,13 @@
if dput is not None and key_id is None:
raise errors.BzrCommandError("You must specify --key-id if you "
"specify --dput.")
- if not dput and watch_ppa:
- raise errors.BzrCommandError(
- "cannot watch a ppa without doing dput.")
- elif dput:
- target_from_dput(dput)
+ if watch_ppa:
+ if not dput:
+ raise errors.BzrCommandError(
+ "cannot watch a ppa without doing dput.")
+ else:
+ # Check we can calculate a PPA url.
+ target_from_dput(dput)
base_branch = self._get_branch_from_recipe_file(recipe_file)
time = datetime.datetime.utcnow()
@@ -476,7 +478,9 @@
:return: A LP API target like team-name/ppa.
"""
if not dput.startswith('ppa:'):
- raise errors.BzrCommandError('not a ppa %s' % dput)
+ raise errors.BzrCommandError('%r does not appear to be a PPA.'
+ 'A dput target like ppa:user[/name] must be used.' % dput)
+ # ppa: is 4 characters long.
base, _, suffix = dput[4:].partition('/')
if not suffix:
suffix = 'ppa'
=== modified file 'ppa.py'
--- a/ppa.py 2009-10-23 07:03:11 +0000
+++ b/ppa.py 2009-10-23 20:37:24 +0000
@@ -52,6 +52,7 @@
end_states = ['failedtobuild', 'fullybuilt']
important_arches = ['amd64', 'i386', 'lpia', 'armel']
print "Waiting for", version, "of", package_name, "to build."
+ start = time.time()
while True:
sourceRecords = [s for s in
archive.getPublishedSources(source_name=package_name)]
@@ -59,6 +60,12 @@
sourceRecords = [s for s in sourceRecords
if s.source_package_version == version]
if not sourceRecords:
+ if time.time() - 900 > start:
+ # Over 15 minutes and no source yet, upload FAIL.
+ raise errors.BzrCommandError("No source record in %s for "
+ "package %s=%s after 15 minutes." % (target, package_name,
+ version))
+ return 2
time.sleep(60)
continue
pkg = sourceRecords[0]
More information about the bazaar-commits
mailing list