[SCM] build.samba.org - branch master updated

Jelmer Vernooij jelmer at samba.org
Wed Nov 17 02:42:00 MST 2010


The branch, master has been updated
       via  f6fa31a Properly encode compiler name.
       via  5fadab2 Remove no longer used file cache.
      from  c8204d2 Skip unknown hosts.

http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f6fa31aea71a2b01e1b6fbed41c6b61b92ced648
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Nov 17 10:41:25 2010 +0100

    Properly encode compiler name.

commit 5fadab21a4d957f02d6886714d911c5c56a315f0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Nov 17 10:39:30 2010 +0100

    Remove no longer used file cache.

-----------------------------------------------------------------------

Summary of changes:
 buildfarm/filecache.py            |  201 -------------------------------------
 buildfarm/tests/test_filecache.py |   70 -------------
 buildfarm/web/__init__.py         |    2 +-
 3 files changed, 1 insertions(+), 272 deletions(-)
 delete mode 100644 buildfarm/filecache.py
 delete mode 100644 buildfarm/tests/test_filecache.py


Changeset truncated at 500 lines:

diff --git a/buildfarm/filecache.py b/buildfarm/filecache.py
deleted file mode 100644
index 0e0823d..0000000
--- a/buildfarm/filecache.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/python
-# Simple database query script for the buildfarm
-#
-# Copyright (C) Jelmer Vernooij <jelmer at 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 import (
-    BuildFarm,
-    util,
-    )
-from buildfarm.data import (
-    Build,
-    BuildResultStore,
-    BuildStatus,
-    NoSuchBuildError,
-    UploadBuildResultStore,
-    check_dir_exists,
-    )
-
-import os
-
-
-class CachingBuild(Build):
-    """Build subclass that caches some of the results that are expensive
-    to calculate."""
-
-    def __init__(self, store, *args, **kwargs):
-        self._store = store
-        super(CachingBuild, self).__init__(*args, **kwargs)
-        if self.revision:
-            self.cache_basename = self._store.cache_fname(self.tree, self.host, self.compiler, self.revision)
-        else:
-            self.cache_basename = self._store.cache_fname(self.tree, self.host, self.compiler)
-
-    def revision_details(self):
-        st1 = os.stat("%s.log" % self.basename)
-
-        try:
-            st2 = os.stat("%s.revision" % self.cache_basename)
-        except OSError:
-            # File does not exist
-            st2 = None
-
-        # the ctime/mtime asymmetry is needed so we don't get fooled by
-        # the mtime update from rsync
-        if st2 and st1.st_ctime <= st2.st_mtime:
-            (revid, timestamp) = util.FileLoad("%s.revision" % self.cache_basename).split(":", 2)
-            if timestamp == "":
-                timestamp = None
-            if revid == "":
-                revid = None
-            return (revid, timestamp)
-        (revid, timestamp) = super(CachingBuild, self).revision_details()
-        if not self._store.readonly:
-            util.FileSave("%s.revision" % self.cache_basename, "%s:%s" % (revid, timestamp or ""))
-        return (revid, timestamp)
-
-    def err_count(self):
-        st1 = os.stat("%s.err" % self.basename)
-
-        try:
-            st2 = os.stat("%s.errcount" % self.cache_basename)
-        except OSError:
-            # File does not exist
-            st2 = None
-
-        if st2 and st1.st_ctime <= st2.st_mtime:
-            return util.FileLoad("%s.errcount" % self.cache_basename)
-
-        ret = super(CachingBuild, self).err_count()
-
-        if not self._store.readonly:
-            util.FileSave("%s.errcount" % self.cache_basename, str(ret))
-
-        return ret
-
-    def status(self):
-        cachefile = self.cache_basename + ".status"
-
-        st1 = os.stat("%s.log" % self.basename)
-
-        try:
-            st2 = os.stat(cachefile)
-        except OSError:
-            # No such file
-            st2 = None
-
-        if st2 and st1.st_ctime <= st2.st_mtime:
-            return BuildStatus.__deserialize__(util.FileLoad(cachefile))
-
-        ret = super(CachingBuild, self).status()
-
-        if not self._store.readonly:
-            util.FileSave(cachefile, ret.__serialize__())
-
-        return ret
-
-
-class CachingUploadBuildResultStore(UploadBuildResultStore):
-
-    def __init__(self, basedir, cachedir, readonly=False):
-        """Open the database.
-
-        :param readonly: Whether to avoid saving cache files
-        """
-        super(CachingUploadBuildResultStore, self).__init__(basedir)
-        self.cachedir = cachedir
-        self.readonly = readonly
-
-    def cache_fname(self, tree, host, compiler):
-        return os.path.join(self.cachedir, "build.%s.%s.%s" % (tree, host, compiler))
-
-    def get_build(self, tree, host, compiler):
-        basename = self.build_fname(tree, host, compiler)
-        logf = "%s.log" % basename
-        if not os.path.exists(logf):
-            raise NoSuchBuildError(tree, host, compiler)
-        return CachingBuild(self, basename, tree, host, compiler)
-
-
-class CachingBuildResultStore(BuildResultStore):
-
-    def __init__(self, basedir, cachedir, readonly=False):
-        super(CachingBuildResultStore, self).__init__(basedir)
-
-        self.cachedir = cachedir
-        check_dir_exists("cache", self.cachedir)
-
-        self.readonly = readonly
-
-    def get_build(self, tree, host, compiler, rev):
-        basename = self.build_fname(tree, host, compiler, rev)
-        logf = "%s.log" % basename
-        if not os.path.exists(logf):
-            raise NoSuchBuildError(tree, host, compiler, rev)
-        return CachingBuild(self, basename, tree, host, compiler, rev)
-
-    def cache_fname(self, tree, host, compiler, rev):
-        return os.path.join(self.cachedir, "build.%s.%s.%s-%s" % (tree, host, compiler, rev))
-
-
-class CachingBuildFarm(BuildFarm):
-
-    def __init__(self, path=None, readonly=False, cachedirname=None):
-        self._cachedirname = cachedirname
-        self.readonly = readonly
-        super(CachingBuildFarm, self).__init__(path)
-
-    def _get_cachedir(self):
-        if self._cachedirname is not None:
-            return os.path.join(self.path, self._cachedirname)
-        else:
-            return os.path.join(self.path, "cache")
-
-    def _open_build_results(self):
-        return CachingBuildResultStore(os.path.join(self.path, "data", "oldrevs"),
-                self._get_cachedir(), readonly=self.readonly)
-
-    def _open_upload_build_results(self):
-        return CachingUploadBuildResultStore(os.path.join(self.path, "data", "upload"),
-                self._get_cachedir(), readonly=self.readonly)
-
-    def lcov_status(self, tree):
-        """get status of build"""
-        cachefile = os.path.join(self._get_cachedir(),
-                                    "lcov.%s.%s.status" % (self.LCOVHOST, tree))
-        file = os.path.join(self.lcovdir, self.LCOVHOST, tree, "index.html")
-        try:
-            st1 = os.stat(file)
-        except OSError:
-            # File does not exist
-            raise NoSuchBuildError(tree, self.LCOVHOST, "lcov")
-        try:
-            st2 = os.stat(cachefile)
-        except OSError:
-            # file does not exist
-            st2 = None
-
-        if st2 and st1.st_ctime <= st2.st_mtime:
-            ret = util.FileLoad(cachefile)
-            if ret == "":
-                return None
-            return ret
-
-        perc = super(CachingBuildFarm, self).lcov_status(tree)
-        if not self.readonly:
-            util.FileSave(cachefile, perc)
-        return perc
diff --git a/buildfarm/tests/test_filecache.py b/buildfarm/tests/test_filecache.py
deleted file mode 100644
index 9a7a4d2..0000000
--- a/buildfarm/tests/test_filecache.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Copyright (C) Jelmer Vernooij <jelmer at 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 3 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.tests import BuildFarmTestCase
-from buildfarm.tests.test_buildfarm import BuildFarmTestBase
-from buildfarm.filecache import (
-    CachingBuildFarm,
-    CachingBuildResultStore,
-    CachingUploadBuildResultStore,
-    )
-from buildfarm.tests.test_data import (
-    BuildResultStoreTestBase,
-    UploadBuildResultStoreTestBase,
-    )
-import os
-
-
-class CachingBuildFarmTests(BuildFarmTestBase, BuildFarmTestCase):
-
-    def setUp(self):
-        BuildFarmTestCase.setUp(self)
-        BuildFarmTestBase.setUp(self)
-        self.x = CachingBuildFarm(self.path)
-
-
-class CachingUploadBuildResultStoreTests(UploadBuildResultStoreTestBase,BuildFarmTestCase):
-
-    def setUp(self):
-        super(CachingUploadBuildResultStoreTests, self).setUp()
-
-        self.x = CachingUploadBuildResultStore(
-            os.path.join(self.path, "data", "upload"),
-            os.path.join(self.path, "cache"))
-
-    def test_cache_fname(self):
-        self.assertEquals(
-            self.x.cache_fname("mytree", "myhost", "cc"),
-            "%s/cache/build.mytree.myhost.cc" % self.path)
-
-
-class CachingBuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
-
-    def setUp(self):
-        super(CachingBuildResultStoreTests, self).setUp()
-
-        self.x = CachingBuildResultStore(
-            os.path.join(self.path, "data", "oldrevs"),
-            os.path.join(self.path, "cache"))
-
-    def test_cache_fname(self):
-        self.assertEquals(
-            self.x.cache_fname("mytree", "myhost", "cc", 123),
-            "%s/cache/build.mytree.myhost.cc-123" % self.path)
-
-
-
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 58a5653..159085f 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -629,7 +629,7 @@ class ViewRecentBuildsPage(BuildFarmPage):
                     host.platform.encode("utf-8"),
                     "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>"
                         % (myself, host.name.encode("utf-8"),
-                           tree, build.compiler, host.name.encode("utf-8"),
+                           tree, build.compiler.encode("utf-8"), host.name.encode("utf-8"),
                            host.name.encode("utf-8")),
                     build.compiler, tree, status, build.status(),
                     revision_link(myself, revision, tree),


-- 
build.samba.org


More information about the samba-cvs mailing list