implement get_build on the buildfarm object so that it can dispatch to the adhoc...
authorMatthieu Patou <mat@matws.net>
Wed, 10 Nov 2010 23:39:16 +0000 (02:39 +0300)
committerMatthieu Patou <mat@matws.net>
Wed, 10 Nov 2010 23:43:08 +0000 (02:43 +0300)
buildfarm/__init__.py

index 6d343778d777ae2a7ccd5ccbc19cc057944e28dc..118a72917c65bf51c2dab7c46730825bcdeef400 100644 (file)
@@ -128,6 +128,24 @@ class BuildFarm(object):
             util.FileSave(cachefile, ret)
         return perc
 
+    def get_build(self, tree, host, compiler, rev=None):
+        if rev:
+            if host in self.hostdb.hosts() and\
+                    tree in self.trees and\
+                    compiler in self.compilers:
+                return self.builds.get_build(tree, host, compiler)
+            else:
+                from buildfarm import data
+                raise data.NoSuchBuildError(tree, host, compiler)
+        else:
+            if host in [h.name for h in self.hostdb.hosts()] and\
+                    tree in self.trees and\
+                    compiler in self.compilers:
+                return self.upload_builds.get_build(tree, host, compiler)
+            else:
+                from buildfarm import data
+                raise data.NoSuchBuildError(tree, host, compiler)
+
     def get_new_builds(self):
         from buildfarm import data
         for host in self.hostdb.hosts():