Add tree module.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 4 Dec 2010 00:42:55 +0000 (01:42 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 4 Dec 2010 00:42:55 +0000 (01:42 +0100)
buildfarm/build.py
buildfarm/tree.py [new file with mode: 0644]

index 0cbe3bf..c708f57 100644 (file)
@@ -155,6 +155,16 @@ def check_dir_exists(kind, path):
         raise Exception("%s directory %s does not exist" % (kind, path))
 
 
+def extract_phase_output(f):
+    name = None
+    output = None
+    for l in f:
+
+
+def extract_test_output(f):
+    raise NotImplementedError
+
+
 def build_status_from_logs(log, err):
     """get status of build"""
     # FIXME: Perhaps also extract revision here?
@@ -289,6 +299,10 @@ class Build(object):
         """get the age of build"""
         return time.time() - self.upload_time
 
+    def read_subunit(self):
+        """read the test output as subunit"""
+        return StringIO("".join(extract_test_output(self.read_log())))
+
     def read_log(self):
         """read full log file"""
         try:
diff --git a/buildfarm/tree.py b/buildfarm/tree.py
new file mode 100644 (file)
index 0000000..b6f7f55
--- /dev/null
@@ -0,0 +1,47 @@
+
+#!/usr/bin/python
+# Tree support
+#
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org>   2010
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+from buildfarm.history import GitBranch
+import os
+
+GIT_ROOT = "/data/git"
+
+
+class Tree(object):
+    """A tree to build."""
+
+    def __init__(self, name, scm, repo, branch, subdir="", srcdir=""):
+        self.name = name
+        self.repo = repo
+        self.scm = scm
+        self.branch = branch
+        self.subdir = subdir
+        self.srcdir = srcdir
+        self.scm = scm
+
+    def get_branch(self):
+        if self.scm == "git":
+            return GitBranch(os.path.join(GIT_ROOT, self.repo), self.branch)
+        else:
+            raise NotImplementedError(self.scm)
+
+    def __repr__(self):
+        return "<%s %r>" % (self.__class__.__name__, self.name)