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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  088d389 Add id column to host.
  from  7645665 Add test for Kai's wrong culprit mail.

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


- Log -
commit 088d3890082900cdbef6c22b62c74ee658793a4e
Author: Jelmer Vernooij 
Date:   Wed Nov 17 11:49:13 2010 +0100

Add id column to host.

---

Summary of changes:
 .bzrignore |1 +
 buildfarm/sqldb.py |5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.bzrignore b/.bzrignore
index 222c794..a34bfd1 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,2 +1,3 @@
 hostdb.sqlite
 _trial_temp
+db
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 11994c0..4542c8a 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -73,7 +73,8 @@ class StormBuild(Build):
 class StormHost(Host):
 __storm_table__ = "host"
 
-name = RawStr(primary=True)
+id = Int(primary=True)
+name = RawStr()
 owner_name = Unicode(name="owner")
 owner_email = Unicode()
 password = Unicode()
@@ -258,7 +259,7 @@ class StormCachingBuildFarm(BuildFarm):
 
 
 def setup_schema(db):
-db.execute("CREATE TABLE IF NOT EXISTS host (name blob, owner text, 
owner_email text, password text, ssh_access int, fqdn text, platform text, 
permission text, last_dead_mail int, join_time int);", noresult=True)
+db.execute("CREATE TABLE IF NOT EXISTS host (id integer primary key 
autoincrement, name blob, owner text, owner_email text, password text, 
ssh_access int, fqdn text, platform text, permission text, last_dead_mail int, 
join_time int);", noresult=True)
 db.execute("CREATE UNIQUE INDEX IF NOT EXISTS unique_hostname ON host 
(name);", noresult=True)
 db.execute("CREATE TABLE IF NOT EXISTS build (id integer primary key 
autoincrement, tree blob, revision blob, host blob, compiler blob, checksum 
blob, age int, status blob, commit_revision blob);", noresult=True)
 db.execute("CREATE UNIQUE INDEX IF NOT EXISTS unique_checksum ON build 
(checksum);", noresult=True)


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  7645665 Add test for Kai's wrong culprit mail.
   via  4b037f0 Simplify menu.
  from  d81c9cd Remove more pointless encoding.

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


- Log -
commit 76456654a64f6b058a2d14d93c6474a360661f7f
Author: Jelmer Vernooij 
Date:   Wed Nov 17 11:38:27 2010 +0100

Add test for Kai's wrong culprit mail.

commit 4b037f0066cafaca84d7a62ee8438eeb21281f45
Author: Jelmer Vernooij 
Date:   Wed Nov 17 11:36:53 2010 +0100

Simplify menu.

---

Summary of changes:
 buildfarm/tests/test_data.py |8 +++-
 buildfarm/web/__init__.py|   13 ++---
 2 files changed, 9 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 4ed8a16..cf4d906 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -18,7 +18,6 @@
 from cStringIO import StringIO
 import os
 import testtools
-import time
 import unittest
 
 from buildfarm import data
@@ -340,6 +339,13 @@ class BuildStatusRegressedSinceTests(testtools.TestCase):
 ([("CONFIGURE", 0)], []),
 ([("CONFIGURE", 0), ("BUILD", 0)], []))
 
+def test_less_errors(self):
+self.assertRegressedSince(
+False,
+([("CONFIGURE", 0), ("BUILD", 0), ("TEST", 0), ("INSTALL", 1)], 
[]),
+([("CONFIGURE", 0), ("BUILD", 0), ("TEST", 0), ("INSTALL", 0)], 
[]))
+
+
 
 class UploadBuildResultStoreTestBase(object):
 
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 7badf2d..3d091a4 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -698,12 +698,6 @@ class ViewHostPage(BuildFarmPage):
 yield ""
 yield 'Host summary:'
 for host in requested_hosts:
-# make sure we have some data from it
-try:
-self.buildfarm.hostdb.host(host)
-except hostdb.NoSuchHost:
-continue
-
 builds = list(self.buildfarm.get_host_builds(host))
 if len(builds) > 0:
 yield "".join(self._render_build_list_header(host))
@@ -894,18 +888,15 @@ class BuildFarmApp(object):
 def __init__(self, buildfarm):
 self.buildfarm = buildfarm
 
-# host.properties are unicode object and the framework expect string 
object
-self.hosts = dict([(host.name, host) for host in 
self.buildfarm.hostdb.hosts()])
-
 def main_menu(self):
 """main page"""
 
 yield "\n"
 yield "\n"
 yield "\n"
-for name, host in self.hosts.iteritems():
+for  host in self.buildfarm.hostdb.hosts():
 yield "%s -- %s\n" % (
-name, host.platform.encode("utf-8"), name)
+host.name, host.platform.encode("utf-8"), host.name)
 yield "\n"
 yield "\n"
 for tree, t in self.buildfarm.trees.iteritems():


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  d81c9cd Remove more pointless encoding.
  from  6bfd1e4 Get rid of some unicode.

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


- Log -
commit d81c9cd5e8fc9ebfb7c42508c8f46fd8b6910132
Author: Jelmer Vernooij 
Date:   Wed Nov 17 11:19:32 2010 +0100

Remove more pointless encoding.

---

Summary of changes:
 buildfarm/hostdb.py   |4 ++--
 buildfarm/web/__init__.py |   12 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/hostdb.py b/buildfarm/hostdb.py
index ed4e753..24186c2 100644
--- a/buildfarm/hostdb.py
+++ b/buildfarm/hostdb.py
@@ -125,7 +125,7 @@ class HostDatabase(object):
 """Write out the web/"""
 
 for host in self.hosts():
-yield "%s: %s\n" % (host.name.encode("utf-8"), 
host.platform.encode("utf-8"))
+yield "%s: %s\n" % (host.name, host.platform.encode("utf-8"))
 
 def commit(self):
 pass
@@ -143,7 +143,7 @@ class PlainTextHostDatabase(HostDatabase):
 try:
 for l in f:
 (host, platform) = l.split(":", 1)
-ret[host.decode("utf-8")] = platform.strip().decode("utf-8")
+ret[host] = platform.strip().decode("utf-8")
 finally:
 f.close()
 return cls(ret)
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 159085f..7badf2d 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -628,9 +628,9 @@ class ViewRecentBuildsPage(BuildFarmPage):
 build.age,
 host.platform.encode("utf-8"),
 "%s"
-% (myself, host.name.encode("utf-8"),
-   tree, build.compiler.encode("utf-8"), 
host.name.encode("utf-8"),
-   host.name.encode("utf-8")),
+% (myself, host.name,
+   tree, build.compiler, host.name,
+   host.name),
 build.compiler, tree, status, build.status(),
 revision_link(myself, revision, tree),
 revision_time])
@@ -674,7 +674,7 @@ class ViewHostPage(BuildFarmPage):
 def _render_build_list_header(self, host):
 yield ""
 yield ""
-yield "%s - %s" % (host.encode("utf-8"), 
self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
+yield "%s - %s" % (host, 
self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
 yield ""
 yield 
"TargetBuildRevisionBuildAgeStatusconfig/buildinstall/testWarnings"
 yield ""
@@ -734,7 +734,7 @@ class ViewHostPage(BuildFarmPage):
 "Tree", "Compiler", "Build Age", "Status", "Warnings")
 for build in builds:
 yield "%-12s %-10s %-10s %-10s %-10s\n" % (
-build.tree.encode("utf-8"), 
build.compiler.encode("utf-8"),
+build.tree, build.compiler,
 util.dhm_time(build.age),
 str(build.status()), build.err_count())
 yield "\n"
@@ -895,7 +895,7 @@ class BuildFarmApp(object):
 self.buildfarm = buildfarm
 
 # host.properties are unicode object and the framework expect string 
object
-self.hosts = dict([(host.name.encode("utf-8"), host) for host in 
self.buildfarm.hostdb.hosts()])
+self.hosts = dict([(host.name, host) for host in 
self.buildfarm.hostdb.hosts()])
 
 def main_menu(self):
 """main page"""


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  6bfd1e4 Get rid of some unicode.
   via  e4f9636 Change some fields to blobs.
  from  f6fa31a Properly encode compiler name.

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


- Log -
commit 6bfd1e462e6055a78f33c9a885cce52c9a1020ea
Author: Jelmer Vernooij 
Date:   Wed Nov 17 11:17:41 2010 +0100

Get rid of some unicode.

commit e4f96367b2b828953b357827fe28fedc645f911b
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:57:57 2010 +0100

Change some fields to blobs.

---

Summary of changes:
 admin.py   |   14 +-
 buildfarm/__init__.py  |2 -
 buildfarm/sqldb.py |   51 ---
 buildfarm/tests/test_data.py   |4 +-
 buildfarm/tests/test_hostdb.py |   30 +++---
 5 files changed, 50 insertions(+), 51 deletions(-)


Changeset truncated at 500 lines:

diff --git a/admin.py b/admin.py
index 79c6ce7..0fb8231 100755
--- a/admin.py
+++ b/admin.py
@@ -70,7 +70,7 @@ else:
 if op == "remove":
 hostname = raw_input("Please enter hostname to delete: ")
 try:
-db.deletehost(hostname.decode("utf-8"))
+db.deletehost(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -81,7 +81,7 @@ if op == "remove":
 elif op == "modify":
 hostname = raw_input("Please enter hostname to modify: ")
 try:
-host = db.host(hostname.decode("utf-8"))
+host = db.host(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -93,12 +93,12 @@ elif op == "modify":
 mod_op = "platform"
 if mod_op == "platform":
 platform = raw_input("Enter new platform: ")
-host.update_platform(platform.decode("utf-8"))
+host.update_platform(platform)
 db.commit()
 elif mod_op == "owner":
 owner = raw_input("Enter new owner's name: ")
 owner_email = raw_input("Enter new owner's e-mail address: ")
-host.update_owner(owner.decode("utf-8"), owner_email.decode("utf-8"))
+host.update_owner(owner, owner_email.decode("utf-8"))
 db.commit()
 else:
 print "Unknown subcommand %s" % mod_op
@@ -108,7 +108,7 @@ elif op == "modify":
 elif op == "add":
 hostname = raw_input("Machine hostname: ")
 try:
-db.host(hostname.decode("utf-8"))
+db.host(hostname)
 except hostdb.NoSuchHost, e:
 pass
 else:
@@ -129,7 +129,7 @@ elif op == "add":
 line = raw_input("")
 
 try:
-db.createhost(hostname.decode("utf-8"), platform.decode("utf-8"),
+db.createhost(hostname, platform.decode("utf-8"),
 owner.decode("utf-8"), owner_email.decode("utf-8"),
 password.decode("utf-8"),
 "".join(permission).decode("utf-8", "replace"))
@@ -192,7 +192,7 @@ Thanks, your friendly Samba build farm administrator 
""" % owne
 elif op == "info":
 hostname = raw_input("Hostname: ")
 try:
-host = db.host(hostname.decode("utf-8"))
+host = db.host(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index d185ed4..5d35f42 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -154,5 +154,3 @@ class BuildFarm(object):
 yield self.get_build(tree, host, compiler)
 except data.NoSuchBuildError:
 pass
-
-
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index b69da4d..11994c0 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -47,13 +47,13 @@ class StormBuild(Build):
 __storm_table__ = "build"
 
 id = Int(primary=True)
-tree = Unicode()
+tree = RawStr()
 revision = RawStr()
-host = Unicode()
-compiler = Unicode()
+host = RawStr()
+compiler = RawStr()
 checksum = RawStr()
 age = Int()
-status_str = Unicode(name="status")
+status_str = RawStr(name="status")
 commit_revision = RawStr()
 
 def status(self):
@@ -73,7 +73,7 @@ class StormBuild(Build):
 class StormHost(Host):
 __storm_table__ = "host"
 
-name = Unicode(primary=True)
+name = RawStr(primary=True)
 owner_name = Unicode(name=&

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

2010-11-17 Thread Jelmer Vernooij
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 
Date:   Wed Nov 17 10:41:25 2010 +0100

Properly encode compiler name.

commit 5fadab21a4d957f02d6886714d911c5c56a315f0
Author: Jelmer Vernooij 
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..000
--- a/buildfarm/filecache.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/python
-# Simple database query script for the buildfarm
-#
-# Copyright (C) Jelmer Vernooij 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.readon

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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  c8204d2 Skip unknown hosts.
  from  d7832c5 Cope with unknown trees.

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


- Log -
commit c8204d21027d97ee249acb5382ea2441769abf43
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:37:40 2010 +0100

Skip unknown hosts.

---

Summary of changes:
 buildfarm/sqldb.py|2 +-
 buildfarm/web/__init__.py |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 304faa1..b69da4d 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -249,7 +249,7 @@ class StormCachingBuildFarm(BuildFarm):
 def get_last_builds(self, tree=None):
 extra_expr = []
 if tree is not None:
-extra_expr.append(StormBuild.tree == tree)
+extra_expr.append(StormBuild.tree == unicode(tree))
 return self._get_store().find(StormBuild, *extra_expr)
 
 def commit(self):
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 6daec21..58a5653 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -613,7 +613,11 @@ class ViewRecentBuildsPage(BuildFarmPage):
 assert sort_by in cmp_funcs, "not a valid sort"
 
 for build in self.buildfarm.get_last_builds(tree=tree):
-host = self.buildfarm.hostdb.host(build.host)
+try:
+host = self.buildfarm.hostdb.host(build.host)
+except hostdb.NoSuchHost:
+# Skip, at least for now.
+continue
 status = build_status_html(myself, build)
 try:
 (revision, revision_time) = build.revision_details()


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  d7832c5 Cope with unknown trees.
  from  20c6f90 Fix age handling.

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


- Log -
commit d7832c54a632c0a942719f94f6cc3229a01d4dcc
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:30:00 2010 +0100

Cope with unknown trees.

---

Summary of changes:
 buildfarm/web/__init__.py |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 7a2bf2a..6daec21 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -29,6 +29,7 @@
 # TODO: Allow filtering of the "Recent builds" list to show
 # e.g. only broken builds or only builds that you care about.
 
+from collections import defaultdict
 import os
 
 from buildfarm import (
@@ -760,15 +761,9 @@ class ViewHostPage(BuildFarmPage):
 class ViewSummaryPage(BuildFarmPage):
 
 def _get_counts(self):
-broken_count = {}
-panic_count = {}
-host_count = {}
-
-# zero broken and panic counters
-for tree in self.buildfarm.trees:
-broken_count[tree] = 0
-panic_count[tree] = 0
-host_count[tree] = 0
+broken_count = defaultdict(lambda: 0)
+panic_count = defaultdict(lambda: 0)
+host_count = defaultdict(lambda: 0)
 
 # set up a variable to store the broken builds table's code, so we can
 # output when we want


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  20c6f90 Fix age handling.
  from  7d445b7 Fix tree argument to storm get_last_builds.

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


- Log -
commit 20c6f90f3c3df367d0da520e2aa54f293ee705b8
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:26:07 2010 +0100

Fix age handling.

---

Summary of changes:
 buildfarm/data.py|   17 -
 buildfarm/filecache.py   |1 -
 buildfarm/sqldb.py   |2 +-
 buildfarm/tests/test_data.py |   10 +-
 buildfarm/web/__init__.py|   14 --
 5 files changed, 10 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 2ef40b0..3846e8b 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -233,18 +233,9 @@ class Build(object):
 def remove(self):
 self.remove_logs()
 
-###
-# the mtime age is used to determine if builds are still happening
-# on a host.
-# the ctime age is used to determine when the last real build happened
-
-def age_mtime(self):
-"""get the age of build from mtime"""
-st = os.stat("%s.log" % self.basename)
-return time.time() - st.st_mtime
-
-def age_ctime(self):
-"""get the age of build from ctime"""
+@property
+def age(self):
+"""get the age of build"""
 st = os.stat("%s.log" % self.basename)
 return time.time() - st.st_ctime
 
@@ -401,7 +392,7 @@ class BuildResultStore(object):
 continue
 ret.append(self.get_build(tree, host, compiler, rev))
 
-ret.sort(lambda a, b: cmp(a.age_mtime(), b.age_mtime()))
+ret.sort(lambda a, b: cmp(a.age, b.age))
 
 return ret
 
diff --git a/buildfarm/filecache.py b/buildfarm/filecache.py
index bd15d5f..0e0823d 100644
--- a/buildfarm/filecache.py
+++ b/buildfarm/filecache.py
@@ -24,7 +24,6 @@ from buildfarm import (
 from buildfarm.data import (
 Build,
 BuildResultStore,
-BuildStageResult,
 BuildStatus,
 NoSuchBuildError,
 UploadBuildResultStore,
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 00b150f..304faa1 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -203,7 +203,7 @@ class StormCachingBuildResultStore(BuildResultStore):
 new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host),
 unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
-new_build.age = build.age_mtime()
+new_build.age = build.age
 new_build.status_str = unicode(build.status().__serialize__())
 self.store.add(new_build)
 return new_build
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index c96b266..87e8dc9 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -52,14 +52,6 @@ class BuildResultStoreTestBase(object):
 build = self.x.get_build("tdb", "charis", "cc", "12")
 self.assertEquals("<%s: revision 12 of tdb on charis using cc>" % 
build.__class__.__name__, repr(build))
 
-def test_build_age_mtime(self):
-path = self.create_mock_logfile("tdb", "charis", "cc", "12")
-# Set mtime to something in the past
-os.utime(path, (time.time(), time.time() - 990))
-build = self.x.get_build("tdb", "charis", "cc", "12")
-age = build.age_mtime()
-self.assertTrue(age >= 990 and age <= 1000, "age was %d" % age)
-
 def test_get_build_nonexistant(self):
 self.assertRaises(data.NoSuchBuildError, self.x.get_build, "tdb",
 "charis", "cc", "12")
@@ -68,7 +60,7 @@ class BuildResultStoreTestBase(object):
 path = self.create_mock_logfile("tdb", "charis", "cc", "12")
 # Set mtime to something in the past
 build = self.x.get_build("tdb", "charis", "cc", "12")
-age = build.age_ctime()
+age = build.age
 self.assertTrue(age >= 0 and age <= 10, "age was %d" % age)
 
 def test_read_log(self):
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 5c771c3..7a2bf2a 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -487,7 +487,6 @@ class ViewBuildPage(BuildFarmPage):
 cflags = ""
 config = ""
 build = self.buildfarm.get_build(tree, host, compiler, rev)
-age_mtime

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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  7d445b7 Fix tree argument to storm get_last_builds.
  from  d8b9cdd Implement sql-specific get_last_builds.

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


- Log -
commit 7d445b77eb6779b807e0845b20625c5c5a32dfd2
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:20:01 2010 +0100

Fix tree argument to storm get_last_builds.

---

Summary of changes:
 buildfarm/sqldb.py |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index eebc7d8..00b150f 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -246,8 +246,10 @@ class StormCachingBuildFarm(BuildFarm):
 return self._get_store().find(StormBuild,
 StormBuild.host == host).group_by(StormBuild.compiler, 
StormBuild.tree)
 
-def get_last_builds(self, tree):
-extra_expr = [StormBuild.tree == tree]
+def get_last_builds(self, tree=None):
+extra_expr = []
+if tree is not None:
+extra_expr.append(StormBuild.tree == tree)
 return self._get_store().find(StormBuild, *extra_expr)
 
 def commit(self):


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  d8b9cdd Implement sql-specific get_last_builds.
   via  ccf5ceb Add convenience function for finding all recent builds.
  from  2d03606 Simplify build status code a bit.

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


- Log -
commit d8b9cddfc9b7ae49554398af747927eba1cabf94
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:18:41 2010 +0100

Implement sql-specific get_last_builds.

commit ccf5ceb19c105f6c79cda2de561fd40c40eb0c49
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:16:03 2010 +0100

Add convenience function for finding all recent builds.

---

Summary of changes:
 buildfarm/__init__.py |5 +++
 buildfarm/sqldb.py|4 ++
 buildfarm/web/__init__.py |   75 -
 3 files changed, 42 insertions(+), 42 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 41df8d1..d185ed4 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -141,6 +141,11 @@ class BuildFarm(object):
 if build.tree in self.trees and build.compiler in self.compilers 
and build.host in hostnames:
 yield build
 
+def get_last_builds(self, tree=None):
+for build in self.get_new_builds():
+if tree is not None and build.tree == tree:
+yield build
+
 def get_host_builds(self, host):
 from buildfarm import data
 for compiler in self.compilers:
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index fdee2dd..eebc7d8 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -246,6 +246,10 @@ class StormCachingBuildFarm(BuildFarm):
 return self._get_store().find(StormBuild,
 StormBuild.host == host).group_by(StormBuild.compiler, 
StormBuild.tree)
 
+def get_last_builds(self, tree):
+extra_expr = [StormBuild.tree == tree]
+return self._get_store().find(StormBuild, *extra_expr)
+
 def commit(self):
 self.store.commit()
 
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 2db0d05..5c771c3 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -612,36 +612,31 @@ class ViewRecentBuildsPage(BuildFarmPage):
 assert tree in self.buildfarm.trees, "not a build tree"
 assert sort_by in cmp_funcs, "not a valid sort"
 
-t = self.buildfarm.trees[tree]
-
-for host in self.buildfarm.hostdb.hosts():
-for compiler in self.buildfarm.compilers:
-try:
-build = self.buildfarm.get_build(tree, 
host.name.encode("utf-8"), compiler)
-status = build_status_html(myself, build)
-except data.NoSuchBuildError:
-pass
-else:
-age_mtime = build.age_mtime()
-age_ctime = build.age_ctime()
-try:
-(revision, revision_time) = build.revision_details()
-except data.MissingRevisionInfo:
-pass
-else:
-all_builds.append([
-age_ctime,
-host.platform.encode("utf-8"),
-"%s"
-% (myself, host.name.encode("utf-8"),
-   tree, compiler, host.name.encode("utf-8"),
-   host.name.encode("utf-8")),
-compiler, tree, status, build.status(),
-revision_link(myself, revision, tree),
-revision_time])
+for build in self.buildfarm.get_last_builds(tree=tree):
+host = self.buildfarm.hostdb.host(build.host)
+status = build_status_html(myself, build)
+age_mtime = build.age_mtime()
+age_ctime = build.age_ctime()
+try:
+(revision, revision_time) = build.revision_details()
+except data.MissingRevisionInfo:
+pass
+else:
+all_builds.append([
+age_ctime,
+host.platform.encode("utf-8"),
+"%s"
+% (myself, host.name.encode("utf-8"),
+   tree, build.compiler, host.name.encode("utf-8"),
+   host.name.encode("utf-8")),
+build.compiler, tree, status, build.status(),
+revision_link(myself, revision, tree),
+revision_time])
 
 all_builds.sort(cmp_funcs[sort_by])
 

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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  2d03606 Simplify build status code a bit.
  from  49380c5 Add tests for regressed_since.

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


- Log -
commit 2d03606141dcfc69cb0e406ba9117acf2cbef762
Author: Jelmer Vernooij 
Date:   Wed Nov 17 10:05:33 2010 +0100

Simplify build status code a bit.

---

Summary of changes:
 buildfarm/data.py|   11 +--
 buildfarm/tests/test_data.py |   14 ++
 2 files changed, 15 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index ffdb9e5..2ef40b0 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -53,7 +53,7 @@ class BuildStatus(object):
 
 def __init__(self, stages=None, other_failures=None):
 if stages is not None:
-self.stages = stages
+self.stages = [BuildStageResult(n, r) for (n, r) in stages]
 else:
 self.stages = []
 if other_failures is not None:
@@ -65,7 +65,7 @@ class BuildStatus(object):
 def failed(self):
 if self.other_failures:
 return True
-return not all([x == 0 for x in self._status_tuple()])
+return not all([x.result == 0 for x in self.stages])
 
 def __serialize__(self):
 return repr(self)
@@ -77,16 +77,13 @@ class BuildStatus(object):
 def __str__(self):
 if self.other_failures:
 return ",".join(self.other_failures)
-return "/".join(map(str, self._status_tuple()))
+return "/".join([str(x.result) for x in self.stages])
 
 def broken_host(self):
 if "disk full" in self.other_failures:
 return True
 return False
 
-def _status_tuple(self):
-return [sr.result for sr in self.stages]
-
 def regressed_since(self, older):
 """Check if this build has regressed since another build."""
 if "disk full" in self.other_failures:
@@ -136,6 +133,8 @@ def check_dir_exists(kind, path):
 
 def build_status_from_logs(log, err):
 """get status of build"""
+# FIXME: Perhaps also extract revision here?
+
 test_failures = 0
 test_successes = 0
 test_seen = 0
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 4e17611..c96b266 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -306,16 +306,22 @@ class BuildStatusTest(testtools.TestCase):
 e = data.BuildStatus([("CONFIGURE", 2), ("TEST", 3), ("CC_CHECKER", 
1)], set(["super error"]))
 self.assertEquals(cmp(d, e), -1)
 
+def test_str(self):
+a = data.BuildStatus([("CONFIGURE", 3), ("BUILD", 2)])
+self.assertEquals("3/2", str(a))
+
+def test_str_other_failures(self):
+a = data.BuildStatus([("CONFIGURE", 3), ("BUILD", 2)], set(["panic"]))
+self.assertEquals("panic", str(a))
+
 
 class BuildStatusRegressedSinceTests(testtools.TestCase):
 
 def assertRegressedSince(self, expected, old_status, new_status):
 (stages1, other_failures1) = old_status
 (stages2, other_failures2) = new_status
-a = data.BuildStatus(
-[data.BuildStageResult(n, r) for (n, r) in stages1], 
set(other_failures1))
-b = data.BuildStatus(
-[data.BuildStageResult(n, r) for (n, r) in stages2], 
set(other_failures2))
+a = data.BuildStatus(stages1, set(other_failures1))
+b = data.BuildStatus(stages2, set(other_failures2))
 self.assertEquals(expected, b.regressed_since(a))
 
 def test_same(self):


-- 
build.samba.org


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

2010-11-17 Thread Jelmer Vernooij
The branch, master has been updated
   via  49380c5 Add tests for regressed_since.
  from  2f13a56 Merge tests.

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


- Log -
commit 49380c57cc9f0bb42aed43d8ef2be1464259ba26
Author: Jelmer Vernooij 
Date:   Wed Nov 17 09:56:58 2010 +0100

Add tests for regressed_since.

---

Summary of changes:
 buildfarm/data.py|   16 
 buildfarm/tests/test_data.py |   36 
 2 files changed, 48 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 5c7fe7f..ffdb9e5 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -87,17 +87,25 @@ class BuildStatus(object):
 def _status_tuple(self):
 return [sr.result for sr in self.stages]
 
-def regressed_since(self, other):
+def regressed_since(self, older):
 """Check if this build has regressed since another build."""
 if "disk full" in self.other_failures:
 return False
-if "timeout" in self.other_failures and "timeout" in 
other.other_failures:
+if "timeout" in self.other_failures and "timeout" in 
older.other_failures:
 # When the timeout happens exactly can differ slightly, so it's 
okay
 # if the numbers are a bit different..
 return False
-if "panic" in self.other_failures and not "panic" in 
other.other_failures:
+if "panic" in self.other_failures and not "panic" in 
older.other_failures:
 return True
-return cmp(self._status_tuple(), other._status_tuple())
+if len(self.stages) < len(older.stages):
+# Less stages completed
+return True
+for ((old_name, old_result), (new_name, new_result)) in zip(
+older.stages, self.stages):
+assert old_name == new_name
+if new_result > old_result:
+return True
+return False
 
 def __cmp__(self, other):
 other_extra = other.other_failures - self.other_failures
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index c8d50f4..4e17611 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -307,6 +307,42 @@ class BuildStatusTest(testtools.TestCase):
 self.assertEquals(cmp(d, e), -1)
 
 
+class BuildStatusRegressedSinceTests(testtools.TestCase):
+
+def assertRegressedSince(self, expected, old_status, new_status):
+(stages1, other_failures1) = old_status
+(stages2, other_failures2) = new_status
+a = data.BuildStatus(
+[data.BuildStageResult(n, r) for (n, r) in stages1], 
set(other_failures1))
+b = data.BuildStatus(
+[data.BuildStageResult(n, r) for (n, r) in stages2], 
set(other_failures2))
+self.assertEquals(expected, b.regressed_since(a))
+
+def test_same(self):
+self.assertRegressedSince(
+False,
+([("CONFIGURE", 2)], []),
+([("CONFIGURE", 2)], []))
+
+def test_same_panic(self):
+self.assertRegressedSince(
+False,
+([("CONFIGURE", 2)], ["panic"]),
+([("CONFIGURE", 2)], ["panic"]))
+
+def test_other_failures_gone(self):
+self.assertRegressedSince(
+True,
+([("CONFIGURE", 0)], ["panic"]),
+([("CONFIGURE", 2)], ["panic"]))
+
+def test_more_stages_completed(self):
+self.assertRegressedSince(
+False,
+([("CONFIGURE", 0)], []),
+([("CONFIGURE", 0), ("BUILD", 0)], []))
+
+
 class UploadBuildResultStoreTestBase(object):
 
 def test_build_fname(self):


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  2f13a56 Merge tests.
   via  c6dfd79 add tests for get_old_revs.
   via  d1e63ac Add hostdb.host() test. Improve unicode handling in web ui.
  from  f53728a Unicode encoding hostname if necessary.

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


- Log -
commit 2f13a563d49e4fd48c264850beadea43d4874be9
Merge: f53728a8f2d615246751e272f3697203602baadc 
c6dfd79f0f75c261e25ebf3692e25ff6c72f515c
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:28:40 2010 +0100

Merge tests.

commit c6dfd79f0f75c261e25ebf3692e25ff6c72f515c
Author: Jelmer Vernooij 
Date:   Mon Nov 15 02:29:36 2010 +0100

add tests for get_old_revs.

commit d1e63ac9f7a11aead688103a9e6fb4f98d4de482
Author: Jelmer Vernooij 
Date:   Mon Nov 15 02:11:04 2010 +0100

Add hostdb.host() test.
Improve unicode handling in web ui.

---

Summary of changes:
 buildfarm/data.py  |3 +++
 buildfarm/tests/test_data.py   |   24 
 buildfarm/tests/test_hostdb.py |5 +
 3 files changed, 32 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 750deac..5c7fe7f 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -209,6 +209,9 @@ class Build(object):
 self.compiler = compiler
 self.commit_revision = self.revision = rev
 
+def __eq__(self, other):
+return (self.log_checksum() == other.log_checksum())
+
 def __repr__(self):
 if self.revision is not None:
 return "<%s: revision %s of %s on %s using %s>" % 
(self.__class__.__name__, self.revision, self.tree, self.host, self.compiler)
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index e79224b..c8d50f4 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -140,6 +140,30 @@ BUILD COMMIT REVISION: myrev
 def test_get_latest_revision_none(self):
 self.assertRaises(data.NoSuchBuildError, self.x.get_latest_revision, 
"tdb", "charis", "cc")
 
+def test_get_old_revs_none(self):
+self.assertEquals([],
+list(self.x.get_old_revs(u"tdb", u"charis", u"gcc")))
+
+def test_get_old_revs(self):
+path = self.create_mock_logfile("tdb", "charis", "cc",
+contents="""
+BUILD COMMIT REVISION: 12
+""")
+build = data.Build(path[:-4], "tdb", "charis", "cc")
+b1 = self.x.upload_build(build)
+path = self.create_mock_logfile("tdb", "charis", "cc",
+contents="""
+BUILD COMMIT REVISION: 15
+""")
+build = data.Build(path[:-4], "tdb", "charis", "cc")
+b2 = self.x.upload_build(build)
+path = self.create_mock_logfile("tdb", "charis", "cc",
+contents="""
+BUILD COMMIT REVISION: 15
+""")
+self.assertEquals([b1, b2],
+list(self.x.get_old_revs(u"tdb", u"charis", u"cc")))
+
 
 class BuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
 
diff --git a/buildfarm/tests/test_hostdb.py b/buildfarm/tests/test_hostdb.py
index f50c568..ca406f4 100644
--- a/buildfarm/tests/test_hostdb.py
+++ b/buildfarm/tests/test_hostdb.py
@@ -41,6 +41,11 @@ class HostDatabaseTests(object):
 self.assertEquals(1, len(hosts))
 self.assertEquals("charis", hosts[0].name)
 
+def test_host(self):
+newhost = self.db.createhost(u"charis", u"linux", u"Jelmer", 
u"jel...@samba.org", u"bla", u"Pemrission?")
+samehost = self.db.host(u"charis")
+self.assertEquals(samehost, newhost)
+
 def test_create_already_exists(self):
 host = self.db.createhost(name=u"foo", owner=u"Jelmer", 
owner_email=u"jel...@samba.org")
 self.assertRaises(hostdb.HostAlreadyExists,  self.db.createhost, 
name=u"foo",


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  f53728a Unicode encoding hostname if necessary.
  from  3250896 Unicode encoding hostname if necessary.

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


- Log -
commit f53728a8f2d615246751e272f3697203602baadc
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:21:48 2010 +0100

Unicode encoding hostname if necessary.

---

Summary of changes:
 buildfarm/sqldb.py |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index b452e42..fdee2dd 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -210,9 +210,9 @@ class StormCachingBuildResultStore(BuildResultStore):
 
 def get_old_revs(self, tree, host, compiler):
 return self.store.find(StormBuild,
-StormBuild.tree == tree,
-StormBuild.host == host,
-StormBuild.compiler == compiler).order_by(Desc(StormBuild.age))
+StormBuild.tree == unicode(tree),
+StormBuild.host == unicode(host),
+StormBuild.compiler == 
unicode(compiler)).order_by(Desc(StormBuild.age))
 
 
 class StormCachingBuildFarm(BuildFarm):


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  3250896 Unicode encoding hostname if necessary.
  from  6d5e8cb Remove more unicode decoding.

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


- Log -
commit 3250896b368cd839b1fa65fffdd0c1f168016cf3
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:20:45 2010 +0100

Unicode encoding hostname if necessary.

---

Summary of changes:
 buildfarm/sqldb.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index cac733e..b452e42 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -129,7 +129,7 @@ class StormHostDatabase(HostDatabase):
 return self.store.find(StormHost).order_by(StormHost.name)
 
 def host(self, name):
-ret = self.store.find(StormHost, StormHost.name==name).one()
+ret = self.store.find(StormHost, StormHost.name==unicode(name)).one()
 if ret is None:
 raise NoSuchHost(name)
 return ret


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  6d5e8cb Remove more unicode decoding.
  from  c28ce63 Re-enable unicode encoding (required for storm).

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


- Log -
commit 6d5e8cbb2863c6f984206c3bd1a9e517b326f9e7
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:19:48 2010 +0100

Remove more unicode decoding.

---

Summary of changes:
 admin.py   |   10 +-
 buildfarm/sqldb.py |   36 ++--
 buildfarm/tests/test_hostdb.py |   28 ++--
 buildfarm/web/__init__.py  |   14 +++---
 4 files changed, 44 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/admin.py b/admin.py
index cc8edf9..79c6ce7 100755
--- a/admin.py
+++ b/admin.py
@@ -70,7 +70,7 @@ else:
 if op == "remove":
 hostname = raw_input("Please enter hostname to delete: ")
 try:
-db.deletehost(hostname)
+db.deletehost(hostname.decode("utf-8"))
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -81,7 +81,7 @@ if op == "remove":
 elif op == "modify":
 hostname = raw_input("Please enter hostname to modify: ")
 try:
-host = db.host(hostname)
+host = db.host(hostname.decode("utf-8"))
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -108,7 +108,7 @@ elif op == "modify":
 elif op == "add":
 hostname = raw_input("Machine hostname: ")
 try:
-db.host(hostname)
+db.host(hostname.decode("utf-8"))
 except hostdb.NoSuchHost, e:
 pass
 else:
@@ -129,7 +129,7 @@ elif op == "add":
 line = raw_input("")
 
 try:
-db.createhost(hostname, platform.decode("utf-8"),
+db.createhost(hostname.decode("utf-8"), platform.decode("utf-8"),
 owner.decode("utf-8"), owner_email.decode("utf-8"),
 password.decode("utf-8"),
 "".join(permission).decode("utf-8", "replace"))
@@ -192,7 +192,7 @@ Thanks, your friendly Samba build farm administrator 
""" % owne
 elif op == "info":
 hostname = raw_input("Hostname: ")
 try:
-host = db.host(hostname)
+host = db.host(hostname.decode("utf-8"))
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 25347cb..cac733e 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -47,13 +47,13 @@ class StormBuild(Build):
 __storm_table__ = "build"
 
 id = Int(primary=True)
-tree = RawStr()
+tree = Unicode()
 revision = RawStr()
-host = RawStr()
-compiler = RawStr()
+host = Unicode()
+compiler = Unicode()
 checksum = RawStr()
 age = Int()
-status_str = RawStr(name="status")
+status_str = Unicode(name="status")
 commit_revision = RawStr()
 
 def status(self):
@@ -73,7 +73,7 @@ class StormBuild(Build):
 class StormHost(Host):
 __storm_table__ = "host"
 
-name = RawStr(primary=True)
+name = Unicode(primary=True)
 owner_name = Unicode(name="owner")
 owner_email = Unicode()
 password = Unicode()
@@ -111,7 +111,7 @@ class StormHostDatabase(HostDatabase):
 def createhost(self, name, platform=None, owner=None, owner_email=None,
 password=None, permission=None):
 """See `HostDatabase.createhost`."""
-newhost = StormHost(name, owner=owner, owner_email=owner_email, 
password=password, permission=permission, platform=platform)
+newhost = StormHost(unicode(name), owner=owner, 
owner_email=owner_email, password=password, permission=permission, 
platform=platform)
 try:
 self.store.add(newhost)
 self.store.flush()
@@ -153,18 +153,18 @@ class StormCachingBuildResultStore(BuildResultStore):
 
 def get_previous_revision(self, tree, host, compiler, revision):
 result = self.store.find(StormBuild,
-StormBuild.tree == tree,
-StormBuild.host == host,
-StormBuild.compiler == compiler,
+StormBuild.tree == unicode(tree),
+StormBuild.host == unicode(host),
+StormBuild.compiler == unicode(compiler),
 StormBuild.commit_revision == revision)
 cur_build = result.any()
 if cur_build is None:
 raise NoSuchBuildErr

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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  c28ce63 Re-enable unicode encoding (required for storm).
  from  149f80f Don't unicode encode name.

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


- Log -
commit c28ce631c5288e9ba3c8cbe8a7d8aca1c30a6988
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:18:32 2010 +0100

Re-enable unicode encoding (required for storm).

---

Summary of changes:
 buildfarm/hostdb.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/hostdb.py b/buildfarm/hostdb.py
index 24186c2..ed4e753 100644
--- a/buildfarm/hostdb.py
+++ b/buildfarm/hostdb.py
@@ -125,7 +125,7 @@ class HostDatabase(object):
 """Write out the web/"""
 
 for host in self.hosts():
-yield "%s: %s\n" % (host.name, host.platform.encode("utf-8"))
+yield "%s: %s\n" % (host.name.encode("utf-8"), 
host.platform.encode("utf-8"))
 
 def commit(self):
 pass
@@ -143,7 +143,7 @@ class PlainTextHostDatabase(HostDatabase):
 try:
 for l in f:
 (host, platform) = l.split(":", 1)
-ret[host] = platform.strip().decode("utf-8")
+ret[host.decode("utf-8")] = platform.strip().decode("utf-8")
 finally:
 f.close()
 return cls(ret)


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  149f80f Don't unicode encode name.
  from  a54c867 Store more as plain strings.

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


- Log -
commit 149f80fa8e2961b131daf8d18207b6a30d6eb4d2
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:12:59 2010 +0100

Don't unicode encode name.

---

Summary of changes:
 buildfarm/hostdb.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/hostdb.py b/buildfarm/hostdb.py
index ed4e753..24186c2 100644
--- a/buildfarm/hostdb.py
+++ b/buildfarm/hostdb.py
@@ -125,7 +125,7 @@ class HostDatabase(object):
 """Write out the web/"""
 
 for host in self.hosts():
-yield "%s: %s\n" % (host.name.encode("utf-8"), 
host.platform.encode("utf-8"))
+yield "%s: %s\n" % (host.name, host.platform.encode("utf-8"))
 
 def commit(self):
 pass
@@ -143,7 +143,7 @@ class PlainTextHostDatabase(HostDatabase):
 try:
 for l in f:
 (host, platform) = l.split(":", 1)
-ret[host.decode("utf-8")] = platform.strip().decode("utf-8")
+ret[host] = platform.strip().decode("utf-8")
 finally:
 f.close()
 return cls(ret)


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  a54c867 Store more as plain strings.
  from  707823c Avoid unnecessary host lookup.

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


- Log -
commit a54c867c7c2b85a4872c40427c240f5ba75905d6
Author: Jelmer Vernooij 
Date:   Wed Nov 17 01:11:37 2010 +0100

Store more as plain strings.

---

Summary of changes:
 admin.py   |   10 +-
 buildfarm/sqldb.py |   36 ++--
 buildfarm/tests/test_hostdb.py |   28 ++--
 buildfarm/web/__init__.py  |   14 +++---
 4 files changed, 44 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/admin.py b/admin.py
index 79c6ce7..cc8edf9 100755
--- a/admin.py
+++ b/admin.py
@@ -70,7 +70,7 @@ else:
 if op == "remove":
 hostname = raw_input("Please enter hostname to delete: ")
 try:
-db.deletehost(hostname.decode("utf-8"))
+db.deletehost(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -81,7 +81,7 @@ if op == "remove":
 elif op == "modify":
 hostname = raw_input("Please enter hostname to modify: ")
 try:
-host = db.host(hostname.decode("utf-8"))
+host = db.host(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
@@ -108,7 +108,7 @@ elif op == "modify":
 elif op == "add":
 hostname = raw_input("Machine hostname: ")
 try:
-db.host(hostname.decode("utf-8"))
+db.host(hostname)
 except hostdb.NoSuchHost, e:
 pass
 else:
@@ -129,7 +129,7 @@ elif op == "add":
 line = raw_input("")
 
 try:
-db.createhost(hostname.decode("utf-8"), platform.decode("utf-8"),
+db.createhost(hostname, platform.decode("utf-8"),
 owner.decode("utf-8"), owner_email.decode("utf-8"),
 password.decode("utf-8"),
 "".join(permission).decode("utf-8", "replace"))
@@ -192,7 +192,7 @@ Thanks, your friendly Samba build farm administrator 
""" % owne
 elif op == "info":
 hostname = raw_input("Hostname: ")
 try:
-host = db.host(hostname.decode("utf-8"))
+host = db.host(hostname)
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index cac733e..25347cb 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -47,13 +47,13 @@ class StormBuild(Build):
 __storm_table__ = "build"
 
 id = Int(primary=True)
-tree = Unicode()
+tree = RawStr()
 revision = RawStr()
-host = Unicode()
-compiler = Unicode()
+host = RawStr()
+compiler = RawStr()
 checksum = RawStr()
 age = Int()
-status_str = Unicode(name="status")
+status_str = RawStr(name="status")
 commit_revision = RawStr()
 
 def status(self):
@@ -73,7 +73,7 @@ class StormBuild(Build):
 class StormHost(Host):
 __storm_table__ = "host"
 
-name = Unicode(primary=True)
+name = RawStr(primary=True)
 owner_name = Unicode(name="owner")
 owner_email = Unicode()
 password = Unicode()
@@ -111,7 +111,7 @@ class StormHostDatabase(HostDatabase):
 def createhost(self, name, platform=None, owner=None, owner_email=None,
 password=None, permission=None):
 """See `HostDatabase.createhost`."""
-newhost = StormHost(unicode(name), owner=owner, 
owner_email=owner_email, password=password, permission=permission, 
platform=platform)
+newhost = StormHost(name, owner=owner, owner_email=owner_email, 
password=password, permission=permission, platform=platform)
 try:
 self.store.add(newhost)
 self.store.flush()
@@ -153,18 +153,18 @@ class StormCachingBuildResultStore(BuildResultStore):
 
 def get_previous_revision(self, tree, host, compiler, revision):
 result = self.store.find(StormBuild,
-StormBuild.tree == unicode(tree),
-StormBuild.host == unicode(host),
-StormBuild.compiler == unicode(compiler),
+StormBuild.tree == tree,
+StormBuild.host == host,
+StormBuild.compiler == compiler,
 StormBuild.commit_revision == revision)
 cur_build = result.any()
 if cur_build is None:
 raise NoSuchBuildErr

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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  707823c Avoid unnecessary host lookup.
  from  8f059d0 Fix host finding with older versions of storm.

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


- Log -
commit 707823cebcffadb8ad87df3643be70ab574c7b25
Author: Jelmer Vernooij 
Date:   Wed Nov 17 00:57:39 2010 +0100

Avoid unnecessary host lookup.

---

Summary of changes:
 buildfarm/web/__init__.py |4 
 1 files changed, 0 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index ceb019a..2db0d05 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -482,10 +482,6 @@ class ViewBuildPage(BuildFarmPage):
 
 def render(self, myself, tree, host, compiler, rev, plain_logs=False):
 """view one build in detail"""
-# ensure the params are valid before using them
-self.buildfarm.hostdb.host(host)
-assert compiler in self.buildfarm.compilers, "unknown compiler %s" % 
compiler
-assert tree in self.buildfarm.trees, "not a build tree %s" % tree
 
 uname = ""
 cflags = ""


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  8f059d0 Fix host finding with older versions of storm.
  from  46fe0ca Fix use of buildfarm global variable.

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


- Log -
commit 8f059d0818f0d339a7e2025266d5dfa7b14efe26
Author: Jelmer Vernooij 
Date:   Wed Nov 17 00:43:49 2010 +0100

Fix host finding with older versions of storm.

---

Summary of changes:
 buildfarm/sqldb.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index f7eb9e7..cac733e 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -129,7 +129,7 @@ class StormHostDatabase(HostDatabase):
 return self.store.find(StormHost).order_by(StormHost.name)
 
 def host(self, name):
-ret = self.hosts().find(StormHost.name==name).one()
+ret = self.store.find(StormHost, StormHost.name==name).one()
 if ret is None:
 raise NoSuchHost(name)
 return ret


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  46fe0ca Fix use of buildfarm global variable.
   via  3843593 Split up pages a bit.
  from  2dac42b Set umask.

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


- Log -
commit 46fe0ca2a4c582563f96aa1212b440fda2dd61c4
Author: Jelmer Vernooij 
Date:   Wed Nov 17 00:27:10 2010 +0100

Fix use of buildfarm global variable.

commit 3843593b074e8c70f8c76cf723ebf14f7b34628a
Author: Jelmer Vernooij 
Date:   Wed Nov 17 00:15:45 2010 +0100

Split up pages a bit.

---

Summary of changes:
 buildfarm/__init__.py |   11 +++
 buildfarm/data.py |6 ++
 buildfarm/sqldb.py|   15 +++-
 buildfarm/web/__init__.py |  219 ++---
 4 files changed, 137 insertions(+), 114 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 8d593c4..41df8d1 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -140,3 +140,14 @@ class BuildFarm(object):
 for build in self.upload_builds.get_new_builds():
 if build.tree in self.trees and build.compiler in self.compilers 
and build.host in hostnames:
 yield build
+
+def get_host_builds(self, host):
+from buildfarm import data
+for compiler in self.compilers:
+for tree in sorted(self.trees.keys()):
+try:
+yield self.get_build(tree, host, compiler)
+except data.NoSuchBuildError:
+pass
+
+
diff --git a/buildfarm/data.py b/buildfarm/data.py
index 36c3424..750deac 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -61,6 +61,12 @@ class BuildStatus(object):
 else:
 self.other_failures = set()
 
+@property
+def failed(self):
+if self.other_failures:
+return True
+return not all([x == 0 for x in self._status_tuple()])
+
 def __serialize__(self):
 return repr(self)
 
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 95529ed..f7eb9e7 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -108,7 +108,9 @@ class StormHostDatabase(HostDatabase):
 else:
 self.store = store
 
-def createhost(self, name, platform=None, owner=None, owner_email=None, 
password=None, permission=None):
+def createhost(self, name, platform=None, owner=None, owner_email=None,
+password=None, permission=None):
+"""See `HostDatabase.createhost`."""
 newhost = StormHost(unicode(name), owner=owner, 
owner_email=owner_email, password=password, permission=permission, 
platform=platform)
 try:
 self.store.add(newhost)
@@ -183,7 +185,9 @@ class StormCachingBuildResultStore(BuildResultStore):
 return build.revision
 
 def _get_by_checksum(self, build):
-return self.store.find(StormBuild, StormBuild.checksum == 
build.log_checksum()).one()
+result = self.store.find(StormBuild,
+StormBuild.checksum == build.log_checksum())
+return result.one()
 
 def upload_build(self, build):
 existing_build = self._get_by_checksum(build)
@@ -196,7 +200,8 @@ class StormCachingBuildResultStore(BuildResultStore):
 rev, timestamp = build.revision_details()
 super(StormCachingBuildResultStore, self).upload_build(build)
 new_basename = self.build_fname(build.tree, build.host, 
build.compiler, rev)
-new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host), unicode(build.compiler), rev)
+new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host),
+unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
 new_build.age = build.age_mtime()
 new_build.status_str = unicode(build.status().__serialize__())
@@ -237,6 +242,10 @@ class StormCachingBuildFarm(BuildFarm):
 return StormCachingBuildResultStore(os.path.join(self.path, "data", 
"oldrevs"),
 self._get_store())
 
+def get_host_builds(self, host):
+return self._get_store().find(StormBuild,
+StormBuild.host == host).group_by(StormBuild.compiler, 
StormBuild.tree)
+
 def commit(self):
 self.store.commit()
 
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index f584a21..ceb019a 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -490,7 +490,7 @@ class ViewBuildPage(BuildFarmPage):
 uname = ""
 cflags = ""
 config = ""
-build = buildfarm.get_build(tree, host, compiler, rev)
+build = self.buildfarm.get_build(tree, host, compiler, rev)
 age_mtime = build.age_mtime()
 

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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  2dac42b Set umask.
  from  aa21359 Enable debugging as early as possible.

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


- Log -
commit 2dac42ba046dc9c00982e07851fd547a4d0a61b1
Author: Jelmer Vernooij 
Date:   Tue Nov 16 23:17:18 2010 +0100

Set umask.

---

Summary of changes:
 buildfarm/sqldb.py |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index e0ef491..95529ed 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -221,9 +221,13 @@ class StormCachingBuildFarm(BuildFarm):
 if self.store is not None:
 return self.store
 db_path = os.path.join(self.path, "db", "hostdb.sqlite")
-db = create_database("sqlite:%s?timeout=%f" % (db_path, self.timeout))
-self.store = Store(db)
-setup_schema(self.store)
+umask = os.umask(0664)
+try:
+db = create_database("sqlite:%s?timeout=%f" % (db_path, 
self.timeout))
+self.store = Store(db)
+setup_schema(self.store)
+finally:
+os.umask(umask)
 return self.store
 
 def _open_hostdb(self):


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  aa21359 Enable debugging as early as possible.
  from  3ad205e switch over to sqlite database by default.

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


- Log -
commit aa21359eafa883b2b6fe79a4d69b79308a8d8a66
Author: Jelmer Vernooij 
Date:   Tue Nov 16 23:11:45 2010 +0100

Enable debugging as early as possible.

---

Summary of changes:
 web/build.cgi |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.cgi b/web/build.cgi
index c8ad30b..8b919ff 100755
--- a/web/build.cgi
+++ b/web/build.cgi
@@ -21,16 +21,12 @@ import os
 import sys
 sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
 
-from buildfarm.sqldb import StormCachingBuildFarm
-from buildfarm.web import BuildFarmApp
 import wsgiref.handlers
 import resource
 
 resource.setrlimit(resource.RLIMIT_RSS, (30, 30))
 resource.setrlimit(resource.RLIMIT_DATA, (30, 30))
 
-buildfarm = StormCachingBuildFarm()
-buildApp = BuildFarmApp(buildfarm)
 handler = wsgiref.handlers.CGIHandler()
 CGI_DEBUG = False
 
@@ -38,4 +34,9 @@ if CGI_DEBUG:
 import cgitb
 cgitb.enable()
 handler.log_exception = cgitb.handler
+
+from buildfarm.sqldb import StormCachingBuildFarm
+from buildfarm.web import BuildFarmApp
+buildfarm = StormCachingBuildFarm()
+buildApp = BuildFarmApp(buildfarm)
 handler.run(buildApp)


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  3ad205e switch over to sqlite database by default.
  from  77951af Fix access to buildfarm variable.

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


- Log -
commit 3ad205e5236529904fa89f2c7a37d9869607c0c9
Author: Jelmer Vernooij 
Date:   Tue Nov 16 23:02:50 2010 +0100

switch over to sqlite database by default.

---

Summary of changes:
 buildfarm/web/__init__.py |2 +-
 web/build.cgi |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 6bf88fe..f584a21 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -846,7 +846,7 @@ class ViewSummaryPage(BuildFarmPage):
 yield ""
 yield "%d" % panic_count[tree]
 try:
-lcov_status = buildfarm.lcov_status(tree)
+lcov_status = self.buildfarm.lcov_status(tree)
 except data.NoSuchBuildError:
 yield ""
 else:
diff --git a/web/build.cgi b/web/build.cgi
index da748ca..c8ad30b 100755
--- a/web/build.cgi
+++ b/web/build.cgi
@@ -21,7 +21,7 @@ import os
 import sys
 sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
 
-from buildfarm.filecache import CachingBuildFarm
+from buildfarm.sqldb import StormCachingBuildFarm
 from buildfarm.web import BuildFarmApp
 import wsgiref.handlers
 import resource
@@ -29,7 +29,7 @@ import resource
 resource.setrlimit(resource.RLIMIT_RSS, (30, 30))
 resource.setrlimit(resource.RLIMIT_DATA, (30, 30))
 
-buildfarm = CachingBuildFarm()
+buildfarm = StormCachingBuildFarm()
 buildApp = BuildFarmApp(buildfarm)
 handler = wsgiref.handlers.CGIHandler()
 CGI_DEBUG = False


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  77951af Fix access to buildfarm variable.
  from  1f98541 Add CGI_DEBUG variable.

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


- Log -
commit 77951af92f278155ab01666b8f855fa5c59c66df
Author: Jelmer Vernooij 
Date:   Tue Nov 16 22:50:16 2010 +0100

Fix access to buildfarm variable.

---

Summary of changes:
 buildfarm/web/__init__.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index e0af291..6bf88fe 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -809,7 +809,7 @@ class ViewSummaryPage(BuildFarmPage):
 for compiler in self.buildfarm.compilers:
 for tree in self.buildfarm.trees:
 try:
-build = buildfarm.get_build(tree, 
host.name.encode("utf-8"), compiler)
+build = self.buildfarm.get_build(tree, host.name, 
compiler)
 status = build_status_html(myself, build)
 except data.NoSuchBuildError:
 continue


-- 
build.samba.org


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

2010-11-16 Thread Jelmer Vernooij
The branch, master has been updated
   via  1f98541 Add CGI_DEBUG variable.
  from  0cb42c2 Add buildfarm.web tests.

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


- Log -
commit 1f985416a874ef995e451af972947ff0cb24b989
Author: Jelmer Vernooij 
Date:   Tue Nov 16 22:48:10 2010 +0100

Add CGI_DEBUG variable.

---

Summary of changes:
 buildfarm/web/__init__.py |   15 +++
 web/build.cgi |6 ++
 2 files changed, 13 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index dda4b17..e0af291 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -467,19 +467,18 @@ class ViewBuildPage(BuildFarmPage):
 if len(old_rev_builds) == 0:
 return
 
-yield "Older builds:"
+yield "Older builds:\n"
 
-yield ""
-yield "RevisionStatus"
-yield ""
+yield "\n"
+yield "RevisionStatus\n"
+yield "\n"
 
 for build in old_rev_builds:
-yield "%s%s" % (
+yield "%s%s\n" % (
 revision_link(myself, build.revision, tree),
-build_link(myself, tree, host, compiler, build.revision,
-html_build_status(build.status(
+build_status_html(myself, build))
 
-yield ""
+yield "\n"
 
 def render(self, myself, tree, host, compiler, rev, plain_logs=False):
 """view one build in detail"""
diff --git a/web/build.cgi b/web/build.cgi
index 3f6b295..da748ca 100755
--- a/web/build.cgi
+++ b/web/build.cgi
@@ -32,4 +32,10 @@ resource.setrlimit(resource.RLIMIT_DATA, (30, 30))
 buildfarm = CachingBuildFarm()
 buildApp = BuildFarmApp(buildfarm)
 handler = wsgiref.handlers.CGIHandler()
+CGI_DEBUG = False
+
+if CGI_DEBUG:
+import cgitb
+cgitb.enable()
+handler.log_exception = cgitb.handler
 handler.run(buildApp)


-- 
build.samba.org


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

2010-11-15 Thread Jelmer Vernooij
The branch, master has been updated
   via  0cb42c2 Add buildfarm.web tests.
   via  c9e91d3 Fix exception handling when both python-pysqlite2 and 
sqlite3 are installed.
  from  a6c0f05 Decode host names and platform name.

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


- Log -
commit 0cb42c2abd1c95df648dd359ef47a0ab4f1bd917
Author: Jelmer Vernooij 
Date:   Mon Nov 15 16:30:50 2010 +0100

Add buildfarm.web tests.

commit c9e91d3e26de7183996455148920fb1c20163fd2
Author: Jelmer Vernooij 
Date:   Mon Nov 15 16:30:36 2010 +0100

Fix exception handling when both python-pysqlite2 and sqlite3 are installed.

---

Summary of changes:
 buildfarm/sqldb.py|4 +-
 buildfarm/web/__init__.py |   71 +++--
 web/build.cgi => buildfarm/web/tests/test_util.py |   26 +++-
 3 files changed, 49 insertions(+), 52 deletions(-)
 create mode 100644 buildfarm/web/tests/__init__.py
 copy web/build.cgi => buildfarm/web/tests/test_util.py (55%)
 mode change 100755 => 100644


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 8c5330f..e0ef491 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -35,9 +35,9 @@ from buildfarm.hostdb import (
 
 import os
 try:
-import sqlite3
-except ImportError:
 from pysqlite2 import dbapi2 as sqlite3
+except ImportError:
+import sqlite3
 from storm.database import create_database
 from storm.locals import Bool, Desc, Int, Unicode, RawStr
 from storm.store import Store
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 33165dc..dda4b17 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -682,6 +682,41 @@ class ViewRecentBuildsPage(BuildFarmPage):
 
 class ViewHostPage(BuildFarmPage):
 
+def _render_build(self, myself, build):
+try:
+(revision, revision_time) = build.revision_details()
+except data.MissingRevisionInfo:
+revision = None
+age_mtime = build.age_mtime()
+age_ctime = build.age_ctime()
+warnings = build.err_count()
+status = build_status_html(myself, build)
+if row == 0:
+if output_type == 'text':
+yield "%-12s %-10s %-10s %-10s %-10s\n" % (
+"Tree", "Compiler", "Build Age", "Status", "Warnings")
+else:
+yield ""
+yield ""
+yield "%s - %s" % (host, 
self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
+yield ""
+yield 
"TargetBuildRevisionBuildAgeStatusconfig/buildinstall/testWarnings"
+yield ""
+
+if output_type == 'text':
+yield "%-12s %-10s %-10s %-10s %-10s\n" % (
+tree, compiler, util.dhm_time(age_mtime),
+util.strip_html(status), warnings)
+else:
+yield ""
+yield "" + self.tree_link(myself, tree) 
+"/" + compiler + ""
+yield "" + revision_link(myself, revision, tree) + ""
+yield "" + self.red_age(age_mtime) + 
""
+yield "%s" % status
+yield "%s" % warnings
+yield ""
+row+=1
+
 def render(self, myself, output_type, *requested_hosts):
 """print the host's table of information"""
 
@@ -699,7 +734,6 @@ class ViewHostPage(BuildFarmPage):
 continue
 
 row = 0
-
 for compiler in self.buildfarm.compilers:
 for tree in sorted(self.buildfarm.trees.keys()):
 try:
@@ -707,39 +741,8 @@ class ViewHostPage(BuildFarmPage):
 except data.NoSuchBuildError:
 pass
 else:
-try:
-(revision, revision_time) = 
build.revision_details()
-except data.MissingRevisionInfo:
-revision = None
-age_mtime = build.age_mtime()
-age_ctime = build.age_ctime()
-warnings = build.err_count()
-status = build_status_html(myself, build)
-if row == 0:
-if output_type == 'text':
-yield "%-12s %-10s %-10s %-10s %-10s\n" % (
-"Tree", "Compiler",

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

2010-11-15 Thread Jelmer Vernooij
The branch, master has been updated
   via  a6c0f05 Decode host names and platform name.
   via  938e2e7 Improve formatting in web output.
  from  bfd499b Simplify standalone code.

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


- Log -
commit a6c0f05eb2109e994e614cfe290be608b07dffb0
Author: Jelmer Vernooij 
Date:   Mon Nov 15 15:09:14 2010 +0100

Decode host names and platform name.

commit 938e2e76589364ca8c92228a70ad710f977d075c
Author: Jelmer Vernooij 
Date:   Mon Nov 15 15:03:43 2010 +0100

Improve formatting in web output.

---

Summary of changes:
 buildfarm/hostdb.py   |2 +-
 buildfarm/web/__init__.py |   32 
 2 files changed, 17 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/hostdb.py b/buildfarm/hostdb.py
index 3d7029c..ed4e753 100644
--- a/buildfarm/hostdb.py
+++ b/buildfarm/hostdb.py
@@ -143,7 +143,7 @@ class PlainTextHostDatabase(HostDatabase):
 try:
 for l in f:
 (host, platform) = l.split(":", 1)
-ret[host] = platform.strip()
+ret[host.decode("utf-8")] = platform.strip().decode("utf-8")
 finally:
 f.close()
 return cls(ret)
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 5f3b727..33165dc 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -922,28 +922,28 @@ class BuildFarmApp(object):
 def main_menu(self):
 """main page"""
 
-yield ""
-yield ""
-yield ""
+yield "\n"
+yield "\n"
+yield "\n"
 for name, host in self.hosts.iteritems():
 yield "%s -- %s\n" % (name, 
host.platform.encode("utf-8"), name)
-yield ""
-yield ""
+yield "\n"
+yield "\n"
 for tree, t in self.buildfarm.trees.iteritems():
 yield "%s:%s\n" % (tree, tree, 
t.branch)
-yield ""
-yield ""
+yield "\n"
+yield "\n"
 for compiler in self.buildfarm.compilers:
 yield "%s\n" % compiler
-yield ""
-yield ""
-yield ""
-yield ""
-yield ""
-yield ""
-yield ""
-yield ""
-yield ""
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
+yield "\n"
 
 def __call__(self, environ, start_response):
 form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)


-- 
build.samba.org


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

2010-11-15 Thread Jelmer Vernooij
The branch, master has been updated
   via  bfd499b Simplify standalone code.
  from  711124c Fix build.cgi mode, ulimit.

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


- Log -
commit bfd499b73bc46d33e98092bd49d2c58badd24163
Author: Jelmer Vernooij 
Date:   Mon Nov 15 14:53:24 2010 +0100

Simplify standalone code.

---

Summary of changes:
 buildfarm/web/__init__.py |   32 
 1 files changed, 12 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 819b9bb..5f3b727 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -45,11 +45,9 @@ import re
 import time
 
 import wsgiref.util
-webdir = os.path.dirname(__file__)
-basedir = os.path.abspath(os.path.join(webdir, ".."))
+webdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", 
"web"))
 
 
-UNPACKED_BASE = "http://svn.samba.org/ftp/unpacked";
 GITWEB_BASE = "http://gitweb.samba.org";
 HISTORY_HORIZON = 1000
 
@@ -917,12 +915,9 @@ class BuildFarmApp(object):
 
 def __init__(self, buildfarm):
 self.buildfarm = buildfarm
-self.db = data.BuildResultStore(basedir)
-self.hostsdb = buildfarm.hostdb
 
-self.compilers = buildfarm.compilers
 # host.properties are unicode object and the framework expect string 
object
-self.hosts = dict([(host.name.encode("utf-8"), host) for host in 
self.hostsdb.hosts()])
+self.hosts = dict([(host.name.encode("utf-8"), host) for host in 
self.buildfarm.hostdb.hosts()])
 
 def main_menu(self):
 """main page"""
@@ -1037,23 +1032,20 @@ if __name__ == '__main__':
 buildfarm = CachingBuildFarm(cachedirname=opts.cachedirname)
 buildApp = BuildFarmApp(buildfarm)
 from wsgiref.simple_server import make_server
+import mimetypes
+mimetypes.init()
 
 def standaloneApp(environ, start_response):
 if environ['PATH_INFO']:
-dir = os.path.join(os.path.dirname(__file__))
-if re.match("^/[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)?", 
environ['PATH_INFO']):
-static_file = "%s/%s" % (dir, environ['PATH_INFO'])
+m = re.match("^/([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)?", 
environ['PATH_INFO'])
+if m:
+static_file = os.path.join(webdir, m.group(1)+m.group(2))
 if os.path.exists(static_file):
-tab = environ['PATH_INFO'].split('.')
-if len(tab) > 1:
-extension = tab[-1]
-import mimetypes
-mimetypes.init()
-type = mimetypes.types_map[".%s" % extension]
-start_response('200 OK', [('Content-type', type)])
-data = open(static_file, 'rb').read()
-yield data
-return
+type = mimetypes.types_map[m.group(2)]
+start_response('200 OK', [('Content-type', type)])
+data = open(static_file, 'rb').read()
+yield data
+return
 yield "".join(buildApp(environ, start_response))
 try:
 (address, port) = opts.port.rsplit(":", 1)


-- 
build.samba.org


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

2010-11-15 Thread Jelmer Vernooij
The branch, master has been updated
   via  0baa292 Use rlimit.
   via  b384226 Add build cgi script.
  from  4c30514 Implement sql-specific get_old_revs.

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


- Log -
commit 0baa292e4a249522f569ea5dcb6f3468896717a9
Author: Jelmer Vernooij 
Date:   Mon Nov 15 14:20:15 2010 +0100

Use rlimit.

commit b3842262e68aea66a1929ebb4c7aab56118e7883
Author: Jelmer Vernooij 
Date:   Mon Nov 15 13:25:37 2010 +0100

Add build cgi script.

---

Summary of changes:
 web/build.py => buildfarm/web/__init__.py |6 -
 web/build.cgi |   35 +
 2 files changed, 35 insertions(+), 6 deletions(-)
 rename web/build.py => buildfarm/web/__init__.py (99%)
 create mode 100644 web/build.cgi


Changeset truncated at 500 lines:

diff --git a/web/build.py b/buildfarm/web/__init__.py
similarity index 99%
rename from web/build.py
rename to buildfarm/web/__init__.py
index d4edffe..df5e608 100755
--- a/web/build.py
+++ b/buildfarm/web/__init__.py
@@ -30,8 +30,6 @@
 # e.g. only broken builds or only builds that you care about.
 
 import os
-import sys
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
 
 from buildfarm import (
 data,
@@ -1067,7 +1065,3 @@ if __name__ == '__main__':
 httpd = make_server(address, int(port), standaloneApp)
 print "Serving on %s:%d..." % (address, int(port))
 httpd.serve_forever()
-else:
-import wsgiref.handlers
-handler = wsgiref.handlers.CGIHandler()
-handler.run(buildApp)
diff --git a/web/build.cgi b/web/build.cgi
new file mode 100644
index 000..246fca2
--- /dev/null
+++ b/web/build.cgi
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# This CGI script presents the results of the build_farm build
+
+# Copyright (C) Jelmer Vernooij  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.
+
+import os
+import sys
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
+
+from buildfarm.filecache import CachingBuildFarm
+from buildfarm.web import BuildFarmApp
+import wsgiref.handlers
+import resource
+
+resource.setrlimit(resource.RLIMIT_RSS, (30, -1))
+resource.setrlimit(resource.RLIMIT_DATA, (30, -1))
+
+buildfarm = CachingBuildFarm()
+buildApp = BuildFarmApp(buildfarm)
+handler = wsgiref.handlers.CGIHandler()
+handler.run(buildApp)


-- 
build.samba.org


[SCM] Samba Shared Repository - branch master updated

2010-11-15 Thread Jelmer Vernooij
The branch, master has been updated
   via  c3e24bb heimdal_base: Fix include path so heim_threads.h can be 
found.
   via  f7bccc6 smb_server: Build as shared module.
   via  ee69c4f heimdal_base: Add missing dependency on replace.
   via  f91b7b5 nbtd: Build service as shared module.
  from  88d694a waf: fixed configure again on RHEL5

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


- Log -
commit c3e24bb89f8a50476ac809aaa3fee409e639b0d0
Author: Jelmer Vernooij 
Date:   Mon Nov 15 12:42:14 2010 +0100

heimdal_base: Fix include path so heim_threads.h can be found.

Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Mon Nov 15 12:26:53 UTC 2010 on sn-devel-104

commit f7bccc6628db5434c304bcf42eaa249e87ba1f08
Author: Jelmer Vernooij 
Date:   Mon Nov 15 12:41:58 2010 +0100

smb_server: Build as shared module.

commit ee69c4f4b3d2012037887c4124dd376eebb2f0af
Author: Jelmer Vernooij 
Date:   Mon Nov 15 12:24:45 2010 +0100

heimdal_base: Add missing dependency on replace.

commit f91b7b5dab904613bd48f663ba768521995ed9e6
Author: Jelmer Vernooij 
Date:   Mon Nov 15 12:23:46 2010 +0100

nbtd: Build service as shared module.

---

Summary of changes:
 source4/heimdal_build/wscript_build |4 ++--
 source4/nbt_server/wscript_build|3 ++-
 source4/rpc_server/wscript_build|2 +-
 source4/smb_server/wscript_build|2 +-
 source4/smbd/wscript_build  |   10 +-
 source4/torture/wscript_build   |2 +-
 6 files changed, 12 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/heimdal_build/wscript_build 
b/source4/heimdal_build/wscript_build
index 4d8459e..0ebb339 100644
--- a/source4/heimdal_build/wscript_build
+++ b/source4/heimdal_build/wscript_build
@@ -684,8 +684,8 @@ HEIMDAL_SUBSYSTEM('HEIMDAL_HCRYPTO',
 
 HEIMDAL_SUBSYSTEM('HEIMDAL_BASE',
 'base/array.c base/bool.c base/dict.c base/heimbase.c base/string.c 
base/number.c base/null.c',
-includes='../heimdal/base',
-deps='roken'
+includes='../heimdal/base ../heimdal/include',
+deps='roken replace'
 )
 
 
diff --git a/source4/nbt_server/wscript_build b/source4/nbt_server/wscript_build
index 6fe64a4..252a9b8 100644
--- a/source4/nbt_server/wscript_build
+++ b/source4/nbt_server/wscript_build
@@ -42,6 +42,7 @@ bld.SAMBA_MODULE('service_nbtd',
source='nbt_server.c',
subsystem='service',
init_function='server_service_nbtd_init',
-   deps='NBT_SERVER process_model'
+   deps='NBT_SERVER process_model',
+   internal_module=False,
)
 
diff --git a/source4/rpc_server/wscript_build b/source4/rpc_server/wscript_build
index 97fd41c..29c1723 100644
--- a/source4/rpc_server/wscript_build
+++ b/source4/rpc_server/wscript_build
@@ -11,7 +11,7 @@ bld.SAMBA_SUBSYSTEM('DCERPC_COMMON',
autoproto='common/proto.h',
public_headers='common/common.h',
header_path='dcerpc_server',
-   deps='ldb DCERPC_SHARE'
+   deps='ldb DCERPC_SHARE samba_server_gensec'
)
 
 
diff --git a/source4/smb_server/wscript_build b/source4/smb_server/wscript_build
index a9e150e..bdf6469 100644
--- a/source4/smb_server/wscript_build
+++ b/source4/smb_server/wscript_build
@@ -6,7 +6,7 @@ bld.SAMBA_MODULE('SERVICE_SMB',
subsystem='service',
init_function='server_service_smb_init',
deps='SMB_SERVER netif shares samba-hostconfig',
-   internal_module=True
+   internal_module=False,
)
 
 
diff --git a/source4/smbd/wscript_build b/source4/smbd/wscript_build
index 3a59049..0d91d41 100644
--- a/source4/smbd/wscript_build
+++ b/source4/smbd/wscript_build
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 
 bld.SAMBA_LIBRARY('service',
-  source='service.c service_stream.c service_named_pipe.c 
service_task.c',
-  autoproto='service_proto.h',
-  deps='tevent MESSAGING samba_socket RPC_NDR_IRPC 
NDR_NAMED_PIPE_AUTH NAMED_PIPE_AUTH_TSTREAM gssapi credentials LIBTSOCKET 
LIBSAMBA_TSOCKET process_model',
-  private_library=True
-  )
+   source='service.c service_stream.c service_named_pipe.c service_task.c',
+   autoproto='service_proto.h',
+   deps='tevent MESSAGING samba_socket RPC_NDR_IRPC NDR_NAMED_PIPE_AUTH 
NAMED_PIPE_AUTH_TSTREAM gssapi credentials LIBTSOCKET LIBSAMBA_TSOCKET 
process_model',
+   private_library=True
+   )
 
 
 bld.SAMBA_SUBSYSTEM('PIDFILE',
diff --git a/source4/torture/wscript_build b/source4/torture/wsc

[SCM] Samba Shared Repository - branch master updated

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  1409c97 s4: Build ldap and samba3_smb services as shared modules.
   via  02f7721 cldap: Build as shared module.
   via  caa3935 kdc: Build as shared module by default.
   via  e422c2a auth/ntlm: Use name consistent with other service names.
  from  02d3203 auth/gensec Handle incorrect username or password in 
Kerberos client code

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


- Log -
commit 1409c97899406d48f5b763fc88389bab11e379fc
Author: Jelmer Vernooij 
Date:   Mon Nov 15 03:19:44 2010 +0100

s4: Build ldap and samba3_smb services as shared modules.

Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Mon Nov 15 03:04:41 UTC 2010 on sn-devel-104

commit 02f77214c2372b33d9b3e6c4075069aa6fae0b9b
Author: Jelmer Vernooij 
Date:   Mon Nov 15 03:14:16 2010 +0100

cldap: Build as shared module.

commit caa3935a388da986e84bc36488227c746ed1fe34
Author: Jelmer Vernooij 
Date:   Mon Nov 15 00:46:12 2010 +0100

kdc: Build as shared module by default.

commit e422c2a4a5f491fa6227decbff38445c2e191140
Author: Jelmer Vernooij 
Date:   Mon Nov 15 00:45:48 2010 +0100

auth/ntlm: Use name consistent with other service names.

---

Summary of changes:
 source4/auth/ntlm/wscript_build|2 +-
 source4/cldap_server/wscript_build |1 +
 source4/kdc/wscript_build  |1 +
 source4/ldap_server/wscript_build  |3 ++-
 source4/ntp_signd/wscript_build|2 +-
 source4/rpc_server/wscript_build   |2 +-
 source4/smb_server/wscript_build   |5 +++--
 source4/web_server/wscript_build   |2 +-
 8 files changed, 11 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/auth/ntlm/wscript_build b/source4/auth/ntlm/wscript_build
index 3dc9b97..8063076 100644
--- a/source4/auth/ntlm/wscript_build
+++ b/source4/auth/ntlm/wscript_build
@@ -61,7 +61,7 @@ bld.SAMBA_LIBRARY('auth',
private_library=True
)
 
-bld.SAMBA_MODULE('auth_server_service',
+bld.SAMBA_MODULE('service_auth',
source='auth_server_service.c',
subsystem='service',
init_function='server_service_auth_init',
diff --git a/source4/cldap_server/wscript_build 
b/source4/cldap_server/wscript_build
index 7b32912..f105c0e 100644
--- a/source4/cldap_server/wscript_build
+++ b/source4/cldap_server/wscript_build
@@ -4,6 +4,7 @@ bld.SAMBA_MODULE('service_cldap',
source='cldap_server.c',
subsystem='service',
init_function='server_service_cldapd_init',
+   internal_module=False,
deps='CLDAPD process_model netif'
)
 
diff --git a/source4/kdc/wscript_build b/source4/kdc/wscript_build
index 9e2c50e..82b9929 100644
--- a/source4/kdc/wscript_build
+++ b/source4/kdc/wscript_build
@@ -5,6 +5,7 @@ bld.SAMBA_MODULE('service_kdc',
subsystem='service',
init_function='server_service_kdc_init',
deps='kdc HDB_SAMBA4 WDC_SAMBA4 samba-hostconfig LIBTSOCKET 
LIBSAMBA_TSOCKET com_err samba_server_gensec',
+   internal_module=False,
)
 
 
diff --git a/source4/ldap_server/wscript_build 
b/source4/ldap_server/wscript_build
index f089c5e..c5fe13d 100644
--- a/source4/ldap_server/wscript_build
+++ b/source4/ldap_server/wscript_build
@@ -6,6 +6,7 @@ bld.SAMBA_MODULE('LDAP',
autoproto='proto.h',
subsystem='service',
init_function='server_service_ldap_init',
-   deps='credentials cli-ldap samdb process_model gensec samba-hostconfig 
samba_server_gensec'
+   deps='credentials cli-ldap samdb process_model gensec samba-hostconfig 
samba_server_gensec',
+   internal_module=False,
)
 
diff --git a/source4/ntp_signd/wscript_build b/source4/ntp_signd/wscript_build
index 1b82bc6..ad12925 100644
--- a/source4/ntp_signd/wscript_build
+++ b/source4/ntp_signd/wscript_build
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-bld.SAMBA_MODULE('NTP_SIGND',
+bld.SAMBA_MODULE('service_ntp_signd',
source='ntp_signd.c',
subsystem='service',
init_function='server_service_ntp_signd_init',
diff --git a/source4/rpc_server/wscript_build b/source4/rpc_server/wscript_build
index 7f73d96..97fd41c 100644
--- a/source4/rpc_server/wscript_build
+++ b/source4/rpc_server/wscript_build
@@ -140,7 +140,7 @@ bld.SAMBA_LIBRARY('dcerpc_server',
vnum='0.0.1'
)
 
-bld.SAMBA_MODULE('dcesrv',
+bld.SAMBA_MODULE('service_dcerpc',
source='service_rpc.c',
autoproto='service_rpc.h',
subsystem='service',
diff --git a/source

[SCM] Samba Shared Repository - branch master updated

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  13fd22f s4/dns: Build as shared module.
  from  2d7dc86 s4-kdc: if "bind interfaces only" is false, then also 
listen on wildcard

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


- Log -
commit 13fd22f61017124d2d4964db3e32c667d119b56c
Author: Jelmer Vernooij 
Date:   Mon Nov 15 00:44:30 2010 +0100

s4/dns: Build as shared module.

Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Mon Nov 15 00:57:27 UTC 2010 on sn-devel-104

---

Summary of changes:
 source4/dns_server/wscript_build |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build
index 3a0f289..f19a5a2 100644
--- a/source4/dns_server/wscript_build
+++ b/source4/dns_server/wscript_build
@@ -1,9 +1,10 @@
 #!/usr/bin/env python
 
-bld.SAMBA_MODULE('DNS',
+bld.SAMBA_MODULE('service_dns',
 source='dns_server.c dns_query.c dns_update.c dns_utils.c',
 subsystem='service',
 init_function='server_service_dns_init',
 deps='samba-hostconfig LIBTSOCKET LIBSAMBA_TSOCKET ldbsamba',
-local_include=False
+local_include=False,
+internal_module=False,
 )


-- 
Samba Shared Repository


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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  4c30514 Implement sql-specific get_old_revs.
  from  73afd26 Actually use sqldb.

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


- Log -
commit 4c305147f34d899cf791c9c8ab103ec7ff3247bb
Author: Jelmer Vernooij 
Date:   Mon Nov 15 01:57:33 2010 +0100

Implement sql-specific get_old_revs.

---

Summary of changes:
 buildfarm/sqldb.py |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index a2c424a..8c5330f 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -203,6 +203,12 @@ class StormCachingBuildResultStore(BuildResultStore):
 self.store.add(new_build)
 return new_build
 
+def get_old_revs(self, tree, host, compiler):
+return self.store.find(StormBuild,
+StormBuild.tree == tree,
+StormBuild.host == host,
+StormBuild.compiler == compiler).order_by(Desc(StormBuild.age))
+
 
 class StormCachingBuildFarm(BuildFarm):
 


-- 
build.samba.org


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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  73afd26 Actually use sqldb.
  from  2641334 Add missing extensions for git repositories.

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


- Log -
commit 73afd267aae1ebbdda438fd57d2ffddfbaa7f71c
Author: Jelmer Vernooij 
Date:   Mon Nov 15 01:51:02 2010 +0100

Actually use sqldb.

---

Summary of changes:
 buildfarm/data.py  |7 +++
 buildfarm/filecache.py |4 ++--
 buildfarm/sqldb.py |9 -
 3 files changed, 17 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 5c25aab..36c3424 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -61,6 +61,13 @@ class BuildStatus(object):
 else:
 self.other_failures = set()
 
+def __serialize__(self):
+return repr(self)
+
+@classmethod
+def __deserialize__(cls, text):
+return eval(text)
+
 def __str__(self):
 if self.other_failures:
 return ",".join(self.other_failures)
diff --git a/buildfarm/filecache.py b/buildfarm/filecache.py
index d9c4a16..bd15d5f 100644
--- a/buildfarm/filecache.py
+++ b/buildfarm/filecache.py
@@ -100,12 +100,12 @@ class CachingBuild(Build):
 st2 = None
 
 if st2 and st1.st_ctime <= st2.st_mtime:
-return eval(util.FileLoad(cachefile))
+return BuildStatus.__deserialize__(util.FileLoad(cachefile))
 
 ret = super(CachingBuild, self).status()
 
 if not self._store.readonly:
-util.FileSave(cachefile, repr(ret))
+util.FileSave(cachefile, ret.__serialize__())
 
 return ret
 
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index dc506f0..a2c424a 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -23,6 +23,7 @@ from buildfarm import (
 from buildfarm.data import (
 Build,
 BuildResultStore,
+BuildStatus,
 NoSuchBuildError,
 )
 from buildfarm.hostdb import (
@@ -55,6 +56,12 @@ class StormBuild(Build):
 status_str = Unicode(name="status")
 commit_revision = RawStr()
 
+def status(self):
+return BuildStatus.__deserialize__(self.status_str)
+
+def revision_details(self):
+return (self.commit_revision, None)
+
 def log_checksum(self):
 return self.checksum
 
@@ -192,7 +199,7 @@ class StormCachingBuildResultStore(BuildResultStore):
 new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host), unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
 new_build.age = build.age_mtime()
-new_build.status_str = unicode(str(build.status()))
+new_build.status_str = unicode(build.status().__serialize__())
 self.store.add(new_build)
 return new_build
 


-- 
build.samba.org


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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  2641334 Add missing extensions for git repositories.
  from  42e888a Move hostdb to a separate db directory.

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


- Log -
commit 26413342c87799f11dcb05915d44e0a871577dfe
Author: Jelmer Vernooij 
Date:   Mon Nov 15 01:42:47 2010 +0100

Add missing extensions for git repositories.

---

Summary of changes:
 web/trees.conf |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/trees.conf b/web/trees.conf
index 1a72568..6c4f9c3 100644
--- a/web/trees.conf
+++ b/web/trees.conf
@@ -1,21 +1,21 @@
 [ccache]
 scm = git
-repo = ccache
+repo = ccache.git
 branch = master
 
 [ccache-maint]
 scm = git
-repo = ccache
+repo = ccache.git
 branch = maint
 
 [ppp]
 scm = git
-repo = ppp
+repo = ppp.git
 branch = master
 
 [samba-web]
 scm = git
-repo = samba-web
+repo = samba-web.git
 branch = trunk
 
 [samba_3_current]


-- 
build.samba.org


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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  42e888a Move hostdb to a separate db directory.
  from  6a85d8c Support passing timeout to the StormCachingBuildFarm.

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


- Log -
commit 42e888aa3a8bcdf2525cc6739339aa647d77f584
Author: Jelmer Vernooij 
Date:   Mon Nov 15 01:39:18 2010 +0100

Move hostdb to a separate db directory.

---

Summary of changes:
 buildfarm/sqldb.py  |2 +-
 buildfarm/tests/__init__.py |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index faf3cbf..dc506f0 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -207,7 +207,7 @@ class StormCachingBuildFarm(BuildFarm):
 def _get_store(self):
 if self.store is not None:
 return self.store
-db_path = os.path.join(self.path, "hostdb.sqlite")
+db_path = os.path.join(self.path, "db", "hostdb.sqlite")
 db = create_database("sqlite:%s?timeout=%f" % (db_path, self.timeout))
 self.store = Store(db)
 setup_schema(self.store)
diff --git a/buildfarm/tests/__init__.py b/buildfarm/tests/__init__.py
index fb98f55..b3226d5 100644
--- a/buildfarm/tests/__init__.py
+++ b/buildfarm/tests/__init__.py
@@ -80,10 +80,10 @@ class BuildFarmTestCase(TestCase):
 super(BuildFarmTestCase, self).setUp()
 self.path = tempfile.mkdtemp()
 
-for subdir in ["data", "data/upload", "data/oldrevs", "cache", "web", 
"lcov", "lcov/data"]:
+for subdir in ["data", "data/upload", "data/oldrevs", "db", "cache", 
"web", "lcov", "lcov/data"]:
 os.mkdir(os.path.join(self.path, subdir))
 
-db = database.create_database("sqlite:"+os.path.join(self.path, 
"hostdb.sqlite"))
+db = database.create_database("sqlite:"+os.path.join(self.path, "db", 
"hostdb.sqlite"))
 store = Store(db)
 setup_schema(store)
 store.flush()


-- 
build.samba.org


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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  6a85d8c Support passing timeout to the StormCachingBuildFarm.
  from  aca1062 Cope with revision info not being present when displaying 
items in the web view.

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


- Log -
commit 6a85d8c6cada716c6f15ade8d0120054506dc261
Author: Jelmer Vernooij 
Date:   Mon Nov 15 01:37:13 2010 +0100

Support passing timeout to the StormCachingBuildFarm.

---

Summary of changes:
 buildfarm/sqldb.py|   13 +++--
 import-and-analyse.py |2 +-
 mail-dead-hosts.py|2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 709784f..faf3cbf 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -199,18 +199,19 @@ class StormCachingBuildResultStore(BuildResultStore):
 
 class StormCachingBuildFarm(BuildFarm):
 
-def __init__(self, path=None, store=None):
+def __init__(self, path=None, store=None, timeout=0.5):
+self.timeout = timeout
 self.store = store
 super(StormCachingBuildFarm, self).__init__(path)
 
 def _get_store(self):
 if self.store is not None:
 return self.store
-else:
-db = create_database("sqlite:" + os.path.join(self.path, 
"hostdb.sqlite"))
-self.store = Store(db)
-setup_schema(self.store)
-return self.store
+db_path = os.path.join(self.path, "hostdb.sqlite")
+db = create_database("sqlite:%s?timeout=%f" % (db_path, self.timeout))
+self.store = Store(db)
+setup_schema(self.store)
+return self.store
 
 def _open_hostdb(self):
 return StormHostDatabase(self._get_store())
diff --git a/import-and-analyse.py b/import-and-analyse.py
index d88ef43..f6f0c2c 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -23,7 +23,7 @@ parser.add_option("--verbose", help="Be verbose", 
action="count")
 
 (opts, args) = parser.parse_args()
 
-buildfarm = StormCachingBuildFarm()
+buildfarm = StormCachingBuildFarm(timeout=40.0)
 
 smtp = smtplib.SMTP()
 smtp.connect()
diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 8300ba0..2e0c7f7 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -27,7 +27,7 @@ parser = optparse.OptionParser()
 parser.add_option("--dry-run", help="Don't actually send any emails.", 
action="store_true")
 (opts, args) = parser.parse_args()
 
-buildfarm = StormCachingBuildFarm()
+buildfarm = StormCachingBuildFarm(timeout=40.0)
 db = buildfarm.hostdb
 
 smtp = smtplib.SMTP()


-- 
build.samba.org


[SCM] Samba Shared Repository - branch master updated

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  f0cdcd9 web_server: Build as module.
   via  f5fbba7 kcc/drepl: Build as service.
   via  f6c8bc6 winbind: Build as shared module.
   via  bee3b66 Build wrepl server as service by default.
   via  6d1d146 Add myself as maintainer for pytevent, pytalloc, pytdb and 
pyldb.
   via  6e762f9 Re-enable ldb-cmdline for the moment, as it is used by 
oLschema2ldif.
   via  d2dfa86 Don't build ldb tools when there is a system provided ldb.
  from  c52e6db s3: string_to_sid does thorough syntax checking

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


- Log -
commit f0cdcd940e20bf049ccb19ca68a101a29d2ee8d1
Author: Jelmer Vernooij 
Date:   Sun Nov 14 17:36:51 2010 +0100

web_server: Build as module.

Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Sun Nov 14 17:58:05 UTC 2010 on sn-devel-104

commit f5fbba76c8743d6c4f25b9850e2c2c4353730cdf
Author: Jelmer Vernooij 
Date:   Sun Nov 14 17:31:26 2010 +0100

kcc/drepl: Build as service.

commit f6c8bc6a7bfac1cb13fdf2a4dc76c3d1234de73f
Author: Jelmer Vernooij 
Date:   Sun Nov 14 17:26:29 2010 +0100

winbind: Build as shared module.

commit bee3b665a882b03ae6c65de6b9440e1b00994080
Author: Jelmer Vernooij 
Date:   Sun Nov 14 17:09:34 2010 +0100

Build wrepl server as service by default.

commit 6d1d146e8987f515f97b1fa1ef6f726f2c60a884
Author: Jelmer Vernooij 
Date:   Sun Nov 14 14:49:03 2010 +0100

Add myself as maintainer for pytevent, pytalloc, pytdb and pyldb.

commit 6e762f90030b214a24bfae5cf048fad9893f53c8
Author: Jelmer Vernooij 
Date:   Sun Nov 14 14:32:13 2010 +0100

Re-enable ldb-cmdline for the moment, as it is used by oLschema2ldif.

commit d2dfa868fd7e77879ff40b7bbe3b52a0ceece277
Author: Jelmer Vernooij 
Date:   Sun Nov 14 13:40:58 2010 +0100

Don't build ldb tools when there is a system provided ldb.

---

Summary of changes:
 MAINTAINERS.txt|9 -
 source4/dsdb/wscript_build |   12 +++-
 source4/kdc/wscript_build  |2 +-
 source4/lib/ldb/wscript|   18 +-
 source4/ntp_signd/wscript_build|3 ++-
 source4/web_server/web_server.h|   11 +--
 source4/web_server/wscript_build   |3 +--
 source4/web_server/wsgi.c  |8 
 source4/winbind/wscript_build  |5 +++--
 source4/wrepl_server/wscript_build |3 ++-
 10 files changed, 46 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/MAINTAINERS.txt b/MAINTAINERS.txt
index cab674e..08e7626 100644
--- a/MAINTAINERS.txt
+++ b/MAINTAINERS.txt
@@ -38,8 +38,15 @@ policy:
  and review by all maintainers.
 
 
+files: lib/tevent/py*, lib/talloc/py*, source4/lib/ldb/py*, lib/tdb/py*
+maintainers:
+     Jelmer Vernooij 
+policy:
+ Larger commits require pre-push review by the maintainer or
+ one of the maintainers of the containing subsystem.
 
-
+ Other non-trivial (typo, etc) commits require pre- or post-push 
review by the
+ maintainer or one of the maintainers of the containing subsystem.
 
 
 ===
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 199555b..3a09fc4 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -26,25 +26,27 @@ bld.SAMBA_SUBSYSTEM('SAMDB_SCHEMA',
)
 
 
-bld.SAMBA_MODULE('DREPL_SRV',
+bld.SAMBA_MODULE('service_drepl',
source='repl/drepl_service.c repl/drepl_periodic.c 
repl/drepl_partitions.c repl/drepl_out_pull.c repl/drepl_out_helpers.c 
repl/drepl_notify.c repl/drepl_ridalloc.c repl/drepl_extended.c 
repl/drepl_fsmo.c repl/drepl_secret.c repl/drepl_replica.c',
autoproto='repl/drepl_service_proto.h',
subsystem='service',
init_function='server_service_drepl_init',
-   deps='samdb process_model RPC_NDR_DRSUAPI'
+   deps='samdb process_model RPC_NDR_DRSUAPI',
+   internal_module=False,
)
 
 
-bld.SAMBA_MODULE('KCC_SRV',
+bld.SAMBA_MODULE('service_kcc',
source='kcc/kcc_service.c kcc/kcc_connection.c kcc/kcc_topology.c 
kcc/kcc_deleted.c kcc/kcc_periodic.c kcc/kcc_drs_replica_info.c',
autoproto='kcc/kcc_service_proto.h',
subsystem='service',
init_function='server_service_kcc_init',
-   deps='samdb process_model RPC_NDR_IRPC RPC_NDR_DRSUAPI'
+   deps='samdb process_model RPC_NDR_IRPC RPC_NDR_DRSUAPI',
+   internal_module=False,
)
 
 
-bld.SAMBA_MODULE('dns_update_srv',
+bld.SAMBA_MODULE('service_dns_update',
source='dns/dns_

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

2010-11-14 Thread Jelmer Vernooij
The branch, master has been updated
   via  aca1062 Cope with revision info not being present when displaying 
items in the web view.
  from  4bfd615 Fix nasty gram sending.

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


- Log -
commit aca1062fa087dfe02a5cfacdcc35faa4ee24805e
Author: Jelmer Vernooij 
Date:   Sun Nov 14 16:08:41 2010 +0100

Cope with revision info not being present when displaying items in the web 
view.

---

Summary of changes:
 web/build.py |   29 +++--
 1 files changed, 19 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.py b/web/build.py
index be6b830..d4edffe 100755
--- a/web/build.py
+++ b/web/build.py
@@ -134,10 +134,10 @@ def build_status_vals(status):
 def revision_link(myself, revision, tree):
 """return a link to a particular revision"""
 
-revision = revision.lstrip()
-if revision == "0":
-return "0"
+if revision is None:
+return "unknown"
 
+revision = revision.lstrip()
 rev_short = revision
 if len(revision) == 40:
 rev_short = re.sub("(^.{7}).*", "\\1(git)", rev_short)
@@ -478,10 +478,9 @@ class ViewBuildPage(BuildFarmPage):
 yield ""
 
 for build in old_rev_builds:
-revision = build.revision
 yield "%s%s" % (
-revision_link(myself, revision, tree),
-build_link(myself, tree, host, compiler, revision,
+revision_link(myself, build.revision, tree),
+build_link(myself, tree, host, compiler, build.revision,
 html_build_status(build.status(
 
 yield ""
@@ -498,7 +497,11 @@ class ViewBuildPage(BuildFarmPage):
 config = ""
 build = buildfarm.get_build(tree, host, compiler, rev)
 age_mtime = build.age_mtime()
-(revision, revision_time) = build.revision_details()
+try:
+(revision, revision_time) = build.revision_details()
+except data.MissingRevisionInfo:
+revision = None
+
 status = build_status_html(myself, build)
 
 if rev:
@@ -633,8 +636,11 @@ class ViewRecentBuildsPage(BuildFarmPage):
 else:
 age_mtime = build.age_mtime()
 age_ctime = build.age_ctime()
-(revision, revision_time) = build.revision_details()
-if revision:
+try:
+(revision, revision_time) = build.revision_details()
+except data.MissingRevisionInfo:
+pass
+else:
 all_builds.append([
 age_ctime,
 host.platform.encode("utf-8"),
@@ -705,7 +711,10 @@ class ViewHostPage(BuildFarmPage):
 except data.NoSuchBuildError:
 pass
 else:
-(revision, revision_time) = build.revision_details()
+try:
+(revision, revision_time) = 
build.revision_details()
+except data.MissingRevisionInfo:
+revision = None
 age_mtime = build.age_mtime()
 age_ctime = build.age_ctime()
 warnings = build.err_count()


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  4bfd615 Fix nasty gram sending.
  from  cfdeca5 Properly encode dictionary elements.

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


- Log -
commit 4bfd6157b74a824ed22549cf1f22be31ca6f5243
Author: Jelmer Vernooij 
Date:   Sat Nov 13 20:11:15 2010 +0100

Fix nasty gram sending.

---

Summary of changes:
 import-and-analyse.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/import-and-analyse.py b/import-and-analyse.py
index 3891f1e..d88ef43 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -87,7 +87,7 @@ The build may have been broken by one of the following 
commits:
 msg["From"] = "\"Build Farm\" "
 msg["To"] = ",".join(recipients)
 if not opts.dry_run:
-smtp.send(msg["From"], [msg["To"]], msg.as_string())
+smtp.sendmail(msg["From"], [msg["To"]], msg.as_string())
 else:
 print msg.as_string()
 


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  cfdeca5 Properly encode dictionary elements.
  from  52a2144 Remove now obsolete hostdb.pm.

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


- Log -
commit cfdeca50120dceb9f0bb3e5d161a185c93159def
Author: Jelmer Vernooij 
Date:   Sat Nov 13 20:09:11 2010 +0100

Properly encode dictionary elements.

---

Summary of changes:
 buildfarm/tests/test_data.py |5 -
 import-and-analyse.py|   14 --
 2 files changed, 16 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 5c233c2..e79224b 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -97,7 +97,10 @@ bla
 BUILD COMMIT TIME: 3 August 2010
 """)
 build = self.x.get_build("tdb", "charis", "cc", "12")
-self.assertEquals(("43", "3 August 2010"), build.revision_details())
+(rev, timestamp) = build.revision_details()
+self.assertIsInstance(rev, str)
+self.assertIsInstance(timestamp, str)
+self.assertEquals(("43", "3 August 2010"), (rev, timestamp))
 
 def test_revision_details_no_timestamp(self):
 self.create_mock_logfile("tdb", "charis", "cc", rev="12", contents="""
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 8ce42b2..3891f1e 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -69,8 +69,18 @@ See 
http://build.samba.org/?function=View+Build;host=%(host)s;tree=%(tree)s;comp
 The build may have been broken by one of the following commits:
 
 %(change_log)s
-""" % {"tree": tree, "host": host, "compiler": compiler, "change_log": 
change_log, "scm": t.scm, "branch": t.branch,
-"cur_rev": cur_rev, "old_rev": old_rev, "cur_status": cur_status, 
"old_status": old_status }
+""" % {
+"tree": tree.encode("utf-8"),
+"host": host.encode("utf-8"),
+"compiler": compiler.encode("utf-8"),
+"change_log": change_log,
+"scm": t.scm,
+"branch": t.branch,
+"cur_rev": cur_rev,
+"old_rev": old_rev,
+"cur_status": cur_status,
+"old_status": old_status,
+}
 
 msg = MIMEText(body)
 msg["Subject"] = "BUILD of %s:%s BROKEN on %s with %s AT REVISION %s" % 
(tree, t.branch, host, compiler, cur_rev)


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  52a2144 Remove now obsolete hostdb.pm.
   via  6cccf14 Switch over to using python import-and-analyse.
   via  90150b8 Fix blame mail sending.
  from  c3b0245 Try a bit harder to not fetch from the upload directory 
when looking for old builds.

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


- Log -
commit 52a21444c38370270d31dd604934e56727aa8128
Author: Jelmer Vernooij 
Date:   Sat Nov 13 20:00:40 2010 +0100

Remove now obsolete hostdb.pm.

commit 6cccf1436f7a41a8f63051bccade9f4a2ab309ee
Author: Jelmer Vernooij 
Date:   Sat Nov 13 19:57:47 2010 +0100

Switch over to using python import-and-analyse.

commit 90150b8b7b08904b4ec880822f3208a34c2467ec
Author: Jelmer Vernooij 
Date:   Sat Nov 13 19:56:28 2010 +0100

Fix blame mail sending.

---

Summary of changes:
 build.pm  |9 -
 hostdb.pm |  236 
 import-and-analyse.pl |  407 -
 import-and-analyse.py |5 +-
 revs.sh   |2 +-
 tests/hostdb.pl   |   74 -
 web/trees.conf|2 +-
 7 files changed, 4 insertions(+), 731 deletions(-)
 delete mode 100644 build.pm
 delete mode 100644 hostdb.pm
 delete mode 100755 import-and-analyse.pl
 delete mode 100755 tests/hostdb.pl


Changeset truncated at 500 lines:

diff --git a/build.pm b/build.pm
deleted file mode 100644
index 7de9cc7..000
--- a/build.pm
+++ /dev/null
@@ -1,9 +0,0 @@
-package BuildFarm;
-
-use strict;
-
-use vars qw ( $VERSION );
-
-$VERSION = '0.01';
-
-1;
diff --git a/hostdb.pm b/hostdb.pm
deleted file mode 100644
index 372483d..000
--- a/hostdb.pm
+++ /dev/null
@@ -1,236 +0,0 @@
-#!/usr/bin/perl
-
-# Samba.org buildfarm
-# Copyright (C) 2008 Andrew Bartlett 
-# Copyright (C) 2008 Jelmer Vernooij 
-#   
-# 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, see <http://www.gnu.org/licenses/>.
-#
-
-package hostdb;
-
-use DBI;
-use warnings;
-use strict;
-
-sub new($)
- {
-my ($class, $filename) = @_;
-
-my $dbh = DBI->connect("dbi:SQLite:$filename", "", "", {RaiseError => 1, 
PrintError => 0,
-ShowErrorStatement => 1, AutoCommit => 0}) or return 
undef;
-
-my $self = { filename => $filename, dbh => $dbh };
-
-bless($self, $class);
-}
-
-sub provision($)
-{
-   my ($self) = @_;
-   eval {
-   $self->{dbh}->do("CREATE TABLE host ( name text, owner text, 
owner_email text, password text, ssh_access int, fqdn text, platform text, 
permission text, last_dead_mail int, join_time int );");
-   
-   $self->{dbh}->do("CREATE UNIQUE INDEX unique_hostname ON host 
(name);");
-   
-   $self->{dbh}->do("CREATE TABLE build ( id integer primary key 
autoincrement, tree text, revision text, host text, compiler text, checksum 
text, age int, status text, commit_revision text);");
-   $self->{dbh}->do("CREATE UNIQUE INDEX unique_checksum ON build 
(checksum);");
-   
-   $self->{dbh}->do("CREATE TABLE test_run ( build int, test text, 
result text, output text);");
-   $self->{dbh}->commit();
-   };
-   if ($@) {
-   local $self->{dbh}->{RaiseError} = 0;
-   $self->{dbh}->rollback();
-   print "DB Failure: $@";
-   return 0;
-   }
-   return 1;
-}
-
-sub createhost($$)
-{
-   my ($self, $name, $platform, $owner, $owner_email, $password, 
$permission) = @_;
-   my $sth = $self->{dbh}->prepare("INSERT INTO host (name, platform, 
owner, owner_email, password, permission, join_time) VALUES (?,?,?,?,?,?,?)");
-   
-   eval {
-   $sth->execute($name, $platform, $owner, $owner_email, $password, 
$permission, time());
-   $self->{dbh}->commit();
-   };
-   if ($@) {
-   local $self->{dbh}->{RaiseError} = 0;
-   $self->{dbh}->rollback();
-   print "DB Failure: $@";
-   return 0;
-   }
-   return 1;
-}
-
-sub deletehost($$)
-{

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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  c3b0245 Try a bit harder to not fetch from the upload directory 
when looking for old builds.
  from  7f9ad8f Fix formatting.

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


- Log -
commit c3b0245cc29002085ff3c1e8cdcd6a565ebb5bb9
Author: Jelmer Vernooij 
Date:   Sat Nov 13 19:42:52 2010 +0100

Try a bit harder to not fetch from the upload directory when looking for 
old builds.

---

Summary of changes:
 buildfarm/__init__.py |2 +-
 import-and-analyse.py |4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 58b66fb..8d593c4 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -130,7 +130,7 @@ class BuildFarm(object):
 return perc
 
 def get_build(self, tree, host, compiler, rev=None):
-if rev:
+if rev is not None:
 return self.builds.get_build(tree, host, compiler, rev)
 else:
 return self.upload_builds.get_build(tree, host, compiler)
diff --git a/import-and-analyse.py b/import-and-analyse.py
index ec61fba..ed854ec 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -115,11 +115,13 @@ for build in buildfarm.get_new_builds():
 # Can't send a nastygram until there are 2 builds..
 else:
 try:
-prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
+assert prev_rev is not None
+prev_build = buildfarm.builds.get_build(build.tree, build.host, 
build.compiler, prev_rev)
 except data.NoSuchBuildError:
 if opts.verbose >= 1:
 print "Previous build %s has disappeared" % prev_build
 else:
+assert build.log_checksum() != prev_build.log_checksum()
 check_and_send_mails(build.tree, build.host, build.compiler, 
build, prev_build)
 
 if not opts.dry_run:


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  7f9ad8f Fix formatting.
  from  2ec5988 Cope with missing revision info in logs.

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


- Log -
commit 7f9ad8f7fd4ba40d144db6e1215b4bb36f8e2a1f
Author: Jelmer Vernooij 
Date:   Sat Nov 13 19:31:50 2010 +0100

Fix formatting.

---

Summary of changes:
 import-and-analyse.py |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/import-and-analyse.py b/import-and-analyse.py
index 773a03f..ec61fba 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -83,9 +83,6 @@ The build may have been broken by one of the following 
commits:
 
 
 for build in buildfarm.get_new_builds():
-if opts.verbose >= 2:
-print "Processing %s..." % build,
-
 if build in buildfarm.builds:
 continue
 
@@ -103,6 +100,7 @@ for build in buildfarm.get_new_builds():
 continue
 
 if opts.verbose >= 2:
+print "%s... " % build,
 print str(build.status())
 
 try:


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  2ec5988 Cope with missing revision info in logs.
  from  926046e Fix override of status method.

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


- Log -
commit 2ec59886e606ae73e0c9305450a9e1c148b7b41e
Author: Jelmer Vernooij 
Date:   Sat Nov 13 18:30:56 2010 +0100

Cope with missing revision info in logs.

---

Summary of changes:
 buildfarm/data.py |   13 ++---
 buildfarm/sqldb.py|2 +-
 import-and-analyse.py |   12 ++--
 3 files changed, 21 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 10966f4..5c25aab 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -42,6 +42,13 @@ class BuildSummary(object):
 BuildStageResult = collections.namedtuple("BuildStageResult", "name result")
 
 
+class MissingRevisionInfo(Exception):
+"""Revision info could not be found in the build log."""
+
+def __init__(self, build):
+self.build = build
+
+
 class BuildStatus(object):
 
 def __init__(self, stages=None, other_failures=None):
@@ -259,6 +266,9 @@ class Build(object):
 finally:
 f.close()
 
+if revid is None:
+raise MissingRevisionInfo(self)
+
 return (revid, timestamp)
 
 def status(self):
@@ -375,9 +385,6 @@ class BuildResultStore(object):
 def upload_build(self, build):
 (rev, rev_timestamp) = build.revision_details()
 
-if not rev:
-raise Exception("Unable to find revision in %r log" % build)
-
 new_basename = self.build_fname(build.tree, build.host, 
build.compiler, rev)
 try:
 existing_build = self.get_build(build.tree, build.host, 
build.compiler, rev)
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 2f65931..709784f 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -192,7 +192,7 @@ class StormCachingBuildResultStore(BuildResultStore):
 new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host), unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
 new_build.age = build.age_mtime()
-new_build.status = unicode(str(build.status()))
+new_build.status_str = unicode(str(build.status()))
 self.store.add(new_build)
 return new_build
 
diff --git a/import-and-analyse.py b/import-and-analyse.py
index dcfcec6..773a03f 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -90,9 +90,17 @@ for build in buildfarm.get_new_builds():
 continue
 
 if not opts.dry_run:
-build = buildfarm.builds.upload_build(build)
+try:
+build = buildfarm.builds.upload_build(build)
+except data.MissingRevisionInfo:
+print "No revision info in %r, skipping" % build
+continue
 
-(rev, rev_timestamp) = build.revision_details()
+try:
+(rev, rev_timestamp) = build.revision_details()
+except data.MissingRevisionInfo:
+print "No revision info in %r, skipping" % build
+continue
 
 if opts.verbose >= 2:
 print str(build.status())


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  926046e Fix override of status method.
  from  8ceda4d Skip duplicate builds.

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


- Log -
commit 926046e3136eafff756bd9bda7b74a8ec1da7af4
Author: Jelmer Vernooij 
Date:   Sat Nov 13 18:24:13 2010 +0100

Fix override of status method.

---

Summary of changes:
 buildfarm/sqldb.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index d975b77..2f65931 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -52,7 +52,7 @@ class StormBuild(Build):
 compiler = Unicode()
 checksum = RawStr()
 age = Int()
-status = Unicode()
+status_str = Unicode(name="status")
 commit_revision = RawStr()
 
 def log_checksum(self):


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  8ceda4d Skip duplicate builds.
  from  d5fc97f Don't kill upload builds just yet, improve verboseness.

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


- Log -
commit 8ceda4d45a24ece957e9de77f20052da37f8c2cc
Author: Jelmer Vernooij 
Date:   Sat Nov 13 18:17:36 2010 +0100

Skip duplicate builds.

---

Summary of changes:
 buildfarm/data.py |   12 
 buildfarm/sqldb.py|   12 ++--
 import-and-analyse.py |5 -
 3 files changed, 26 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index bc0eac9..10966f4 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -331,6 +331,18 @@ class BuildResultStore(object):
 """
 self.path = path
 
+def __contains__(self, build):
+try:
+if build.revision:
+rev = build.revision
+else:
+rev, timestamp = build.revision_details()
+self.get_build(build.tree, build.host, build.compiler, rev)
+except NoSuchBuildError:
+return False
+else:
+return True
+
 def get_build(self, tree, host, compiler, rev):
 basename = self.build_fname(tree, host, compiler, rev)
 logf = "%s.log" % basename
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 5ab71df..d975b77 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -55,6 +55,9 @@ class StormBuild(Build):
 status = Unicode()
 commit_revision = RawStr()
 
+def log_checksum(self):
+return self.checksum
+
 def remove(self):
 super(StormBuild, self).remove()
 Store.of(self).remove(self)
@@ -136,6 +139,9 @@ class StormCachingBuildResultStore(BuildResultStore):
 
 self.store = store
 
+def __contains__(self, build):
+return (self._get_by_checksum(build) is not None)
+
 def get_previous_revision(self, tree, host, compiler, revision):
 result = self.store.find(StormBuild,
 StormBuild.tree == unicode(tree),
@@ -169,9 +175,11 @@ class StormCachingBuildResultStore(BuildResultStore):
 raise NoSuchBuildError(tree, host, compiler)
 return build.revision
 
+def _get_by_checksum(self, build):
+return self.store.find(StormBuild, StormBuild.checksum == 
build.log_checksum()).one()
+
 def upload_build(self, build):
-result = self.store.find(StormBuild, StormBuild.checksum == 
build.log_checksum())
-existing_build = result.one()
+existing_build = self._get_by_checksum(build)
 if existing_build is not None:
 # Already present
 assert build.tree == existing_build.tree
diff --git a/import-and-analyse.py b/import-and-analyse.py
index a1cb47f..dcfcec6 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -86,8 +86,11 @@ for build in buildfarm.get_new_builds():
 if opts.verbose >= 2:
 print "Processing %s..." % build,
 
+if build in buildfarm.builds:
+continue
+
 if not opts.dry_run:
-buildfarm.builds.upload_build(build)
+build = buildfarm.builds.upload_build(build)
 
 (rev, rev_timestamp) = build.revision_details()
 


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  d5fc97f Don't kill upload builds just yet, improve verboseness.
  from  9ff770d Cope with previous builds disappearing.

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


- Log -
commit d5fc97f2d69f206b0db768b9d0f094d92af76806
Author: Jelmer Vernooij 
Date:   Sat Nov 13 18:08:33 2010 +0100

Don't kill upload builds just yet, improve verboseness.

---

Summary of changes:
 buildfarm/data.py |1 +
 buildfarm/sqldb.py|8 
 import-and-analyse.py |9 +
 3 files changed, 10 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 47a76b4..bc0eac9 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -376,6 +376,7 @@ class BuildResultStore(object):
 os.link(build.basename+".log", new_basename+".log")
 if os.path.exists(build.basename+".err"):
 os.link(build.basename+".err", new_basename+".err")
+return Build(new_basename, build.tree, build.host, build.compiler, rev)
 
 def get_previous_revision(self, tree, host, compiler, revision):
 raise NoSuchBuildError(tree, host, compiler, revision)
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index a244bd9..5ab71df 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -170,8 +170,6 @@ class StormCachingBuildResultStore(BuildResultStore):
 return build.revision
 
 def upload_build(self, build):
-super(StormCachingBuildResultStore, self).upload_build(build)
-rev, timestamp = build.revision_details()
 result = self.store.find(StormBuild, StormBuild.checksum == 
build.log_checksum())
 existing_build = result.one()
 if existing_build is not None:
@@ -179,14 +177,16 @@ class StormCachingBuildResultStore(BuildResultStore):
 assert build.tree == existing_build.tree
 assert build.host == existing_build.host
 assert build.compiler == existing_build.compiler
-assert rev == existing_build.revision
-return
+return existing_build
+rev, timestamp = build.revision_details()
+super(StormCachingBuildResultStore, self).upload_build(build)
 new_basename = self.build_fname(build.tree, build.host, 
build.compiler, rev)
 new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host), unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
 new_build.age = build.age_mtime()
 new_build.status = unicode(str(build.status()))
 self.store.add(new_build)
+return new_build
 
 
 class StormCachingBuildFarm(BuildFarm):
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 4f99b5c..a1cb47f 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -38,7 +38,7 @@ def check_and_send_mails(tree, host, compiler, cur, old):
 old_status = old.status()
 
 if not cur_status.regressed_since(old_status):
-if opts.verbose >= 1:
+if opts.verbose >= 3:
 print "... hasn't regressed since %s: %s" % (old_rev, old_status)
 return
 
@@ -83,7 +83,7 @@ The build may have been broken by one of the following 
commits:
 
 
 for build in buildfarm.get_new_builds():
-if opts.verbose >= 1:
+if opts.verbose >= 2:
 print "Processing %s..." % build,
 
 if not opts.dry_run:
@@ -91,7 +91,7 @@ for build in buildfarm.get_new_builds():
 
 (rev, rev_timestamp) = build.revision_details()
 
-if opts.verbose >= 1:
+if opts.verbose >= 2:
 print str(build.status())
 
 try:
@@ -114,7 +114,8 @@ for build in buildfarm.get_new_builds():
 check_and_send_mails(build.tree, build.host, build.compiler, 
build, prev_build)
 
 if not opts.dry_run:
-build.remove()
+# When the new web script is introduced, kill the build here:
+# build.remove()
 buildfarm.commit()
 
 smtp.quit()


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  9ff770d Cope with previous builds disappearing.
  from  d751b05 Cope with builds already existing.

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


- Log -
commit 9ff770d73b8db6e667e310dd62ee699de5025152
Author: Jelmer Vernooij 
Date:   Sat Nov 13 17:56:39 2010 +0100

Cope with previous builds disappearing.

---

Summary of changes:
 import-and-analyse.py |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/import-and-analyse.py b/import-and-analyse.py
index 07ddcd0..4f99b5c 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -104,10 +104,14 @@ for build in buildfarm.get_new_builds():
 if opts.verbose >= 1:
 print "Unable to find previous build for %s,%s,%s" % (build.tree, 
build.host, build.compiler)
 # Can't send a nastygram until there are 2 builds..
-continue
 else:
-prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
-check_and_send_mails(build.tree, build.host, build.compiler, build, 
prev_build)
+try:
+prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
+except data.NoSuchBuildError:
+if opts.verbose >= 1:
+print "Previous build %s has disappeared" % prev_build
+else:
+check_and_send_mails(build.tree, build.host, build.compiler, 
build, prev_build)
 
 if not opts.dry_run:
 build.remove()


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  d751b05 Cope with builds already existing.
  from  73d45eb Cope with system version of sqlite.

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


- Log -
commit d751b05bd7c140307427ce7403b29a42d282535c
Author: Jelmer Vernooij 
Date:   Sat Nov 13 17:54:11 2010 +0100

Cope with builds already existing.

---

Summary of changes:
 buildfarm/sqldb.py|9 +
 import-and-analyse.py |   18 +-
 2 files changed, 18 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index ca7d235..a244bd9 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -172,6 +172,15 @@ class StormCachingBuildResultStore(BuildResultStore):
 def upload_build(self, build):
 super(StormCachingBuildResultStore, self).upload_build(build)
 rev, timestamp = build.revision_details()
+result = self.store.find(StormBuild, StormBuild.checksum == 
build.log_checksum())
+existing_build = result.one()
+if existing_build is not None:
+# Already present
+assert build.tree == existing_build.tree
+assert build.host == existing_build.host
+assert build.compiler == existing_build.compiler
+assert rev == existing_build.revision
+return
 new_basename = self.build_fname(build.tree, build.host, 
build.compiler, rev)
 new_build = StormBuild(new_basename, unicode(build.tree), 
unicode(build.host), unicode(build.compiler), rev)
 new_build.checksum = build.log_checksum()
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 05c8a87..07ddcd0 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -39,7 +39,7 @@ def check_and_send_mails(tree, host, compiler, cur, old):
 
 if not cur_status.regressed_since(old_status):
 if opts.verbose >= 1:
-print "the build didn't get worse since %r" % old_status
+print "... hasn't regressed since %s: %s" % (old_rev, old_status)
 return
 
 recipients = set()
@@ -95,16 +95,16 @@ for build in buildfarm.get_new_builds():
 print str(build.status())
 
 try:
-prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
-except data.NoSuchBuildError:
-try:
+if opts.dry_run:
 # Perhaps this is a dry run and rev is not in the database yet?
 prev_rev = buildfarm.builds.get_latest_revision(build.tree, 
build.host, build.compiler)
-except data.NoSuchBuildError:
-if opts.verbose >= 1:
-print "Unable to find previous build for %s,%s,%s" % 
(build.tree, build.host, build.compiler)
-# Can't send a nastygram until there are 2 builds..
-continue
+else:
+prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
+except data.NoSuchBuildError:
+if opts.verbose >= 1:
+print "Unable to find previous build for %s,%s,%s" % (build.tree, 
build.host, build.compiler)
+# Can't send a nastygram until there are 2 builds..
+continue
 else:
 prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
 check_and_send_mails(build.tree, build.host, build.compiler, build, 
prev_build)


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  73d45eb Cope with system version of sqlite.
  from  731e40e Fix commit handling from specific author.

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


- Log -
commit 73d45eb068a9cbed4712e3e7742f09c9707746aa
Author: Jelmer Vernooij 
Date:   Sat Nov 13 17:26:31 2010 +0100

Cope with system version of sqlite.

---

Summary of changes:
 buildfarm/sqldb.py |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index d1ca87d..ca7d235 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -33,7 +33,10 @@ from buildfarm.hostdb import (
 )
 
 import os
-import pysqlite2
+try:
+import sqlite3
+except ImportError:
+from pysqlite2 import dbapi2 as sqlite3
 from storm.database import create_database
 from storm.locals import Bool, Desc, Int, Unicode, RawStr
 from storm.store import Store
@@ -100,7 +103,7 @@ class StormHostDatabase(HostDatabase):
 try:
 self.store.add(newhost)
 self.store.flush()
-except pysqlite2.dbapi2.IntegrityError:
+except sqlite3.IntegrityError:
 raise HostAlreadyExists(name)
 return newhost
 


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  731e40e Fix commit handling from specific author.
  from  398247a Improve regressed_since.

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


- Log -
commit 731e40ea6b3f434d9d171d733ed24c390e59be4d
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:54:55 2010 +0100

Fix commit handling from specific author.

---

Summary of changes:
 web/build.py |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.py b/web/build.py
index 686ce8c..be6b830 100755
--- a/web/build.py
+++ b/web/build.py
@@ -878,11 +878,13 @@ class RecentCheckinsPage(BuildFarmPage):
 def render(self, myself, tree, author=None):
 t = self.buildfarm.trees[tree]
 interesting = list()
-authors = set(["ALL"])
+authors = {"ALL": "ALL"}
 branch = t.get_branch()
+re_author = re.compile("^(.*) <(.*)>$")
 for entry in branch.log(limit=HISTORY_HORIZON):
-authors.add(entry.author)
-if author in ("ALL", "", entry.author):
+m = re_author.match(entry.author)
+authors[m.group(2)] = m.group(1)
+if author in ("ALL", "", m.group(2)):
 interesting.append(entry)
 
 yield "Recent checkins for %s (%s branch %s)\n" % (
@@ -890,8 +892,8 @@ class RecentCheckinsPage(BuildFarmPage):
 yield ""
 yield "Select Author: "
 yield ""
-for name in sorted(authors):
-yield "%s" % name
+for email in sorted(authors):
+yield "%s" % (email, authors[email])
 yield ""
 yield ""
 yield "" % tree


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  398247a Improve regressed_since.
  from  7176a9c Fix old revisions table.

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


- Log -
commit 398247a96c40d927d0f0b81ee8a816f2ff16d5a7
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:48:01 2010 +0100

Improve regressed_since.

---

Summary of changes:
 buildfarm/data.py |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index d6d5732..47a76b4 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -71,6 +71,12 @@ class BuildStatus(object):
 """Check if this build has regressed since another build."""
 if "disk full" in self.other_failures:
 return False
+if "timeout" in self.other_failures and "timeout" in 
other.other_failures:
+# When the timeout happens exactly can differ slightly, so it's 
okay
+# if the numbers are a bit different..
+return False
+if "panic" in self.other_failures and not "panic" in 
other.other_failures:
+return True
 return cmp(self._status_tuple(), other._status_tuple())
 
 def __cmp__(self, other):


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  7176a9c Fix old revisions table.
  from  35a841a Improve performance of history browsing.

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


- Log -
commit 7176a9c37bc30cb60844aca51b605287578ff9eb
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:29:18 2010 +0100

Fix old revisions table.

---

Summary of changes:
 web/build.py |   28 +++-
 1 files changed, 11 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.py b/web/build.py
index f4f7aea..686ce8c 100755
--- a/web/build.py
+++ b/web/build.py
@@ -115,8 +115,7 @@ def html_build_status(status):
 
 
 def build_status_html(myself, build):
-rawstatus = build.status()
-status = html_build_status(rawstatus)
+status = html_build_status(build.status())
 return build_link(myself, build.tree, build.host, build.compiler, 
build.revision, status)
 
 
@@ -467,9 +466,9 @@ class ViewBuildPage(BuildFarmPage):
 
 def show_oldrevs(self, myself, tree, host, compiler):
 """show the available old revisions, if any"""
-revs = self.buildfarm.builds.get_old_revs(tree, host, compiler)
+old_rev_builds  = self.buildfarm.builds.get_old_revs(tree, host, 
compiler)
 
-if len(revs) == 0:
+if len(old_rev_builds) == 0:
 return
 
 yield "Older builds:"
@@ -478,24 +477,19 @@ class ViewBuildPage(BuildFarmPage):
 yield "RevisionStatus"
 yield ""
 
-lastrev = ""
-for rev in revs:
-s = html_build_status(rev["STATUS"])
-revision = rev["REVISION"]
-s = s.replace(revision, "0")
-if s == lastrev:
-continue
-lastrev = s
-yield "%s%s" % (revision_link(myself, 
revision, tree), build_link(myself, tree, host, compiler, rev["REVISION"], 
html_build_status(rev["STATUS"])))
+for build in old_rev_builds:
+revision = build.revision
+yield "%s%s" % (
+revision_link(myself, revision, tree),
+build_link(myself, tree, host, compiler, revision,
+html_build_status(build.status(
 
-if lastrev != "":
-# Only print table if there was any actual data
-yield ""
+yield ""
 
 def render(self, myself, tree, host, compiler, rev, plain_logs=False):
 """view one build in detail"""
 # ensure the params are valid before using them
-#assert host in self.buildfarm.hostdb, "unknown host %s" % host
+self.buildfarm.hostdb.host(host)
 assert compiler in self.buildfarm.compilers, "unknown compiler %s" % 
compiler
 assert tree in self.buildfarm.trees, "not a build tree %s" % tree
 


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  35a841a Improve performance of history browsing.
  from  32b2b08 Mention correct port in message.

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


- Log -
commit 35a841a11f0c9dda8d56bb74cb16efdfe42f39dc
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:21:06 2010 +0100

Improve performance of history browsing.

---

Summary of changes:
 buildfarm/history.py|   44 +-
 buildfarm/tests/test_history.py |7 -
 web/build.py|   56 +++---
 web/trees.conf  |2 +-
 4 files changed, 54 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/history.py b/buildfarm/history.py
index d8532e2..4a402ae 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -29,33 +29,24 @@ from dulwich.repo import Repo
 class Branch(object):
 """A version control branch."""
 
-def authors(self, limit=None):
-"""Determine all authors that have contributed to this project.
-"""
-ret = set()
-for rev in self.log(limit=limit):
-ret.add(rev.author)
-return ret
-
 def log(self, limit=None):
 raise NotImplementedError(self.log)
 
 def diff(self, revision):
 raise NotImplementedError(self.diff)
 
+def changes_summary(self, revision):
+raise NotImplementedError(self.changes_summary)
+
 
 class Revision(object):
 
-def __init__(self, revision, date, committer, author, message, 
modified=[], added=[],
-removed=[]):
+def __init__(self, revision, date, committer, author, message):
 self.revision = revision
 self.date = date
 self.author = author
 self.committer = committer
 self.message = message
-self.modified = modified
-self.added = added
-self.removed = removed
 
 
 class GitBranch(Branch):
@@ -73,20 +64,9 @@ class GitBranch(Branch):
 return self.store.tree_changes(parent_tree, commit.tree)
 
 def _revision_from_commit(self, commit):
-added = set()
-modified = set()
-removed = set()
-for ((oldpath, newpath), (oldmode, newmode), (oldsha, newsha)) in 
self._changes_for(commit):
-if oldpath is None:
-added.add(newpath)
-elif newpath is None:
-removed.add(oldpath)
-else:
-modified.add(newpath)
 return Revision(commit.id, commit.commit_time,
 committer=commit.committer, author=commit.author,
-message=commit.message, modified=modified, removed=removed,
-added=added)
+message=commit.message)
 
 def log(self, from_rev=None, exclude_revs=None, limit=None):
 if from_rev is None:
@@ -110,6 +90,20 @@ class GitBranch(Branch):
  continue
  pending_commits.append(p)
 
+def changes_summary(self, revision):
+commit = self.repo[revision]
+added = set()
+modified = set()
+removed = set()
+for ((oldpath, newpath), (oldmode, newmode), (oldsha, newsha)) in 
self._changes_for(commit):
+if oldpath is None:
+added.add(newpath)
+elif newpath is None:
+removed.add(oldpath)
+else:
+modified.add(newpath)
+return (added, modified, removed)
+
 def diff(self, revision):
 commit = self.repo[revision]
 f = StringIO()
diff --git a/buildfarm/tests/test_history.py b/buildfarm/tests/test_history.py
index 137c0b5..29d7c1a 100644
--- a/buildfarm/tests/test_history.py
+++ b/buildfarm/tests/test_history.py
@@ -46,10 +46,3 @@ class GitBranchTests(TestCase):
 entry, diff = list(branch.diff(revid))
 self.assertEquals("message", entry.message)
 self.assertEquals("", diff)
-
-def test_authors_empty(self):
-branch = GitBranch(self.repo.path, "master")
-self.assertEquals(set(), branch.authors())
-revid = self.repo.do_commit("message", committer="Jelmer Vernooij 
")
-self.assertEquals(set(["Jelmer Vernooij "]),
-branch.authors())
diff --git a/web/build.py b/web/build.py
index 227512a..f4f7aea 100755
--- a/web/build.py
+++ b/web/build.py
@@ -361,7 +361,7 @@ def web_paths(t, paths):
 raise Exception("Unknown scm %s" % t.scm)
 
 
-def history_row_html(myself, entry, tree):
+def history_row_html(myself, entry, tree, changes):
 """show one row of history table"""
 msg = cgi.escape(entry.message)
 t = time.asctime(time.gmtime(entry.date))
@@ 

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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  32b2b08 Mention correct port in message.
  from  4295e5e Fix CSS in standalone mode, move static file hack out of 
app, get rid of global.

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


- Log -
commit 32b2b08294b9c2e98828d98df30ae77eab25ac92
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:08:34 2010 +0100

Mention correct port in message.

---

Summary of changes:
 buildfarm/data.py |3 ---
 web/build.py  |2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 4120730..d6d5732 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -376,6 +376,3 @@ class BuildResultStore(object):
 
 def get_latest_revision(self, tree, host, compiler):
 raise NoSuchBuildError(tree, host, compiler)
-
-
-
diff --git a/web/build.py b/web/build.py
index a8e96a7..227512a 100755
--- a/web/build.py
+++ b/web/build.py
@@ -1048,7 +1048,7 @@ if __name__ == '__main__':
 address = "localhost"
 port = opts.port
 httpd = make_server(address, int(port), standaloneApp)
-print "Serving on port 8000..."
+print "Serving on %s:%d..." % (address, int(port))
 httpd.serve_forever()
 else:
 import wsgiref.handlers


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  4295e5e Fix CSS in standalone mode, move static file hack out of 
app, get rid of global.
  from  c24daf3 Remove obsolete tree, more history horizon.

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


- Log -
commit 4295e5e2b719ac3eb73402f696ce842cefb2a253
Author: Jelmer Vernooij 
Date:   Sat Nov 13 16:06:49 2010 +0100

Fix CSS in standalone mode, move static file hack out of app, get rid of 
global.

---

Summary of changes:
 web/build.py |   49 ++---
 1 files changed, 26 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.py b/web/build.py
index 38949af..a8e96a7 100755
--- a/web/build.py
+++ b/web/build.py
@@ -47,7 +47,6 @@ import re
 import time
 
 import wsgiref.util
-standalone = 0
 webdir = os.path.dirname(__file__)
 basedir = os.path.abspath(os.path.join(webdir, ".."))
 
@@ -944,22 +943,6 @@ class BuildFarmApp(object):
 fn_name = get_param(form, 'function') or ''
 myself = wsgiref.util.application_uri(environ)
 
-if standalone and environ['PATH_INFO']:
-dir = os.path.join(os.path.dirname(__file__))
-if re.match("^/[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)?", 
environ['PATH_INFO']):
-static_file = "%s/%s" % (dir, environ['PATH_INFO'])
-if os.path.exists(static_file):
-tab = environ['PATH_INFO'].split('.')
-if len(tab) > 1:
-extension = tab[-1]
-import mimetypes
-mimetypes.init()
-type = mimetypes.types_map[".%s" % extension]
-start_response('200 OK', [('Content-type', type)])
-data = open(static_file, 'rb').read()
-yield data
-return
-
 if fn_name == 'text_diff':
 start_response('200 OK', [('Content-type', 'application/x-diff')])
 tree = get_param(form, 'tree')
@@ -982,10 +965,7 @@ class BuildFarmApp(object):
 yield ""
 yield ""
 yield ""
-if standalone:
-yield ""
-else:
-yield ""
+yield ""
 yield ""
 yield "  "
 yield ""
@@ -1038,13 +1018,36 @@ if __name__ == '__main__':
 parser = optparse.OptionParser("[options]")
 parser.add_option("--standalone", help="Run as standalone server (useful 
for debugging)", action="store_true")
 parser.add_option("--cachedirname", help="Cache directory name", type=str)
+parser.add_option("--port", help="Port to listen on (in standalone mode) 
[localhost:8000]", default="localhost:8000", type=str)
 opts, args = parser.parse_args()
 buildfarm = CachingBuildFarm(cachedirname=opts.cachedirname)
 buildApp = BuildFarmApp(buildfarm)
 if opts.standalone:
-standalone = 1
 from wsgiref.simple_server import make_server
-httpd = make_server('localhost', 8000, buildApp)
+
+def standaloneApp(environ, start_response):
+if environ['PATH_INFO']:
+dir = os.path.join(os.path.dirname(__file__))
+if re.match("^/[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)?", 
environ['PATH_INFO']):
+static_file = "%s/%s" % (dir, environ['PATH_INFO'])
+if os.path.exists(static_file):
+tab = environ['PATH_INFO'].split('.')
+if len(tab) > 1:
+extension = tab[-1]
+import mimetypes
+mimetypes.init()
+type = mimetypes.types_map[".%s" % extension]
+start_response('200 OK', [('Content-type', type)])
+data = open(static_file, 'rb').read()
+yield data
+return
+yield "".join(buildApp(environ, start_response))
+try:
+(address, port) = opts.port.rsplit(":", 1)
+except ValueError:
+address = "localhost"
+port = opts.port
+httpd = make_server(address, int(port), standaloneApp)
 print "Serving on port 8000..."
 httpd.serve_forever()
 else:


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  c24daf3 Remove obsolete tree, more history horizon.
  from  758927a Fix cache.

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


- Log -
commit c24daf3ceeb90ad62f7fc4d0f28a2638b6fa5734
Author: Jelmer Vernooij 
Date:   Sat Nov 13 15:58:51 2010 +0100

Remove obsolete tree, more history horizon.

---

Summary of changes:
 buildfarm/history.py |4 +---
 web/build.py |6 +++---
 web/trees.conf   |5 -
 3 files changed, 4 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/history.py b/buildfarm/history.py
index 94bf756..d8532e2 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -33,7 +33,7 @@ class Branch(object):
 """Determine all authors that have contributed to this project.
 """
 ret = set()
-for rev in self.log(limit):
+for rev in self.log(limit=limit):
 ret.add(rev.author)
 return ret
 
@@ -95,8 +95,6 @@ class GitBranch(Branch):
 except KeyError:
 return
 from_rev = commit.id
-else:
-from_rev = commit.id
 done = set()
 pending_commits = [from_rev]
 while pending_commits != []:
diff --git a/web/build.py b/web/build.py
index a00582b..38949af 100755
--- a/web/build.py
+++ b/web/build.py
@@ -10,7 +10,7 @@
 # Copyright (C) Andrew Bartlett2001
 # Copyright (C) Vance Lankhaar2002-2005
 # Copyright (C) Martin Pool     2001
-# Copyright (C) Jelmer Vernooij  2007
+# Copyright (C) Jelmer Vernooij  2007-2009
 #
 #   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
@@ -508,7 +508,7 @@ class ViewBuildPage(BuildFarmPage):
 if rev:
 assert re.match("^[0-9a-fA-F]*$", rev)
 
-f = build.read_log(limit=HISTORY_HORIZON)
+f = build.read_log()
 try:
 log = f.read()
 finally:
@@ -895,7 +895,7 @@ class RecentCheckinsPage(BuildFarmPage):
 
 branch = t.get_branch()
 
-for entry in branch.log():
+for entry in branch.log(limit=HISTORY_HORIZON):
 if author in ("ALL", "", entry.author):
 yield "".join(history_row_html(myself, entry, t))
 yield "\n"
diff --git a/web/trees.conf b/web/trees.conf
index de50306..1a72568 100644
--- a/web/trees.conf
+++ b/web/trees.conf
@@ -13,11 +13,6 @@ scm = git
 repo = ppp
 branch = master
 
-[build_farm]
-scm = git
-repo = build-farm
-branch = trunk
-
 [samba-web]
 scm = git
 repo = samba-web


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  758927a Fix cache.
  from  be38b55 Limit history.

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


- Log -
commit 758927a28262520944ed6f16029ebe993c8f1498
Author: Jelmer Vernooij 
Date:   Sat Nov 13 15:11:10 2010 +0100

Fix cache.

---

Summary of changes:
 buildfarm/filecache.py |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/filecache.py b/buildfarm/filecache.py
index 52e0183..d9c4a16 100644
--- a/buildfarm/filecache.py
+++ b/buildfarm/filecache.py
@@ -24,6 +24,8 @@ from buildfarm import (
 from buildfarm.data import (
 Build,
 BuildResultStore,
+BuildStageResult,
+BuildStatus,
 NoSuchBuildError,
 UploadBuildResultStore,
 check_dir_exists,


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  be38b55 Limit history.
   via  7f26933 Move file cache specific code to filecache module.
  from  0ab262b attempt to speed up log parsing by compiling regexes 
beforehand.

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


- Log -
commit be38b55bbaac14dee4ad51bf7c6225932752f56e
Author: Jelmer Vernooij 
Date:   Sat Nov 13 15:10:17 2010 +0100

Limit history.

commit 7f26933e3dce416a697fb3ac5b2681d178afccda
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:54:09 2010 +0100

Move file cache specific code to filecache module.

---

Summary of changes:
 buildfarm/__init__.py |   55 --
 buildfarm/data.py |  117 -
 buildfarm/filecache.py|  200 +
 buildfarm/history.py  |   18 ++--
 buildfarm/tests/test_buildfarm.py |7 --
 buildfarm/tests/test_data.py  |   27 -
 buildfarm/tests/test_filecache.py |   70 +
 web/build.py  |6 +-
 8 files changed, 284 insertions(+), 216 deletions(-)
 create mode 100644 buildfarm/filecache.py
 create mode 100644 buildfarm/tests/test_filecache.py


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 76a4146..58b66fb 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -140,58 +140,3 @@ class BuildFarm(object):
 for build in self.upload_builds.get_new_builds():
 if build.tree in self.trees and build.compiler in self.compilers 
and build.host in hostnames:
 yield build
-
-
-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):
-from buildfarm import data
-return data.CachingBuildResultStore(os.path.join(self.path, "data", 
"oldrevs"),
-self._get_cachedir(), readonly=self.readonly)
-
-def _open_upload_build_results(self):
-from buildfarm import data
-return data.CachingUploadBuildResultStore(os.path.join(self.path, 
"data", "upload"),
-self._get_cachedir(), readonly=self.readonly)
-
-def lcov_status(self, tree):
-"""get status of build"""
-from buildfarm import data, util
-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 data.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/data.py b/buildfarm/data.py
index 0bd1498..4120730 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -27,7 +27,6 @@ import hashlib
 import os
 import re
 import time
-import util
 
 
 class BuildSummary(object):
@@ -277,82 +276,6 @@ class Build(object):
 return len(file.readlines())
 
 
-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

Re: [SCM] Samba Shared Repository - branch master updated

2010-11-13 Thread Jelmer Vernooij
On Sat, 2010-11-13 at 11:50 +0100, Matthias Dieter Wallnöfer wrote:
> Well basically yes, ekacnet.
> 
> But I don't see any problem to use "modify_ldif"/"add_ldif" when sending 
> very special requests as password changes and others. Sometimes it's 
> really needed due to encoding constraints.
Can you give an example of this? E.g. in this situation below it would
be simpler without the ldif. Since LDIFs are always converted to ldb
Message anyway before they are processed I don't see how they could be
used in a larger number of situations.

Cheers,

Jelmer

> u Patou wrote:
> > Hi Mathias,
> >
> > We try to get rid of the modify_ldif way of doing ldb modification.
> > It's better to create a ldb.Message() object and then do a 
> > ldb.modify() with it like this:
> >
> >
> > --- a/source4/scripting/python/samba/upgradehelpers.py
> > +++ b/source4/scripting/python/samba/upgradehelpers.py
> > @@ -835,14 +835,13 @@ def update_machine_account_password(samdb, 
> > secrets_ldb, names):
> >  res = samdb.search(expression=expression, attrs=[])
> >  assert(len(res) == 1)
> >
> > +msg = ldb.Message(res[0].dn)
> >  machinepass = samba.generate_random_password(128, 255)
> > -
> > -samdb.modify_ldif("""
> > -dn: """ + str(res[0].dn) + """
> > -changetype: modify
> > -replace: clearTextPassword
> > -clearTextPassword:: """ + 
> > base64.b64encode(machinepass.encode('utf-16-le')) + """
> > -""")
> > +mpu = machinepass.encode('utf-16-le')
> > +msg["clearTextPassword"] = ldb.MessageElement(mpu,
> > +ldb.FLAG_MOD_REPLACE,
> > +"clearTextPassword")
> > +samdb.modify(msg)
> >
> >  res = samdb.search(expression=("samAccountName=%s$" % 
> > names.netbiosname),
> >   attrs=["msDs-keyVersionNumber"])
> >
> > Matthieu.
> >
> > On 11/11/2010 12:48, Matthias Dieter WallnXXfer wrote:
> >> The branch, master has been updated
> >> via  bb241f5 s4:pytevent.c - fix a discard const warning
> >> via  f036790 ldb:ldb_ldap.c rename operation - check for the 
> >> RDN name and value
> >> via  feb00fe s4:dsdb - proof against empty RDN values where 
> >> expected
> >> via  4fe63d9 Cannot create OU using custom Schema class
> >> via  e96c9df s4:objectclass LDB module - allow RDNs also to 
> >> come from superclasses
> >> via  4f86f29 s4:passwords.py - add a test for the normal 
> >> "userPassword" behaviour
> >> via  7f171a9 s4:password_hash and acl LDB modules - handle 
> >> the "userPassword" attribute according to the "dSHeuristics"
> >> via  d6c78fb s4:password_hash LDB module - move 
> >> "samdb_msg_find_old_and_new_ldb_val" into the password_hash LDB module
> >> via  eff1e8c s4:libnet/libnet_samsync_ldb.c - remove 
> >> "userPassword" remove code
> >> via  39f8661 s4:local_password LDB module - remove schema 
> >> checking code and fix some typos
> >> via  ed704c2 s4:ldb_modules/util.c - "dsHeuristics" ->  
> >> "dSHeuristics"
> >> via  79548f0 s4:selftest/tests.py - skip the "passwords.py" 
> >> suite on Windows 2000 domain function level
> >> via  5ded90e s4:acl.py - two password change tests are 
> >> expected to fails on Windows 2000 function level
> >> via  2403aaa s4:upgradehelpers.py - use "clearTextPassword" 
> >> rather than "userPassword"
> >> via  7c59ece s4:speedtest.py - use "unicodePwd" for setting 
> >> user's password
> >> via  0e94569 s4:speedtest.py - remove duplicated code
> >> via  0a29e55 s4:speedtest.py - fix script name in the help text
> >> via  ed1ca1c s4:speedtest.py - make it executable
> >> via  cc7f390 s4:python tests - fix script names in the help text
> >>from  ee50bdd s4-loadparm: fix the FLAG_DEFAULT settings on 
> >> specially handled parameters
> >>
> >> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> >>
> >>
> >> - Log -
> >> commit bb241f5cf8424c2576d5bc33ac149e5720b82068
> >> Author: Matthias Dieter Wallnöfer
> >> Date:   Wed Nov 10 16:21:41 2010 +0100
> >>
> >>  s4:pytevent.c - fix a discard const warning
> >>
> >>  Autobuild-User: Matthias Dieter Wallnöfer
> >>  Autobuild-Date: Thu Nov 11 09:47:55 UTC 2010 on sn-devel-104
> >>
> >> commit f0367905d9a6db76712f1dcf9734f64fe5c5e1b3
> >> Author: Matthias Dieter Wallnöfer
> >> Date:   Wed Nov 10 16:20:38 2010 +0100
> >>
> >>  ldb:ldb_ldap.c rename operation - check for the RDN name and value
> >>
> >>  Make it more similar to "ldb_ildap.c" and also more save
> >>
> >> commit feb00fe7cc238a78b3832c116cb4634936597735
> >> Author: Matthias Dieter Wallnöfer
> >> Date:   Wed Nov 10 16:05:16 2010 +0100
> >>
> >>  s4:dsdb - proof against empty RDN values where expected
> >>
> >>  This should prevent crashes as pointed

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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  0ab262b attempt to speed up log parsing by compiling regexes 
beforehand.
  from  c868b29 Allow limiting the number of revisions that we look back.

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


- Log -
commit 0ab262b677046d51191a2598d040e09f0d59ff7b
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:40:18 2010 +0100

attempt to speed up log parsing by compiling regexes beforehand.

---

Summary of changes:
 buildfarm/data.py |   32 
 1 files changed, 16 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 8629842..0bd1498 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -109,30 +109,17 @@ def build_status_from_logs(log, err):
 ret = BuildStatus()
 
 stages = []
+re_status = re.compile("^([A-Z_]+) STATUS:(\s*\d+)$")
+re_action = re.compile("^ACTION (PASSED|FAILED):\s+test$")
 
 for l in log:
-m = re.match("^([A-Z_]+) STATUS:(\s*\d+)$", l)
-if m:
-stages.append(BuildStageResult(m.group(1), 
int(m.group(2).strip(
-if m.group(1) == "TEST":
-test_seen = 1
-continue
-m = re.match("^ACTION (PASSED|FAILED):\s+test$", l)
-if m and not test_seen:
-if m.group(1) == "PASSED":
-stages.append(BuildStageResult("TEST", 0))
-else:
-stages.append(BuildStageResult("TEST", 1))
-continue
-
 if l.startswith("No space left on device"):
 ret.other_failures.add("disk full")
 continue
 if l.startswith("maximum runtime exceeded"):
 ret.other_failures.add("timeout")
 continue
-m = re.match("^(PANIC|INTERNAL ERROR):.*$", l)
-if m:
+if l.startswith("PANIC:") or l.startswith("INTERNAL ERROR:"):
 ret.other_failures.add("panic")
 continue
 if l.startswith("testsuite-failure: ") or 
l.startswith("testsuite-error: "):
@@ -141,6 +128,19 @@ def build_status_from_logs(log, err):
 if l.startswith("testsuite-success: "):
 test_successes += 1
 continue
+m = re_status.match(l)
+if m:
+stages.append(BuildStageResult(m.group(1), 
int(m.group(2).strip(
+if m.group(1) == "TEST":
+test_seen = 1
+continue
+m = re_action.match(l)
+if m and not test_seen:
+if m.group(1) == "PASSED":
+stages.append(BuildStageResult("TEST", 0))
+else:
+stages.append(BuildStageResult("TEST", 1))
+continue
 
 # Scan err file for specific errors
 for l in err:


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  c868b29 Allow limiting the number of revisions that we look back.
  from  de84a30 Provide GitBranch.authors.

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


- Log -
commit c868b2951d467200f728c15049f5099cec5bc98d
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:36:29 2010 +0100

Allow limiting the number of revisions that we look back.

---

Summary of changes:
 buildfarm/history.py |6 --
 web/build.py |3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/history.py b/buildfarm/history.py
index 1c96120..383782b 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -29,11 +29,13 @@ from dulwich.repo import Repo
 class Branch(object):
 """A version control branch."""
 
-def authors(self):
+def authors(self, limit=None):
 """Determine all authors that have contributed to this project.
 """
 ret = set()
-for rev in self.log():
+for i, rev in enumerate(self.log()):
+if i == limit:
+break
 ret.add(rev.author)
 return ret
 
diff --git a/web/build.py b/web/build.py
index d933554..88e99aa 100755
--- a/web/build.py
+++ b/web/build.py
@@ -52,6 +52,7 @@ basedir = os.path.abspath(os.path.join(webdir, ".."))
 
 UNPACKED_BASE = "http://svn.samba.org/ftp/unpacked";
 GITWEB_BASE = "http://gitweb.samba.org";
+HISTORY_HORIZON = 1000
 
 # this is automatically filled in
 deadhosts = []
@@ -875,7 +876,7 @@ class RecentCheckinsPage(BuildFarmPage):
 def render(self, myself, tree, author=None):
 t = self.buildfarm.trees[tree]
 authors = set(["ALL"])
-authors.update(t.get_branch().authors(tree))
+authors.update(t.get_branch().authors(limit=HISTORY_HORIZON))
 
 yield "Recent checkins for %s (%s branch %s)\n" % (
 tree, t.scm, t.branch)


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  de84a30 Provide GitBranch.authors.
  from  7fd815d fix git root.

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


- Log -
commit de84a3080173e5771765edec98f8a1783368a483
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:23:47 2010 +0100

Provide GitBranch.authors.

---

Summary of changes:
 buildfarm/history.py|2 +-
 buildfarm/tests/test_history.py |7 +++
 2 files changed, 8 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/history.py b/buildfarm/history.py
index ffe392f..1c96120 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -57,7 +57,7 @@ class Revision(object):
 self.removed = removed
 
 
-class GitBranch(object):
+class GitBranch(Branch):
 
 def __init__(self, path, branch="master"):
 self.repo = Repo(path)
diff --git a/buildfarm/tests/test_history.py b/buildfarm/tests/test_history.py
index 29d7c1a..137c0b5 100644
--- a/buildfarm/tests/test_history.py
+++ b/buildfarm/tests/test_history.py
@@ -46,3 +46,10 @@ class GitBranchTests(TestCase):
 entry, diff = list(branch.diff(revid))
 self.assertEquals("message", entry.message)
 self.assertEquals("", diff)
+
+def test_authors_empty(self):
+branch = GitBranch(self.repo.path, "master")
+self.assertEquals(set(), branch.authors())
+revid = self.repo.do_commit("message", committer="Jelmer Vernooij 
")
+self.assertEquals(set(["Jelmer Vernooij "]),
+branch.authors())


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  7fd815d fix git root.
  from  1d36022 Kill a global.

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


- Log -
commit 7fd815d0a196ed363342b2aa77707b6863c825d7
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:21:40 2010 +0100

fix git root.

---

Summary of changes:
 buildfarm/__init__.py |9 +++--
 buildfarm/history.py  |   16 
 2 files changed, 19 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index ba87fb1..76a4146 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -21,6 +21,8 @@ import ConfigParser
 import os
 import re
 
+GIT_ROOT = "/data/git"
+
 
 class Tree(object):
 """A tree to build."""
@@ -35,8 +37,11 @@ class Tree(object):
 self.scm = scm
 
 def get_branch(self):
-from buildfarm.history import GitBranch
-return GitBranch(self.repo, self.branch)
+if self.scm == "git":
+from buildfarm.history import GitBranch
+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)
diff --git a/buildfarm/history.py b/buildfarm/history.py
index d52bec1..ffe392f 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -27,8 +27,11 @@ from dulwich.repo import Repo
 
 
 class Branch(object):
+"""A version control branch."""
 
 def authors(self):
+"""Determine all authors that have contributed to this project.
+"""
 ret = set()
 for rev in self.log():
 ret.add(rev.author)
@@ -43,7 +46,8 @@ class Branch(object):
 
 class Revision(object):
 
-def __init__(self, revision, date, author, message, modified=[], added=[], 
removed=[]):
+def __init__(self, revision, date, author, message, modified=[], added=[],
+removed=[]):
 self.revision = revision
 self.date = date
 self.author = author
@@ -78,7 +82,9 @@ class GitBranch(object):
 removed.add(oldpath)
 else:
 modified.add(newpath)
-return Revision(commit.id, commit.commit_time, commit.author, 
commit.message, modified=modified, removed=removed, added=added)
+return Revision(commit.id, commit.commit_time, commit.author,
+commit.message, modified=modified, removed=removed,
+added=added)
 
 def log(self, from_rev=None, exclude_revs=None):
 if from_rev is None:
@@ -105,6 +111,8 @@ class GitBranch(object):
 def diff(self, revision):
 commit = self.repo[revision]
 f = StringIO()
-for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in 
self._changes_for(commit):
-write_blob_diff(f, (oldpath, oldmode, self.store[oldsha]), 
(newpath, newmode, self.store[newsha]))
+changes = self._changes_for(commit)
+for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in 
changes:
+write_blob_diff(f, (oldpath, oldmode, self.store[oldsha]),
+(newpath, newmode, self.store[newsha]))
 return (self._revision_from_commit(commit), f.getvalue())


-- 
build.samba.org


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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  1d36022 Kill a global.
  from  1a6118b Support overriding cache page on command line for 
web/build.py Put pages into a separate class. Several other fixes.

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


- Log -
commit 1d3602271d3b5898b46b2c3890a98ac8d92559b6
Author: Jelmer Vernooij 
Date:   Sat Nov 13 14:08:19 2010 +0100

Kill a global.

---

Summary of changes:
 web/build.py |   97 +
 1 files changed, 49 insertions(+), 48 deletions(-)


Changeset truncated at 500 lines:

diff --git a/web/build.py b/web/build.py
index f8d74d5..d933554 100755
--- a/web/build.py
+++ b/web/build.py
@@ -163,14 +163,12 @@ def format_subunit_reason(reason):
 return "%s" % reason
 
 
-def print_log_pretty(log):
-# prints the log in a visually appealing manner
-global indice
-indice = 0
+class LogPrettyPrinter(object):
+
+def __init__(self):
+self.indice = 0
 
-# do some pretty printing for the actions
-def pretty_print(m):
-global indice
+def _pretty_print(self, m):
 output = m.group(1)
 actionName = m.group(2)
 status = m.group(3)
@@ -178,37 +176,19 @@ def print_log_pretty(log):
 if actionName == 'cc_checker':
  output = print_log_cc_checker(output)
 
-indice += 1
-return make_collapsible_html('action', actionName, output, indice, 
status)
-
-pattern = re.compile("(Running action\s+([\w\-]+)$(?:\s^.*$)*?\sACTION\ 
(PASSED|FAILED):\ ([\w\-]+)$)", re.M)
-log = pattern.sub(pretty_print, log)
+self.indice += 1
+return make_collapsible_html('action', actionName, output, 
self.indice, status)
 
 # log is already CGI-escaped, so handle '>' in test name by handling >
-def format_stage(m):
-indice += 1
-return make_collapsible_html('test', m.group(1), m.group(2), indice, 
m.group(3))
-
-log = re.sub("""
-  --==--==--==--==--==--==--==--==--==--==--.*?
-  Running\ test\ ([\w\-=,_:\ /.&;]+).*?
-  --==--==--==--==--==--==--==--==--==--==--
-  (.*?)
-  ==.*?
-  TEST\ (FAILED|PASSED|SKIPPED):.*?
-  ==\s+
-""", format_stage, log)
+def _format_stage(self, m):
+self.indice += 1
+return make_collapsible_html('test', m.group(1), m.group(2), 
self.indice, m.group(3))
 
-def format_skip_testsuite(m):
-global indice
-indice += 1
-return make_collapsible_html('test', m.group(1), '', indice, 'skipped')
+def _format_skip_testsuite(self, m):
+self.indice += 1
+return make_collapsible_html('test', m.group(1), '', self.indice, 
'skipped')
 
-log = re.sub("skip-testsuite: ([\w\-=,_:\ /.&; \(\)]+).*?",
-format_skip_testsuite, log)
-
-def format_testsuite(m):
-global indice
+def _format_testsuite(self, m):
 testName = m.group(1)
 content = m.group(2)
 status = subunit_to_buildfarm_result(m.group(3))
@@ -216,23 +196,44 @@ def print_log_pretty(log):
 errorReason = format_subunit_reason(m.group(4))
 else:
 errorReason = ""
-indice += 1
-return make_collapsible_html('test', testName, content+errorReason, 
indice, status)
-
-pattern = re.compile("^testsuite: (.+)$\s((?:^.*$\s)*?)testsuite-(\w+): 
.*?(?:(\[$\s(?:^.*$\s)*?^\]$)|$)", re.M)
-log = pattern.sub(format_testsuite, log)
+self.indice += 1
+return make_collapsible_html('test', testName, content+errorReason, 
self.indice, status)
+
+def _format_test(self, m):
+self.indice += 1
+return make_collapsible_html('test', m.group(1), 
m.group(2)+format_subunit_reason(m.group(4)), self.indice, 
subunit_to_buildfarm_result(m.group(3)))
+
+def pretty_print(self, log):
+# do some pretty printing for the actions
+pattern = re.compile("(Running 
action\s+([\w\-]+)$(?:\s^.*$)*?\sACTION\ (PASSED|FAILED):\ ([\w\-]+)$)", re.M)
+log = pattern.sub(self._pretty_print, log)
+
+log = re.sub("""
+  --==--==--==--==--==--==--==--==--==--==--.*?
+  Running\ test\ ([\w\-=,_:\ /.&;]+).*?
+  --==--==--==--==--==--==--==--==--==--==--
+  (.*?)
+  ==.*?
+  TEST\ (FAILED|PASSED|SKIPPED):.*?
+  ==\

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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  1a6118b Support overriding cache page on command line for 
web/build.py Put pages into a separate class. Several other fixes.
  from  e4024b8 Various fixes found during ad-hoc testing.

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


- Log -
commit 1a6118b447040ec837cba9e7c832f779a3a548e6
Author: Jelmer Vernooij 
Date:   Sat Nov 13 13:55:45 2010 +0100

Support overriding cache page on command line for web/build.py
Put pages into a separate class.
Several other fixes.

---

Summary of changes:
 buildfarm/history.py |2 +-
 web/build.py | 1204 ++
 2 files changed, 620 insertions(+), 586 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/history.py b/buildfarm/history.py
index 537ce48..d52bec1 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -106,5 +106,5 @@ class GitBranch(object):
 commit = self.repo[revision]
 f = StringIO()
 for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in 
self._changes_for(commit):
-write_blob_diff((oldpath, oldmode, self.store[oldsha]), (newpath, 
newmode, self.store[newsha]))
+write_blob_diff(f, (oldpath, oldmode, self.store[oldsha]), 
(newpath, newmode, self.store[newsha]))
 return (self._revision_from_commit(commit), f.getvalue())
diff --git a/web/build.py b/web/build.py
index dc1ddb1..f8d74d5 100755
--- a/web/build.py
+++ b/web/build.py
@@ -1,12 +1,16 @@
 #!/usr/bin/python
 # This CGI script presents the results of the build_farm build
+
+# Copyright (C) Jelmer Vernooij  2010
+# Copyright (C) Matthieu Patou  2010
+#
+# Based on the original web/build.pl:
 #
 # Copyright (C) Andrew Tridgell  2001-2005
 # Copyright (C) Andrew Bartlett2001
 # Copyright (C) Vance Lankhaar2002-2005
 # Copyright (C) Martin Pool 2001
-# Copyright (C) Jelmer Vernooij  2007-2010
-# Copyright (C) Matthieu Patou  2010-2010
+# Copyright (C) Jelmer Vernooij  2007
 #
 #   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
@@ -32,6 +36,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 
".."))
 from buildfarm import (
 CachingBuildFarm,
 data,
+hostdb,
 util,
 )
 
@@ -44,16 +49,6 @@ standalone = 0
 webdir = os.path.dirname(__file__)
 basedir = os.path.abspath(os.path.join(webdir, ".."))
 
-buildfarm = CachingBuildFarm()
-
-db = data.BuildResultStore(basedir)
-hostsdb = buildfarm.hostdb
-
-compilers = buildfarm.compilers
-# host.properties are unicode object and the framework expect string object
-hosts = dict([(host.name.encode("utf-8"), host) for host in hostsdb.hosts()])
-trees = buildfarm.trees
-OLDAGE = buildfarm.OLDAGE
 
 UNPACKED_BASE = "http://svn.samba.org/ftp/unpacked";
 GITWEB_BASE = "http://gitweb.samba.org";
@@ -123,13 +118,6 @@ def build_status_html(myself, build):
 return build_link(myself, build.tree, build.host, build.compiler, 
build.revision, status)
 
 
-def red_age(age):
-"""show an age as a string"""
-if age > OLDAGE:
-return "%s" % util.dhm_time(age)
-return util.dhm_time(age)
-
-
 def build_status_vals(status):
 """translate a status into a set of int representing status"""
 status = util.strip_html(status)
@@ -142,89 +130,6 @@ def build_status_vals(status):
 return status.split("/")
 
 
-def view_summary(myself, output_type):
-"""view build summary"""
-i = 0
-cols = 2
-broken = 0
-broken_count = {}
-panic_count = {}
-host_count = {}
-
-# zero broken and panic counters
-for tree in trees:
-broken_count[tree] = 0
-panic_count[tree] = 0
-host_count[tree] = 0
-
-# set up a variable to store the broken builds table's code, so we can
-# output when we want
-broken_table = ""
-last_host = ""
-
-# for the text report, include the current time
-if output_type == 'text':
-t = time.gmtime()
-yield "Build status as of %s\n\n" % t
-
-for host in hosts.values():
-for compiler in compilers:
-for tree in trees:
-try:
-build = buildfarm.get_build(tree, 
host.name.encode("utf-8"), compiler)
-status = build_status_html(myself, build)
-except data.NoSuchBuildError:
-continue
-age_mtime = build.age_mtime()
-host_count[tree]+=1
-
-if "

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

2010-11-13 Thread Jelmer Vernooij
The branch, master has been updated
   via  e4024b8 Various fixes found during ad-hoc testing.
   via  e771174 Add convenience function for avoiding database. Move 
database code to separate module.
   via  d4df7e4 Fix some formatting.
   via  ff7cecb More fixes for import-and-analyse.
   via  1ca3392 Use named tuples, some more fixes for hostdb.
   via  ae0821a Warn early when creating host that already exists, move 
some storm code around.
   via  99f99ba Move some functionality to Host.
   via  b26943a More storm usage.
   via  549ef86 Use storm in host database.
   via  af937d5 Use storm to find builds.
   via  75f1b64 Remove unecessary argument from Build().
   via  75e2697 use storm.
  from  2a37ec3 Be verbose when there's no previous build.

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


- Log -
commit e4024b82466d4b4966a4ac21ec0884cc296bf984
Author: Jelmer Vernooij 
Date:   Sat Nov 13 13:08:07 2010 +0100

Various fixes found during ad-hoc testing.

commit e77117456e12043754d1da19e19880d1c5899722
Author: Jelmer Vernooij 
Date:   Sat Nov 13 06:40:18 2010 +0100

Add convenience function for avoiding database. Move database code to 
separate module.

commit d4df7e442cb6acd8a4aacd8135a1b38c159925bc
Author: Jelmer Vernooij 
Date:   Sat Nov 13 06:05:10 2010 +0100

Fix some formatting.

commit ff7cecb4b0af868781a1a84563bc78921a250588
Author: Jelmer Vernooij 
Date:   Sat Nov 13 05:49:39 2010 +0100

More fixes for import-and-analyse.

commit 1ca339299de89b486979c73222e9faa9ead01b7e
Author: Jelmer Vernooij 
Date:   Sat Nov 13 05:24:47 2010 +0100

Use named tuples, some more fixes for hostdb.

commit ae0821a89cfc6810c4410f9f1db26d629c7ee41d
Author: Jelmer Vernooij 
Date:   Sat Nov 13 05:11:05 2010 +0100

Warn early when creating host that already exists, move some storm code 
around.

commit 99f99bab13945b6d6cdd499ecfdae845e08d8ad1
Author: Jelmer Vernooij 
Date:   Sat Nov 13 04:43:47 2010 +0100

Move some functionality to Host.

commit b26943a223f8215cf132c0176a0f1385d66d1f7c
Author: Jelmer Vernooij 
Date:   Sat Nov 13 04:16:47 2010 +0100

More storm usage.

commit 549ef86335847197cc58ddca5dc4d407f925814f
Author: Jelmer Vernooij 
Date:   Sat Nov 13 04:09:04 2010 +0100

Use storm in host database.

commit af937d5dc9d2c68aa0b69f7247e59ad0320ec570
Author: Jelmer Vernooij 
Date:   Sat Nov 13 03:50:04 2010 +0100

Use storm to find builds.

commit 75f1b64035ab24de2dcd38e5d0d914cb992cb2b7
Author: Jelmer Vernooij 
Date:   Sat Nov 13 03:09:46 2010 +0100

Remove unecessary argument from Build().

commit 75e2697b4116421545c64780fc4610c636461891
Author: Jelmer Vernooij 
Date:   Sat Nov 13 02:55:39 2010 +0100

use storm.

---

Summary of changes:
 admin.py  |   46 +---
 buildfarm/__init__.py |   36 +-
 buildfarm/data.py |  128 --
 buildfarm/hostdb.py   |  117 +++-
 buildfarm/sqldb.py|  217 +
 buildfarm/tests/__init__.py   |   19 +++-
 buildfarm/tests/test_buildfarm.py |9 +--
 buildfarm/tests/test_data.py  |   33 +--
 buildfarm/tests/test_hostdb.py|   67 +---
 buildfarm/tests/test_sqldb.py |   78 +
 import-and-analyse.py |9 +-
 mail-dead-hosts.py|   11 +-
 web/build.py  |   41 
 13 files changed, 517 insertions(+), 294 deletions(-)
 create mode 100644 buildfarm/sqldb.py
 create mode 100644 buildfarm/tests/test_sqldb.py


Changeset truncated at 500 lines:

diff --git a/admin.py b/admin.py
index f17b26e..79c6ce7 100755
--- a/admin.py
+++ b/admin.py
@@ -70,16 +70,21 @@ else:
 if op == "remove":
 hostname = raw_input("Please enter hostname to delete: ")
 try:
-db.deletehost(hostname)
+db.deletehost(hostname.decode("utf-8"))
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
 else:
+db.commit()
 update_rsyncd_secrets()
 update_hosts_list()
 elif op == "modify":
 hostname = raw_input("Please enter hostname to modify: ")
-host = db.host(hostname)
+try:
+host = db.host(hostname.decode("utf-8"))
+except hostdb.NoSuchHost, e:
+print "No such host '%s'" % e.name
+sys.exit(1)
 print "Owner: %s <%s>" % host.owner
 print "Platform: %s" % host.platform
 print ""
@@ -88,19 +93,13 @@ elif op == "modify":
 mod_op = "platform"
 if mod_op == "platform":
 platform = raw_input("Enter new platform: &

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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  2a37ec3 Be verbose when there's no previous build.
  from  a4a34ad Cope with import-and-analyse dry runs.

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


- Log -
commit 2a37ec38f1335160ed066bfc9f46797092b8df09
Author: Jelmer Vernooij 
Date:   Sat Nov 13 01:24:51 2010 +0100

Be verbose when there's no previous build.

---

Summary of changes:
 import-and-analyse.py |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/import-and-analyse.py b/import-and-analyse.py
index fc24edf..8db0618 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -103,6 +103,8 @@ for build in buildfarm.get_new_builds():
 # Perhaps this is a dry run and rev is not in the database yet?
 prev_rev = buildfarm.builds.get_latest_revision(build.tree, 
build.host, build.compiler)
 except data.NoSuchBuildError:
+if opts.verbose >= 1:
+print "Unable to find previous build for %s,%s,%s" % 
(build.tree, build.host, build.compiler)
 # Can't send a nastygram until there are 2 builds..
 continue
 else:


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  a4a34ad Cope with import-and-analyse dry runs.
  from  fb29f3a Fix implementation of get_previous_revision.

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


- Log -
commit a4a34ad0eef1d87c001840b24acb6d90ff8468ee
Author: Jelmer Vernooij 
Date:   Sat Nov 13 01:22:21 2010 +0100

Cope with import-and-analyse dry runs.

---

Summary of changes:
 buildfarm/data.py|   10 ++
 buildfarm/tests/test_data.py |9 +
 import-and-analyse.py|8 ++--
 3 files changed, 25 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 7e6497a..5518ce4 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -469,6 +469,9 @@ class BuildResultStore(object):
 def get_previous_revision(self, tree, host, compiler, revision):
 raise NoSuchBuildError(tree, host, compiler, revision)
 
+def get_latest_revision(self, tree, host, compiler):
+raise NoSuchBuildError(tree, host, compiler)
+
 
 class CachingBuildResultStore(BuildResultStore):
 
@@ -514,6 +517,13 @@ class SQLCachingBuildResultStore(BuildResultStore):
 raise NoSuchBuildError(tree, host, compiler, revision)
 return row[0]
 
+def get_latest_revision(self, tree, host, compiler):
+cursor = self.db.execute("SELECT commit_revision FROM build WHERE tree 
= ? AND host = ? AND compiler = ? ORDER BY id DESC LIMIT 1", (tree, host, 
compiler))
+row = cursor.fetchone()
+if row is None:
+raise NoSuchBuildError(tree, host, compiler)
+return row[0]
+
 def upload_build(self, build):
 super(SQLCachingBuildResultStore, self).upload_build(build)
 rev, timestamp = build.revision_details()
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 60f6597..d432cfa 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -134,6 +134,8 @@ BUILD COMMIT REVISION: myrev
 def test_get_previous_revision(self):
 self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, 
"tdb", "charis", "cc", "12")
 
+def test_get_latest_revision_none(self):
+self.assertRaises(data.NoSuchBuildError, self.x.get_latest_revision, 
"tdb", "charis", "cc")
 
 
 class BuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
@@ -181,6 +183,13 @@ BUILD COMMIT REVISION: myotherrev
 self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, 
"tdb", "charis", "cc", "myrev")
 self.assertEquals("myrev", self.x.get_previous_revision("tdb", 
"charis", "cc", "myotherrev"))
 
+def test_get_latest_revision(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", "22", 
contents="""
+BUILD COMMIT REVISION: myrev
+""")
+self.x.upload_build(data.Build(None, path[:-4], "tdb", "charis", "cc"))
+self.assertEquals("myrev", self.x.get_latest_revision("tdb", "charis", 
"cc"))
+
 
 class BuildStatusFromLogs(testtools.TestCase):
 
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 726407e..fc24edf 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -99,8 +99,12 @@ for build in buildfarm.get_new_builds():
 try:
 prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
 except data.NoSuchBuildError:
-# Can't send a nastygram until there are 2 builds..
-continue
+try:
+# Perhaps this is a dry run and rev is not in the database yet?
+prev_rev = buildfarm.builds.get_latest_revision(build.tree, 
build.host, build.compiler)
+except data.NoSuchBuildError:
+# Can't send a nastygram until there are 2 builds..
+continue
 else:
 prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
 check_and_send_mails(build.tree, build.host, build.compiler, build, 
prev_build)


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  fb29f3a Fix implementation of get_previous_revision.
  from  92dcfd6 Use sqlite backed buildfarm in import-and-analyse.

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


- Log -
commit fb29f3ae2b0622b3cf1a48008e7d1e856bfd4da7
Author: Jelmer Vernooij 
Date:   Sat Nov 13 01:15:34 2010 +0100

Fix implementation of get_previous_revision.

---

Summary of changes:
 buildfarm/data.py|   10 --
 buildfarm/tests/test_data.py |   13 +
 2 files changed, 21 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 451caa5..7e6497a 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -503,7 +503,12 @@ class SQLCachingBuildResultStore(BuildResultStore):
 self.db = db
 
 def get_previous_revision(self, tree, host, compiler, revision):
-cursor = self.db.execute("SELECT commit_revision FROM build WHERE tree 
= ? AND host = ? AND compiler = ? AND commit_revision < ? ORDER BY id DESC 
LIMIT 1", (tree, host, compiler, revision))
+cursor = self.db.execute("SELECT id FROM build WHERE tree = ? AND host 
= ? AND compiler = ? AND commit_revision = ?", (tree, host, compiler, revision))
+row = cursor.fetchone()
+if row is None:
+raise NoSuchBuildError(tree, host, compiler, revision)
+dbid = row[0]
+cursor = self.db.execute("SELECT commit_revision FROM build WHERE tree 
= ? AND host = ? AND compiler = ? AND id < ? ORDER BY id DESC LIMIT 1", (tree, 
host, compiler, dbid))
 row = cursor.fetchone()
 if row is None:
 raise NoSuchBuildError(tree, host, compiler, revision)
@@ -511,4 +516,5 @@ class SQLCachingBuildResultStore(BuildResultStore):
 
 def upload_build(self, build):
 super(SQLCachingBuildResultStore, self).upload_build(build)
-self.db.execute("INSERT INTO build (tree, revision, commit_revision, 
host, compiler, checksum, age, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", 
(build.tree, build.revision, build.revision, build.host, build.compiler, 
build.log_checksum(), build.age_mtime(), repr(build.status(
+rev, timestamp = build.revision_details()
+self.db.execute("INSERT INTO build (tree, revision, commit_revision, 
host, compiler, checksum, age, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", 
(build.tree, rev, rev, build.host, build.compiler, build.log_checksum(), 
timestamp, repr(build.status(
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 4b60ad8..60f6597 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -168,6 +168,19 @@ class 
SQLCachingBuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase
 self.x = data.SQLCachingBuildResultStore(
 os.path.join(self.path, "data", "oldrevs"))
 
+def test_get_previous_revision_result(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", contents="""
+BUILD COMMIT REVISION: myrev
+""")
+self.x.upload_build(data.Build(None, path[:-4], "tdb", "charis", "cc"))
+path = self.create_mock_logfile("tdb", "charis", "cc", contents="""
+BUILD COMMIT REVISION: myotherrev
+""")
+self.x.upload_build(data.Build(None, path[:-4], "tdb", "charis", "cc"))
+self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, 
"tdb", "charis", "cc", "unknown")
+self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, 
"tdb", "charis", "cc", "myrev")
+self.assertEquals("myrev", self.x.get_previous_revision("tdb", 
"charis", "cc", "myotherrev"))
+
 
 class BuildStatusFromLogs(testtools.TestCase):
 


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  92dcfd6 Use sqlite backed buildfarm in import-and-analyse.
   via  64392cb Add sql caching buildfarm.
  from  ba21c21 Use commit_revision rather revision.

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


- Log -
commit 92dcfd6261517d1972952b8e674f0ae0975fc63f
Author: Jelmer Vernooij 
Date:   Sat Nov 13 00:32:59 2010 +0100

Use sqlite backed buildfarm in import-and-analyse.

commit 64392cb86d34dadeb1329b4c4419229b5ad96c91
Author: Jelmer Vernooij 
Date:   Sat Nov 13 00:30:57 2010 +0100

Add sql caching buildfarm.

---

Summary of changes:
 buildfarm/__init__.py |   19 +++
 buildfarm/tests/__init__.py   |5 +
 buildfarm/tests/test_buildfarm.py |9 +
 import-and-analyse.py |5 ++---
 4 files changed, 35 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 822dc1f..6b44309 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -20,6 +20,7 @@
 import ConfigParser
 import os
 import re
+import sqlite3
 
 
 class Tree(object):
@@ -187,6 +188,24 @@ class CachingBuildFarm(BuildFarm):
 return perc
 
 
+class SQLCachingBuildFarm(BuildFarm):
+
+def __init__(self, path=None, db=None):
+self.db = db
+super(SQLCachingBuildFarm, self).__init__(path)
+
+def _get_db(self):
+if self.db is not None:
+return self.db
+else:
+return sqlite3.connect(os.path.join(self.path, "hostdb.sqlite"))
+
+def _open_build_results(self):
+from buildfarm import data
+return data.SQLCachingBuildResultStore(os.path.join(self.path, "data", 
"oldrevs"),
+self.db)
+
+
 def setup_db(db):
 db.executescript("""
 CREATE TABLE IF NOT EXISTS host (name text, owner text, owner_email 
text, password text, ssh_access int, fqdn text, platform text, permission text, 
last_dead_mail int, join_time int);
diff --git a/buildfarm/tests/__init__.py b/buildfarm/tests/__init__.py
index 65912f8..046d1fa 100644
--- a/buildfarm/tests/__init__.py
+++ b/buildfarm/tests/__init__.py
@@ -15,7 +15,9 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+from buildfarm import setup_db
 import os
+import sqlite3
 from testtools import TestCase
 import shutil
 import tempfile
@@ -72,6 +74,9 @@ class BuildFarmTestCase(TestCase):
 for subdir in ["data", "data/upload", "data/oldrevs", "cache", "web", 
"lcov", "lcov/data"]:
 os.mkdir(os.path.join(self.path, subdir))
 
+db = sqlite3.connect(os.path.join(self.path, "hostdb.sqlite"))
+setup_db(db)
+
 def tearDown(self):
 shutil.rmtree(self.path)
 super(BuildFarmTestCase, self).tearDown()
diff --git a/buildfarm/tests/test_buildfarm.py 
b/buildfarm/tests/test_buildfarm.py
index 02eda60..2927f72 100644
--- a/buildfarm/tests/test_buildfarm.py
+++ b/buildfarm/tests/test_buildfarm.py
@@ -18,6 +18,7 @@
 from buildfarm import (
 BuildFarm,
 CachingBuildFarm,
+SQLCachingBuildFarm,
 data,
 read_trees_from_conf,
 )
@@ -126,3 +127,11 @@ class CachingBuildFarmTests(BuildFarmTestBase, 
BuildFarmTestCase):
 BuildFarmTestCase.setUp(self)
 BuildFarmTestBase.setUp(self)
 self.x = CachingBuildFarm(self.path)
+
+
+class SQLCachingBuildFarmTests(BuildFarmTestBase, BuildFarmTestCase):
+
+def setUp(self):
+BuildFarmTestCase.setUp(self)
+BuildFarmTestBase.setUp(self)
+self.x = SQLCachingBuildFarm(self.path)
diff --git a/import-and-analyse.py b/import-and-analyse.py
index d88d42c..726407e 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -11,7 +11,7 @@ on recent commits.
 """
 
 from buildfarm import (
-BuildFarm,
+SQLCachingBuildFarm,
 data,
 )
 from email.mime.text import MIMEText
@@ -25,8 +25,7 @@ parser.add_option("--verbose", help="Be verbose", 
action="count")
 
 (opts, args) = parser.parse_args()
 
-# we open readonly here as only apache(www-run) has write access
-buildfarm = BuildFarm()
+buildfarm = SQLCachingBuildFarm()
 
 smtp = smtplib.SMTP()
 smtp.connect()


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  ba21c21 Use commit_revision rather revision.
  from  ff35138 Some fixes for import-and-analyse.

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


- Log -
commit ba21c210a563c33262695a0f73edbb3e30d56f82
Author: Jelmer Vernooij 
Date:   Sat Nov 13 00:20:14 2010 +0100

Use commit_revision rather revision.

---

Summary of changes:
 buildfarm/data.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 888aa73..451caa5 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -503,7 +503,7 @@ class SQLCachingBuildResultStore(BuildResultStore):
 self.db = db
 
 def get_previous_revision(self, tree, host, compiler, revision):
-cursor = self.db.execute("SELECT revision FROM build WHERE tree = ? 
AND host = ? AND compiler = ? AND revision < ? ORDER BY id DESC LIMIT 1", 
(tree, host, compiler, revision))
+cursor = self.db.execute("SELECT commit_revision FROM build WHERE tree 
= ? AND host = ? AND compiler = ? AND commit_revision < ? ORDER BY id DESC 
LIMIT 1", (tree, host, compiler, revision))
 row = cursor.fetchone()
 if row is None:
 raise NoSuchBuildError(tree, host, compiler, revision)


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  ff35138 Some fixes for import-and-analyse.
  from  99b7f0c Simplify revision_details() call.

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


- Log -
commit ff351382411e200315fed46515a96dc7f55b34af
Author: Jelmer Vernooij 
Date:   Sat Nov 13 00:11:20 2010 +0100

Some fixes for import-and-analyse.

---

Summary of changes:
 import-and-analyse.py |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/import-and-analyse.py b/import-and-analyse.py
index def3428..d88d42c 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -41,7 +41,7 @@ def check_and_send_mails(tree, host, compiler, cur, old):
 old_status = old.status()
 
 if not cur_status.regressed_since(old_status):
-if opts.verbose:
+if opts.verbose >= 1:
 print "the build didn't get worse since %r" % old_status
 return
 
@@ -81,6 +81,8 @@ The build may have been broken by one of the following 
commits:
 msg["To"] = ",".join(recipients.keys())
 if not opts.dry_run:
 smtp.send(msg["From"], [msg["To"]], msg.as_string())
+else:
+print msg.as_string()
 
 
 for build in buildfarm.get_new_builds():
@@ -90,7 +92,7 @@ for build in buildfarm.get_new_builds():
 if not opts.dry_run:
 buildfarm.builds.upload_build(build)
 
-(rev, commit_rev, rev_timestamp) = build.revision_details()
+(rev, rev_timestamp) = build.revision_details()
 
 if opts.verbose >= 1:
 print str(build.status())


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  99b7f0c Simplify revision_details() call.
   via  720b006 Add upload_build for sqlite.
   via  081607d add initial code for sql backed build result data.
  from  fdfaa5a Scan for builds then verify, rather than probing.

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


- Log -
commit 99b7f0ce3b11bddac4580c9c0faec01085bad04c
Author: Jelmer Vernooij 
Date:   Fri Nov 12 23:12:53 2010 +0100

Simplify revision_details() call.

commit 720b006124fd809bf38ca37d44367d107778e813
Author: Jelmer Vernooij 
Date:   Fri Nov 12 23:08:22 2010 +0100

Add upload_build for sqlite.

commit 081607dfd99532b299e19df82dfc36b543502ed8
Author: Jelmer Vernooij 
Date:   Fri Nov 12 22:51:50 2010 +0100

add initial code for sql backed build result data.

---

Summary of changes:
 buildfarm/__init__.py |   10 
 buildfarm/data.py |   89 ++---
 buildfarm/hostdb.py   |9 +---
 buildfarm/tests/test_buildfarm.py |4 +-
 buildfarm/tests/test_data.py  |   19 ++--
 web/build.py  |   12 +
 6 files changed, 74 insertions(+), 69 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 40522f7..822dc1f 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -185,3 +185,13 @@ class CachingBuildFarm(BuildFarm):
 if not self.readonly:
 util.FileSave(cachefile, perc)
 return perc
+
+
+def setup_db(db):
+db.executescript("""
+CREATE TABLE IF NOT EXISTS host (name text, owner text, owner_email 
text, password text, ssh_access int, fqdn text, platform text, permission text, 
last_dead_mail int, join_time int);
+CREATE UNIQUE INDEX IF NOT EXISTS unique_hostname ON host (name);
+CREATE TABLE IF NOT EXISTS build (id integer primary key 
autoincrement, tree text, revision text, host text, compiler text, checksum 
text, age int, status text, commit_revision text);
+CREATE UNIQUE INDEX IF NOT EXISTS unique_checksum ON build (checksum);
+CREATE TABLE IF NOT EXISTS test_run (build int, test text, result 
text, output text);
+""")
diff --git a/buildfarm/data.py b/buildfarm/data.py
index 0eaae74..888aa73 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -21,22 +21,23 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-
+from buildfarm import setup_db
 from cStringIO import StringIO
 import hashlib
 import os
 import re
+import sqlite3
 import time
 import util
 
 
 class BuildSummary(object):
 
-def __init__(self, host, tree, compiler, rev, status):
+def __init__(self, host, tree, compiler, revision, status):
 self.host = host
 self.tree = tree
 self.compiler = compiler
-self.rev = rev
+self.revision = revision
 self.status = status
 
 
@@ -180,11 +181,11 @@ class Build(object):
 self.tree = tree
 self.host = host
 self.compiler = compiler
-self.rev = rev
+self.revision = rev
 
 def __repr__(self):
-if self.rev:
-return "<%s: revision %s of %s on %s using %s>" % 
(self.__class__.__name__, self.rev, self.tree, self.host, self.compiler)
+if self.revision:
+return "<%s: revision %s of %s on %s using %s>" % 
(self.__class__.__name__, self.revision, self.tree, self.host, self.compiler)
 else:
 return "<%s: %s on %s using %s>" % (self.__class__.__name__, 
self.tree, self.host, self.compiler)
 
@@ -228,9 +229,7 @@ class Build(object):
 f.close()
 
 def summary(self):
-(revid, commit_revid, timestamp) = self.revision_details()
-if commit_revid:
-revid = commit_revid
+(revid, timestamp) = self.revision_details()
 status = self.status()
 return BuildSummary(self.host, self.tree, self.compiler, revid, status)
 
@@ -239,23 +238,19 @@ class Build(object):
 
 :return: Tuple with revision id and timestamp (if available)
 """
-
 revid = None
-commit_revid = None
 timestamp = None
 f = self.read_log()
 try:
 for l in f:
 if l.startswith("BUILD COMMIT REVISION: "):
-commit_revid = l.split(":", 1)[1].strip()
-elif l.startswith("BUILD REVISION: "):
 revid = l.split(":", 1)[1].strip()
 elif l.startswith("BUILD COMMIT TIME"):
 timestamp = l.split(":", 1)[1].strip()
 final

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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  fdfaa5a Scan for builds then verify, rather than probing.
  from  969a9d5 Unconfuse repr and str for BuildStatus.

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


- Log -
commit fdfaa5a549198dca1426da23dbbe841762d72f44
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:32:57 2010 +0100

Scan for builds then verify, rather than probing.

---

Summary of changes:
 buildfarm/__init__.py|   17 +
 buildfarm/data.py|   12 +++-
 buildfarm/tests/test_data.py |9 +
 3 files changed, 25 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index a608f79..40522f7 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -103,7 +103,7 @@ class BuildFarm(object):
 
 def _load_compilers(self):
 from buildfarm import util
-return util.load_list(os.path.join(self.webdir, "compilers.list"))
+return set(util.load_list(os.path.join(self.webdir, "compilers.list")))
 
 def lcov_status(self, tree):
 """get status of build"""
@@ -129,17 +129,10 @@ class BuildFarm(object):
 return self.upload_builds.get_build(tree, host, compiler)
 
 def get_new_builds(self):
-from buildfarm import data
-for host in self.hostdb.hosts():
-for tree in self.trees:
-for compiler in self.compilers:
-# By building the log file name this way, using only the 
list of
-# hosts, trees and compilers as input, we ensure we
-# control the inputs
-try:
-yield self.upload_builds.get_build(tree, host.name, 
compiler)
-except data.NoSuchBuildError:
-continue
+hosts = set([host.name for host in self.hostdb.hosts()])
+for build in self.upload_builds.get_new_builds():
+if build.tree in self.trees and build.compiler in self.compilers 
and build.host in hosts:
+yield build
 
 
 class CachingBuildFarm(BuildFarm):
diff --git a/buildfarm/data.py b/buildfarm/data.py
index fb34ad7..0eaae74 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -55,7 +55,7 @@ class BuildStatus(object):
 def __str__(self):
 if self.other_failures:
 return ",".join(self.other_failures)
-return "/".join(self._status_tuple())
+return "/".join(map(str, self._status_tuple()))
 
 def broken_host(self):
 if "disk full" in self.other_failures:
@@ -365,6 +365,16 @@ class UploadBuildResultStore(object):
 """
 self.path = path
 
+def get_new_builds(self):
+for name in os.listdir(self.path):
+try:
+(build, tree, host, compiler, extension) = name.split(".")
+except ValueError:
+continue
+if build != "build" or extension != "log":
+continue
+yield self.get_build(tree, host, compiler)
+
 def build_fname(self, tree, host, compiler):
 return os.path.join(self.path, "build.%s.%s.%s" % (tree, host, 
compiler))
 
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index f89cfb1..9824c51 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -298,6 +298,15 @@ class UploadBuildResultStoreTestBase(object):
 self.x.build_fname("mytree", "myhost", "cc"),
 "%s/data/upload/build.mytree.myhost.cc" % self.path)
 
+def test_get_new_builds(self):
+self.assertEquals([], list(self.x.get_new_builds()))
+path = self.create_mock_logfile("tdb", "charis", "cc")
+new_builds = list(self.x.get_new_builds())
+self.assertEquals(1, len(new_builds))
+self.assertEquals("tdb", new_builds[0].tree)
+self.assertEquals("charis", new_builds[0].host)
+self.assertEquals("cc", new_builds[0].compiler)
+
 
 class 
UploadBuildResultStoreTests(UploadBuildResultStoreTestBase,BuildFarmTestCase):
 


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  969a9d5 Unconfuse repr and str for BuildStatus.
  from  437a715 Print build status when verbose.

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


- Log -
commit 969a9d523ab757bc4abf49ed1d818cabb5d4fd5e
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:24:27 2010 +0100

Unconfuse repr and str for BuildStatus.

---

Summary of changes:
 buildfarm/data.py |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 4e4138d..fb34ad7 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -55,7 +55,7 @@ class BuildStatus(object):
 def __str__(self):
 if self.other_failures:
 return ",".join(self.other_failures)
-return "/".join([x[1] for x in self.stages])
+return "/".join(self._status_tuple())
 
 def broken_host(self):
 if "disk full" in self.other_failures:
@@ -89,8 +89,8 @@ class BuildStatus(object):
 else:
 return cmp(other.stages, self.stages)
 
-def __str__(self):
-return repr((self.stages, self.other_failures))
+def __repr__(self):
+return "%s(%r)" % (self.__class__.__name__, (self.stages, 
self.other_failures))
 
 
 def check_dir_exists(kind, path):
@@ -346,12 +346,12 @@ class CachingBuild(Build):
 st2 = None
 
 if st2 and st1.st_ctime <= st2.st_mtime:
-return BuildStatus(*eval(util.FileLoad(cachefile)))
+return eval(util.FileLoad(cachefile))
 
 ret = super(CachingBuild, self).status()
 
 if not self._store.readonly:
-util.FileSave(cachefile, str(ret))
+util.FileSave(cachefile, repr(ret))
 
 return ret
 


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  437a715 Print build status when verbose.
  from  2bed1d2 More fixes, implement Build.__repr__.

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


- Log -
commit 437a715153314191c986297e358af81709ccb689
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:21:03 2010 +0100

Print build status when verbose.

---

Summary of changes:
 buildfarm/data.py |5 +
 import-and-analyse.py |5 -
 2 files changed, 9 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 8c30b7e..4e4138d 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -52,6 +52,11 @@ class BuildStatus(object):
 else:
 self.other_failures = set()
 
+def __str__(self):
+if self.other_failures:
+return ",".join(self.other_failures)
+return "/".join([x[1] for x in self.stages])
+
 def broken_host(self):
 if "disk full" in self.other_failures:
 return True
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 9431f56..def3428 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -85,13 +85,16 @@ The build may have been broken by one of the following 
commits:
 
 for build in buildfarm.get_new_builds():
 if opts.verbose >= 1:
-print "Processing %s..." % build
+print "Processing %s..." % build,
 
 if not opts.dry_run:
 buildfarm.builds.upload_build(build)
 
 (rev, commit_rev, rev_timestamp) = build.revision_details()
 
+if opts.verbose >= 1:
+print str(build.status())
+
 try:
 prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
 except data.NoSuchBuildError:


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  2bed1d2 More fixes, implement Build.__repr__.
  from  b5385e7 Provide stub get_previous_revision.

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


- Log -
commit 2bed1d2b6c98b303021497e312831053a1d9eb37
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:17:09 2010 +0100

More fixes, implement Build.__repr__.

---

Summary of changes:
 buildfarm/data.py|8 +++-
 buildfarm/tests/test_data.py |5 +
 import-and-analyse.py|2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 24e05d7..8c30b7e 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -177,6 +177,12 @@ class Build(object):
 self.compiler = compiler
 self.rev = rev
 
+def __repr__(self):
+if self.rev:
+return "<%s: revision %s of %s on %s using %s>" % 
(self.__class__.__name__, self.rev, self.tree, self.host, self.compiler)
+else:
+return "<%s: %s on %s using %s>" % (self.__class__.__name__, 
self.tree, self.host, self.compiler)
+
 def remove(self):
 os.unlink(self.basename + ".log")
 if os.path.exists(self.basename+".err"):
@@ -460,7 +466,7 @@ class BuildResultStore(object):
 # $st->execute($tree, $rev, $commit, $host, $compiler, $checksum, 
$stat->ctime, $status_html)
 
 def get_previous_revision(self, tree, host, compiler, revision):
-raise NoSuchBuildError(self):
+raise NoSuchBuildError(tree, host, compiler, revision)
 
 """
 def get_previous_revision(self, tree, host, compiler, revision):
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 43451da..f89cfb1 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -47,6 +47,11 @@ class BuildResultStoreTestBase(object):
 self.assertFalse(os.path.exists(path))
 self.assertRaises(data.NoSuchBuildError, self.x.get_build, "tdb", 
"charis", "cc", "12")
 
+def test_build_repr(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", "12")
+build = self.x.get_build("tdb", "charis", "cc", "12")
+self.assertEquals("<%s: revision 12 of tdb on charis using cc>" % 
build.__class__.__name__, repr(build))
+
 def test_build_age_mtime(self):
 path = self.create_mock_logfile("tdb", "charis", "cc", "12")
 # Set mtime to something in the past
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 89dae0a..9431f56 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -94,7 +94,7 @@ for build in buildfarm.get_new_builds():
 
 try:
 prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
-except data.NoSuchBuild:
+except data.NoSuchBuildError:
 # Can't send a nastygram until there are 2 builds..
 continue
 else:


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  b5385e7 Provide stub get_previous_revision.
  from  83a49ae Fix argument order.

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


- Log -
commit b5385e7133e3fe38ff01d328a92d0dec02d685f1
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:12:08 2010 +0100

Provide stub get_previous_revision.

---

Summary of changes:
 buildfarm/data.py |3 +++
 import-and-analyse.py |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 9f982db..24e05d7 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -459,6 +459,9 @@ class BuildResultStore(object):
 # $st = $dbh->prepare("INSERT INTO build (tree, revision, 
commit_revision, host, compiler, checksum, age, status) VALUES (?, ?, ?, ?, ?, 
?, ?, ?)")
 # $st->execute($tree, $rev, $commit, $host, $compiler, $checksum, 
$stat->ctime, $status_html)
 
+def get_previous_revision(self, tree, host, compiler, revision):
+raise NoSuchBuildError(self):
+
 """
 def get_previous_revision(self, tree, host, compiler, revision):
 # Look up the database to find the previous status
diff --git a/import-and-analyse.py b/import-and-analyse.py
index f1b90f5..89dae0a 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -12,7 +12,7 @@ on recent commits.
 
 from buildfarm import (
 BuildFarm,
-hostdb,
+data,
 )
 from email.mime.text import MIMEText
 import logging
@@ -94,7 +94,7 @@ for build in buildfarm.get_new_builds():
 
 try:
 prev_rev = buildfarm.builds.get_previous_revision(build.tree, 
build.host, build.compiler, rev)
-except hostdb.NoSuchBuild:
+except data.NoSuchBuild:
 # Can't send a nastygram until there are 2 builds..
 continue
 else:


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  83a49ae Fix argument order.
  from  5e622dd Fix new build fetching.

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


- Log -
commit 83a49ae36791317edc59938ced87f99c03c1485e
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:09:40 2010 +0100

Fix argument order.

---

Summary of changes:
 buildfarm/__init__.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index fe1949d..a608f79 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -137,7 +137,7 @@ class BuildFarm(object):
 # hosts, trees and compilers as input, we ensure we
 # control the inputs
 try:
-yield self.upload_builds.get_build(host.name, tree, 
compiler)
+yield self.upload_builds.get_build(tree, host.name, 
compiler)
 except data.NoSuchBuildError:
 continue
 


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  5e622dd Fix new build fetching.
  from  109bec3 admin: Only update hosts list/rsyncd secrets when changes 
have been made.

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


- Log -
commit 5e622dd560d6fc78ec29b6656493c2f8108f
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:07:39 2010 +0100

Fix new build fetching.

---

Summary of changes:
 buildfarm/__init__.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 06b2d31..fe1949d 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -137,7 +137,7 @@ class BuildFarm(object):
 # hosts, trees and compilers as input, we ensure we
 # control the inputs
 try:
-yield self.upload_builds.get_build(host, tree, 
compiler)
+yield self.upload_builds.get_build(host.name, tree, 
compiler)
 except data.NoSuchBuildError:
 continue
 


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  109bec3 admin: Only update hosts list/rsyncd secrets when changes 
have been made.
  from  5b70bb5 Switch over to using python mail-dead-hosts scripts.

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


- Log -
commit 109bec3e1147caff0352fe7e57a47d1e532f7385
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:05:24 2010 +0100

admin: Only update hosts list/rsyncd secrets when changes have been made.

---

Summary of changes:
 admin.py |   38 +++---
 1 files changed, 23 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/admin.py b/admin.py
index 909d303..f17b26e 100755
--- a/admin.py
+++ b/admin.py
@@ -32,6 +32,22 @@ buildfarm = BuildFarm()
 
 db = buildfarm.hostdb
 
+def update_rsyncd_secrets():
+temp_rsyncd_secrets = os.path.join(os.path.dirname(__file__), 
"../rsyncd.secrets.new")
+f = open(temp_rsyncd_secrets, "w")
+f.writelines(db.create_rsync_secrets())
+f.close()
+
+os.rename(temp_rsyncd_secrets, "../rsyncd.secrets")
+
+def update_hosts_list():
+temp_hosts_list_file = os.path.join(os.path.dirname(__file__), "web", 
"hosts.list.new")
+f = open(temp_hosts_list_file, "w")
+f.writelines(db.create_hosts_list())
+f.close()
+
+os.rename(temp_hosts_list_file, os.path.join(os.path.dirname(__file__), 
"web/hosts.list"))
+
 dry_run = False
 
 print "Samba Build farm management tool"
@@ -58,6 +74,9 @@ if op == "remove":
 except hostdb.NoSuchHost, e:
 print "No such host '%s'" % e.name
 sys.exit(1)
+else:
+update_rsyncd_secrets()
+update_hosts_list()
 elif op == "modify":
 hostname = raw_input("Please enter hostname to modify: ")
 host = db.host(hostname)
@@ -85,6 +104,8 @@ elif op == "modify":
 else:
 print "Unknown subcommand %s" % mod_op
 sys.exit(1)
+update_rsyncd_secrets()
+update_hosts_list()
 elif op == "add":
 hostname = raw_input("Machine hostname: ")
 platform = raw_input("Machine platform (eg Fedora 9 x86_64): ")
@@ -155,7 +176,8 @@ Thanks, your friendly Samba build farm administrator 
""" % owne
 recipients.append(msg["Bcc"])
 s.sendmail(msg["From"], recipients, msg.as_string())
 s.quit()
-
+update_rsyncd_secrets()
+update_hosts_list()
 elif op == "info":
 hostname = raw_input("Hostname: ")
 host = db.host(hostname)
@@ -179,17 +201,3 @@ elif op == "list":
 else:
 print "Unknown command %s" % op
 sys.exit(1)
-
-temp_rsyncd_secrets = os.path.join(os.path.dirname(__file__), 
"../rsyncd.secrets.new")
-f = open(temp_rsyncd_secrets, "w")
-f.writelines(db.create_rsync_secrets())
-f.close()
-
-os.rename(temp_rsyncd_secrets, "../rsyncd.secrets")
-
-temp_hosts_list_file = os.path.join(os.path.dirname(__file__), "web", 
"hosts.list.new")
-f = open(temp_hosts_list_file, "w")
-f.writelines(db.create_hosts_list())
-f.close()
-
-os.rename(temp_hosts_list_file, os.path.join(os.path.dirname(__file__), 
"web/hosts.list"))


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  5b70bb5 Switch over to using python mail-dead-hosts scripts.
  from  f6aa956 Keep connection open while sending dead host notifications, 
only mark mail sent when not using dry run.

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


- Log -
commit 5b70bb59f78911581d912e0aeeb317658e255bf6
Author: Jelmer Vernooij 
Date:   Fri Nov 12 20:01:12 2010 +0100

Switch over to using python mail-dead-hosts scripts.

---

Summary of changes:
 daily.sh   |2 +-
 mail-dead-hosts.pl |   88 
 2 files changed, 1 insertions(+), 89 deletions(-)
 delete mode 100755 mail-dead-hosts.pl


Changeset truncated at 500 lines:

diff --git a/daily.sh b/daily.sh
index f57536c..8bc5304 100755
--- a/daily.sh
+++ b/daily.sh
@@ -7,7 +7,7 @@ set -x
 date
 set -x
 sqlite3 `dirname $0`/hostdb.sqlite 'VACUUM;'
-cd `dirname $0` && ./mail-dead-hosts.pl
+cd `dirname $0` && ./mail-dead-hosts.py
 
 echo "deleting old file that are not used any more"
 find `dirname $0`/data/oldrevs -type f -mtime +10 -links 1 -print0 | xargs -i 
-0 rm -f \{\}
diff --git a/mail-dead-hosts.pl b/mail-dead-hosts.pl
deleted file mode 100755
index 9ebaa7a..000
--- a/mail-dead-hosts.pl
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/perl
-# Samba.org buildfarm
-# Copyright (C) 2008 Andrew Bartlett 
-# Copyright (C) 2008 Jelmer Vernooij 
-#   
-# 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, see <http://www.gnu.org/licenses/>.
-#
-
-use FindBin qw($RealBin);
-use POSIX qw(strftime);
-use hostdb;
-use Mail::Send;
-use warnings;
-use strict;
-
-my $db = new hostdb("$RealBin/hostdb.sqlite") or die("Unable to connect to 
host database: $!");
-my $dry_run = 0;
-
-my $hosts = $db->dead_hosts(7 * 86400);
-foreach (@$hosts) {
-   
-   my ($fh, $msg);
-   
-   $db->sent_dead_mail($_->{host}) or die "Could not update 'last dead 
mail sent' record for $_->{host}";
-
-   # send an e-mail to the owner
-   my $subject = "Your build farm host $_->{host} appears dead";
-   if ($dry_run) {
-   print "To: $_->{owner} <$_->{owner_email}>\n";
-   print "Subject: $subject\n";
-   open(MAIL,"|cat");
-   } else {
-   $msg = new Mail::Send(Subject=>$subject, 
To=>"bui...@samba.org");
-   $msg->set("From", "\"Samba Build Farm\" \");
-   $fh = $msg->open; 
-   }
-
-my $last_update;
-   if (defined($_->{last_update})) {
-   $last_update = strftime ("%a %b %e %H:%M:%S %Y", 
gmtime($_->{last_update}));
-   } else {
-   $last_update = "a long time";
-   }
-
-   my $body = << "__EOF__";
-Your host $_->{host} has been part of the Samba Build farm, hosted
-at http://build.samba.org.
-
-Sadly however we have not heard from it since $last_update.
-
-Could you see if something has changed recently, and examine the logs
-(typically in ~build/build_farm/build.log and ~build/cron.err) to see
-why we have not heard from your host?
-
-If you no longer wish your host to participate in the Samba Build
-Farm, then please let us know so we can remove its records.
-
-You can see the summary for your host at:
-http://build.samba.org/?function=View+Host;host=$_->{host}
-
-Thanks,
-
-The Build Farm administration team.
-
-__EOF__
-
-   if ($dry_run) {
-   print MAIL $body;
-
-   close(MAIL);
-   } else {
-   print $fh "$body";
-   $fh->close;
-   }
-}
-
-1;


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  f6aa956 Keep connection open while sending dead host notifications, 
only mark mail sent when not using dry run.
  from  6b5ee74 Honor dry_run in import-and-analyse.

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


- Log -
commit f6aa956149f3c1d68d386fc2c87e6e3f56895850
Author: Jelmer Vernooij 
Date:   Fri Nov 12 19:59:08 2010 +0100

Keep connection open while sending dead host notifications, only mark mail 
sent when not using dry run.

---

Summary of changes:
 mail-dead-hosts.py |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 1a73974..f9a5807 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -32,10 +32,11 @@ parser.add_option("--dry-run", help="Don't actually send 
any emails.", action="s
 buildfarm = BuildFarm()
 db = buildfarm.hostdb
 
+smtp = smtplib.SMTP()
+smtp.connect()
+
 hosts = db.dead_hosts(7 * 86400)
 for host in hosts:
-db.sent_dead_mail(host.name)
-
 if host.last_update:
 last_update = time.strftime("%a %b %e %H:%M:%S %Y", 
time.gmtime(host.last_update))
 else:
@@ -73,7 +74,6 @@ The Build Farm administration team.
 if opts.dry_run:
 print msg.as_string()
 else:
-s = smtplib.SMTP()
-s.connect()
-s.send(msg["From"], [msg["To"]], msg.as_string())
-s.quit()
+smtp.send(msg["From"], [msg["To"]], msg.as_string())
+db.sent_dead_mail(host.name)
+smtp.quit()


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  6b5ee74 Honor dry_run in import-and-analyse.
   via  0f899bb Simplify a bit.
   via  dd74e7b Add command line parsing to mail-dead-hosts.
  from  36bdf3c Support removing builds.

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


- Log -
commit 6b5ee746808f98bffcdf8287a02af6c6673eb9e8
Author: Jelmer Vernooij 
Date:   Fri Nov 12 19:55:06 2010 +0100

Honor dry_run in import-and-analyse.

commit 0f899bb785925d073e4e6f8343b4ef5727fff042
Author: Jelmer Vernooij 
Date:   Fri Nov 12 19:53:20 2010 +0100

Simplify a bit.

commit dd74e7b3633093ca3e0d723ca9e53e28c83308f5
Author: Jelmer Vernooij 
Date:   Fri Nov 12 19:53:12 2010 +0100

Add command line parsing to mail-dead-hosts.

---

Summary of changes:
 buildfarm/__init__.py |2 +-
 import-and-analyse.py |   17 -
 mail-dead-hosts.py|   10 +++---
 3 files changed, 16 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index d866db4..06b2d31 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -50,7 +50,7 @@ def read_trees_from_conf(path):
 """
 ret = {}
 cfp = ConfigParser.ConfigParser()
-cfp.readfp(open(path))
+cfp.read(path)
 for s in cfp.sections():
 ret[s] = Tree(name=s, **dict(cfp.items(s)))
 return ret
diff --git a/import-and-analyse.py b/import-and-analyse.py
index c468a82..f1b90f5 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -40,12 +40,8 @@ def check_and_send_mails(tree, host, compiler, cur, old):
 (old_rev, old_rev_timestamp) = old.revision_details()
 old_status = old.status()
 
-if opts.dry_run:
-print "rev=%s status=%s" % (cur_rev, cur_status)
-print "old rev=%s status=%s" % (old_rev, old_status)
-
 if not cur_status.regressed_since(old_status):
-if opts.dry_run:
+if opts.verbose:
 print "the build didn't get worse since %r" % old_status
 return
 
@@ -83,14 +79,16 @@ The build may have been broken by one of the following 
commits:
 msg["Subject"] = "BUILD of %s:%s BROKEN on %s with %s AT REVISION %s" % 
(tree, t.branch, host, compiler, cur_rev)
 msg["From"] = "\"Build Farm\" "
 msg["To"] = ",".join(recipients.keys())
-smtp.send(msg["From"], [msg["To"]], msg.as_string())
+if not opts.dry_run:
+smtp.send(msg["From"], [msg["To"]], msg.as_string())
 
 
 for build in buildfarm.get_new_builds():
-if opts.verbose >= 2:
+if opts.verbose >= 1:
 print "Processing %s..." % build
 
-buildfarm.builds.upload_build(build)
+if not opts.dry_run:
+buildfarm.builds.upload_build(build)
 
 (rev, commit_rev, rev_timestamp) = build.revision_details()
 
@@ -103,6 +101,7 @@ for build in buildfarm.get_new_builds():
 prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
 check_and_send_mails(build.tree, build.host, build.compiler, build, 
prev_build)
 
-build.remove()
+if not opts.dry_run:
+build.remove()
 
 smtp.quit()
diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 1a26264..1a73974 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -20,20 +20,24 @@
 from buildfarm import (
 BuildFarm,
 )
+import optparse
 import smtplib
 from email.MIMEText import MIMEText
 import time
 
+parser = optparse.OptionParser()
+parser.add_option("--dry-run", help="Don't actually send any emails.", 
action="store_true")
+(opts, args) = parser.parse_args()
+
 buildfarm = BuildFarm()
 db = buildfarm.hostdb
-dry_run = False
 
 hosts = db.dead_hosts(7 * 86400)
 for host in hosts:
 db.sent_dead_mail(host.name)
 
 if host.last_update:
-last_update = time.strftime ("%a %b %e %H:%M:%S %Y", 
time.gmtime(host.last_update))
+last_update = time.strftime("%a %b %e %H:%M:%S %Y", 
time.gmtime(host.last_update))
 else:
 last_update = "a long time"
 
@@ -66,7 +70,7 @@ The Build Farm administration team.
 msg["From"] = "\"Samba Build Farm\" "
 msg["To"] = "\"%s\" <%s>" % host.owner
 
-if dry_run:
+if opts.dry_run:
 print msg.as_string()
 else:
 s = smtplib.SMTP()


-- 
build.samba.org


[SCM] Samba Shared Repository - branch master updated

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  e4eba98 waf/samba_version: Simplify git show command.
   via  8d07e6d samba_version: Make COMMIT_IS_CLEAN an int rather than a 
string.
   via  7d961dd samba_version: Simplify dirty tree detection.
   via  c338ded waf/samba_version: Support integer defines.
   via  ed22f13 s3: Rename GIT_COMMIT_{TIME,DATE} to COMMIT_{TIME,DATE}.
   via  9ebb55d s4: Remove obsolete mkversion.sh
   via  7b964c7 samba_version: When working from git checkout, display git 
revision SHA1 rather than Bazaar revision ids.
   via  a0c2040 samba_version: Support retrieving snapshot identity from 
bzr.
   via  45af495 samba_version: Cope with building snapshots in directories 
without git checkout.
   via  d9a0a18 Put git tree finding into a separate function.
   via  80e2adc sambaversion.py: Some cleanups, make less git-specific.
   via  e3b7ce8 wafsamba: Support make dist from bzr checkout.
   via  5a482a6 torture: Only add in tests for socket_wrapper/nss_wrapper 
when they have been enabled.
   via  7e8ea2c unix_privs: Add missing dependency on libreplace.
   via  1f853ee socket_wrapper: Only add as global dependency when enabled.
   via  32889f8 heimdal_build: Add missing dependency on replace, necessary 
because replace.h is included.
  from  5cf904b s4-waf: Only enable various wrappers if they're actually 
used.

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


- Log -
commit e4eba98f831b869bf3894c2940a8131a7a6862be
Author: Jelmer Vernooij 
Date:   Fri Nov 12 18:27:46 2010 +0100

waf/samba_version: Simplify git show command.

Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Fri Nov 12 18:38:21 UTC 2010 on sn-devel-104

commit 8d07e6d986322c4954a385b9bfea73f0931b3053
Author: Jelmer Vernooij 
Date:   Fri Nov 12 18:20:02 2010 +0100

samba_version: Make COMMIT_IS_CLEAN an int rather than a string.

commit 7d961ddc443a31d71cd3d2c02a397128da9be120
Author: Jelmer Vernooij 
Date:   Fri Nov 12 18:19:00 2010 +0100

samba_version: Simplify dirty tree detection.

commit c338dede1b5bdab240a237581644158ba56249b3
Author: Jelmer Vernooij 
Date:   Fri Nov 12 18:06:43 2010 +0100

waf/samba_version: Support integer defines.

commit ed22f13e7ead1b1ed2fd9dde51a479b9cfaf67aa
Author: Jelmer Vernooij 
Date:   Fri Nov 12 18:06:20 2010 +0100

s3: Rename GIT_COMMIT_{TIME,DATE} to COMMIT_{TIME,DATE}.

This avoids some special casing in the waf code.

commit 9ebb55d1cb1280a5b8a4d82ec35568c034898e41
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:59:07 2010 +0100

s4: Remove obsolete mkversion.sh

commit 7b964c72698054337e1c40df23550edad96de8b5
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:54:41 2010 +0100

samba_version: When working from git checkout, display git revision SHA1 
rather
than Bazaar revision ids.

commit a0c2040ab698c8f053d12b4f53b0ac76a8f5ebac
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:26:06 2010 +0100

samba_version: Support retrieving snapshot identity from bzr.

commit 45af495695a83636e79a810e212542d7c292a9ac
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:18:30 2010 +0100

samba_version: Cope with building snapshots in directories without git 
checkout.

Error out when run in a git checkout in which git fails.

commit d9a0a18ddabe9b91e73cc8bf1582af46d208ff27
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:13:37 2010 +0100

Put git tree finding into a separate function.

commit 80e2adc9c3412ac7d22ef9ebb0c8451768841b08
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:08:09 2010 +0100

sambaversion.py: Some cleanups, make less git-specific.

commit e3b7ce85e2db8cf09202fc2da843cf043e64e81c
Author: Jelmer Vernooij 
Date:   Fri Nov 12 17:00:42 2010 +0100

wafsamba: Support make dist from bzr checkout.

commit 5a482a641e9631e269684d4394864659791b5dec
Author: Jelmer Vernooij 
Date:   Fri Nov 12 16:23:03 2010 +0100

torture: Only add in tests for socket_wrapper/nss_wrapper when they have 
been enabled.

commit 7e8ea2ca34462669810f540f7b09cd7475a87a7c
Author: Jelmer Vernooij 
Date:   Fri Nov 12 16:22:43 2010 +0100

unix_privs: Add missing dependency on libreplace.

commit 1f853ee51b46b5a1a3b4e8e2c13023ddcc034fa2
Author: Jelmer Vernooij 
Date:   Fri Nov 12 16:22:16 2010 +0100

socket_wrapper: Only add as global dependency when enabled.

commit 32889f83465a5e943beb47c059572b8cd108df9c
Author: Jelmer Vernooij 
Date:   Fri Nov 12 16:12:14 2010 +0100

heimdal_build: Add missing dependency on replace, necessary because 
replace.h is included.

---

Summary of changes:
 buildtools/wafsamba/samba_dist.py |   14 ++-
 buildtools/wafsamba/samba_patterns.py |4 +-
 buildtools/wafsamba/samba_version.py  |  189 ++---
 lib/socket_wrapper/wscript|6 +-
 lib

[SCM] Samba Shared Repository - branch master updated

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  5cf904b s4-waf: Only enable various wrappers if they're actually 
used.
   via  b6e1362 Lowercase DNS_UPDATE_SRV name.
  from  dedd064 tdb: set tdb->name early, as it's needed for tdb_name()

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


- Log -
commit 5cf904b1d9b4eaa366851d9ab51c0ed4e86d773e
Author: Jelmer Vernooij 
Date:   Fri Nov 12 12:55:14 2010 +0100

s4-waf: Only enable various wrappers if they're actually used.

    Autobuild-User: Jelmer Vernooij 
Autobuild-Date: Fri Nov 12 14:33:34 UTC 2010 on sn-devel-104

commit b6e13627dfca1171cf42e27e415c1fdb325d4926
Author: Jelmer Vernooij 
Date:   Fri Nov 12 12:17:45 2010 +0100

Lowercase DNS_UPDATE_SRV name.

---

Summary of changes:
 lib/nss_wrapper/wscript_build|3 ++-
 lib/socket_wrapper/wscript_build |1 +
 lib/uid_wrapper/wscript_build|3 ++-
 source4/dsdb/wscript_build   |2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/nss_wrapper/wscript_build b/lib/nss_wrapper/wscript_build
index 8004573..5f9df3a 100644
--- a/lib/nss_wrapper/wscript_build
+++ b/lib/nss_wrapper/wscript_build
@@ -4,6 +4,7 @@
 bld.SAMBA_LIBRARY('nss_wrapper',
   source='nss_wrapper.c',
   deps='replace',
-  private_library=True
+  private_library=True,
+  enabled=bld.CONFIG_SET("NSS_WRAPPER"),
   )
 
diff --git a/lib/socket_wrapper/wscript_build b/lib/socket_wrapper/wscript_build
index e100ccc..a81c7aa 100644
--- a/lib/socket_wrapper/wscript_build
+++ b/lib/socket_wrapper/wscript_build
@@ -4,5 +4,6 @@ bld.SAMBA_LIBRARY('socket_wrapper',
   source='socket_wrapper.c',
   group='base_libraries',
   private_library=True,
+  enabled=bld.CONFIG_SET('SOCKET_WRAPPER'),
   deps='replace')
 
diff --git a/lib/uid_wrapper/wscript_build b/lib/uid_wrapper/wscript_build
index 2cb9868..54e5b80 100644
--- a/lib/uid_wrapper/wscript_build
+++ b/lib/uid_wrapper/wscript_build
@@ -4,6 +4,7 @@
 bld.SAMBA_LIBRARY('uid_wrapper',
   source='uid_wrapper.c',
   deps='talloc',
-  private_library=True
+  private_library=True,
+  enabled=bld.CONFIG_SET("UID_WRAPPER"),
   )
 
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 573b361..199555b 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -44,7 +44,7 @@ bld.SAMBA_MODULE('KCC_SRV',
)
 
 
-bld.SAMBA_MODULE('DNS_UPDATE_SRV',
+bld.SAMBA_MODULE('dns_update_srv',
source='dns/dns_update.c',
subsystem='service',
init_function='server_service_dnsupdate_init',


-- 
Samba Shared Repository


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  36bdf3c Support removing builds.
  from  c155466 Remove some unncessary indirects.

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


- Log -
commit 36bdf3c446ad9100ef78e6a62449b4e339176458
Author: Jelmer Vernooij 
Date:   Fri Nov 12 11:20:15 2010 +0100

Support removing builds.

---

Summary of changes:
 buildfarm/data.py|5 +
 buildfarm/tests/test_data.py |7 +++
 import-and-analyse.py|1 +
 3 files changed, 13 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 26f2775..9f982db 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -177,6 +177,11 @@ class Build(object):
 self.compiler = compiler
 self.rev = rev
 
+def remove(self):
+os.unlink(self.basename + ".log")
+if os.path.exists(self.basename+".err"):
+os.unlink(self.basename+".err")
+
 ###
 # the mtime age is used to determine if builds are still happening
 # on a host.
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 0559f8e..43451da 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -40,6 +40,13 @@ class BuildResultStoreTestBase(object):
 self.x.build_fname("mytree", "myhost", "cc", 123),
 "%s/data/oldrevs/build.mytree.myhost.cc-123" % self.path)
 
+def test_build_remove(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", "12")
+build = self.x.get_build("tdb", "charis", "cc", "12")
+build.remove()
+self.assertFalse(os.path.exists(path))
+self.assertRaises(data.NoSuchBuildError, self.x.get_build, "tdb", 
"charis", "cc", "12")
+
 def test_build_age_mtime(self):
 path = self.create_mock_logfile("tdb", "charis", "cc", "12")
 # Set mtime to something in the past
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 3a77f77..c468a82 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -103,5 +103,6 @@ for build in buildfarm.get_new_builds():
 prev_build = buildfarm.get_build(build.tree, build.host, 
build.compiler, prev_rev)
 check_and_send_mails(build.tree, build.host, build.compiler, build, 
prev_build)
 
+build.remove()
 
 smtp.quit()


-- 
build.samba.org


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

2010-11-12 Thread Jelmer Vernooij
The branch, master has been updated
   via  c155466 Remove some unncessary indirects.
   via  cceb98b Implement diff.
   via  95015a7 Simplify history walking.
   via  10c6a03 work on history support using dulwich
  from  c1e3f3d print the return code value as it can help debug

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


- Log -
commit c1554666b2da05a03aeca52a4c4ab0498a2c9e90
Author: Jelmer Vernooij 
Date:   Fri Nov 12 10:17:37 2010 +0100

Remove some unncessary indirects.

commit cceb98be07ee509d8560dfb4e3a16796514aa584
Author: Jelmer Vernooij 
Date:   Fri Nov 12 09:56:41 2010 +0100

Implement diff.

commit 95015a7c09f04af4b7a717cf8277db960f32b7b8
Author: Jelmer Vernooij 
Date:   Fri Nov 12 09:45:33 2010 +0100

Simplify history walking.

commit 10c6a0392671f0c4022c4b4decc2399c1d4a2e33
Author: Jelmer Vernooij 
Date:   Fri Nov 12 02:50:29 2010 +0100

work on history support using dulwich

---

Summary of changes:
 buildfarm/__init__.py   |4 +
 buildfarm/history.py|  143 +--
 buildfarm/tests/test_history.py |   32 -
 import-and-analyse.py   |   90 +
 web/build.py|  113 ++-
 5 files changed, 180 insertions(+), 202 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 3bbfe4f..d866db4 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -34,6 +34,10 @@ class Tree(object):
 self.srcdir = srcdir
 self.scm = scm
 
+def get_branch(self):
+from buildfarm.history import GitBranch
+return GitBranch(self.repo, self.branch)
+
 def __repr__(self):
 return "<%s %r>" % (self.__class__.__name__, self.name)
 
diff --git a/buildfarm/history.py b/buildfarm/history.py
index 6ca1af8..537ce48 100644
--- a/buildfarm/history.py
+++ b/buildfarm/history.py
@@ -19,81 +19,92 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+from cStringIO import StringIO
 
-from buildfarm import util
+from dulwich.objects import Tree
+from dulwich.patch import write_blob_diff
+from dulwich.repo import Repo
 
-import commands
-import os
 
-BASEDIR = "/home/build/master"
-HISTORYDIR = "/home/build/master/cache"
-TIMEZONE = "PST"
-TIMEOFFSET = 0
-UNPACKED_DIR = "/home/ftp/pub/unpacked"
+class Branch(object):
 
-class History(object):
+def authors(self):
+ret = set()
+for rev in self.log():
+ret.add(rev.author)
+return ret
 
-def __init__(self, db):
-self.db = db
+def log(self):
+raise NotImplementedError(self.log)
 
-def _log(self, tree):
-return util.LoadStructure(os.path.join(HISTORYDIR, "history.%s" % 
tree))
+def diff(self, revision):
+raise NotImplementedError(self.diff)
 
-def diff(self, author, date, tree, revision):
-"""get recent git entries"""
-# validate the tree
-t = self.db.trees[tree]
 
-if t.scm == "git":
-self._git_diff(t, revision, tree)
-else:
-raise Exception("Unknown VCS %s" % t.scm)
+class Revision(object):
+
+def __init__(self, revision, date, author, message, modified=[], added=[], 
removed=[]):
+self.revision = revision
+self.date = date
+self.author = author
+self.message = message
+self.modified = modified
+self.added = added
+self.removed = removed
 
-def _git_diff(self, t, revision, tree):
-"""show recent git entries"""
 
-log = self._log(tree)
+class GitBranch(object):
 
-# backwards? why? well, usually our users are looking for the newest
-# stuff, so it's most likely to be found sooner
-for i in range(len(log), 0, -1):
-if log[i]["REVISION"] == revision:
-entry = log[i]
-break
+def __init__(self, path, branch="master"):
+self.repo = Repo(path)
+self.store = self.repo.object_store
+self.branch = branch
+
+def _changes_for(self, commit):
+if len(commit.parents) == 0:
+parent_tree = Tree().id
+else:
+parent_tree = self.store[commit.parents[0]].tree
+return self.store.tree_changes(parent_tree, commit.tree)
+
+def _revision_from_commit(self, commit):
+added = set()
+modified = set()
+removed = set()
+for ((oldpath, newpath), (oldmode, newmode), (oldsha, newsha)) in 
self._changes_for(commit):
+if old

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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  ed1f580 Test upload_build.
  from  0d80220 Add tests for BuildFarm.get_build().

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


- Log -
commit ed1f580fed5b2ca31fb0d879efdd291b4859084f
Author: Jelmer Vernooij 
Date:   Fri Nov 12 00:21:28 2010 +0100

Test upload_build.

---

Summary of changes:
 buildfarm/__init__.py|8 ++--
 buildfarm/data.py|   34 +++---
 buildfarm/tests/test_data.py |   15 +++
 3 files changed, 40 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index fdb197c..3bbfe4f 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -39,7 +39,11 @@ class Tree(object):
 
 
 def read_trees_from_conf(path):
-"""Read trees from a configuration file."""
+"""Read trees from a configuration file.
+
+:param path: tree path
+:return: Dictionary with trees
+"""
 ret = {}
 cfp = ConfigParser.ConfigParser()
 cfp.readfp(open(path))
@@ -182,5 +186,5 @@ class CachingBuildFarm(BuildFarm):
 
 perc = super(CachingBuildFarm, self).lcov_status(tree)
 if not self.readonly:
-util.FileSave(cachefile, ret)
+util.FileSave(cachefile, perc)
 return perc
diff --git a/buildfarm/data.py b/buildfarm/data.py
index 0e09b13..26f2775 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -169,16 +169,13 @@ class Build(object):
 """A single build of a tree on a particular host using a particular 
compiler.
 """
 
-def __init__(self, store, tree, host, compiler, rev=None):
+def __init__(self, store, basename, tree, host, compiler, rev=None):
 self._store = store
+self.basename = basename
 self.tree = tree
 self.host = host
 self.compiler = compiler
 self.rev = rev
-if rev is None:
-self.basename = self._store.build_fname(self.tree, self.host, 
self.compiler)
-else:
-self.basename = self._store.build_fname(self.tree, self.host, 
self.compiler, self.rev)
 
 ###
 # the mtime age is used to determine if builds are still happening
@@ -365,10 +362,11 @@ class UploadBuildResultStore(object):
 return False
 
 def get_build(self, tree, host, compiler):
-logf = self.build_fname(tree, host, compiler) + ".log"
+basename = self.build_fname(tree, host, compiler)
+logf = "%s.log" % basename
 if not os.path.exists(logf):
 raise NoSuchBuildError(tree, host, compiler)
-return Build(self, tree, host, compiler)
+return Build(self, basename, tree, host, compiler)
 
 
 class CachingUploadBuildResultStore(UploadBuildResultStore):
@@ -386,10 +384,11 @@ class 
CachingUploadBuildResultStore(UploadBuildResultStore):
 return os.path.join(self.cachedir, "build.%s.%s.%s" % (tree, host, 
compiler))
 
 def get_build(self, tree, host, compiler):
-logf = self.build_fname(tree, host, compiler) + ".log"
+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, tree, host, compiler)
+return CachingBuild(self, basename, tree, host, compiler)
 
 
 class BuildResultStore(object):
@@ -403,10 +402,11 @@ class BuildResultStore(object):
 self.path = path
 
 def get_build(self, tree, host, compiler, rev):
-logf = self.build_fname(tree, host, compiler, rev) + ".log"
+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 Build(self, tree, host, compiler, rev)
+return Build(self, basename, tree, host, compiler, rev)
 
 def build_fname(self, tree, host, compiler, rev):
 """get the name of the build file"""
@@ -442,10 +442,13 @@ class BuildResultStore(object):
 if commit_rev is not None:
 rev = commit_rev
 
+if not rev:
+raise Exception("Unable to find revision in %r log" % build)
+
 new_basename = self.build_fname(build.tree, build.host, 
build.compiler, rev)
-os.rename(build.basename+".log", new_basename+".log")
+os.link(build.basename+".log", new_basename+".log")
 if os.path.exists(build.basename+".err"):
-os.rename(build.bas

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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  0d80220 Add tests for BuildFarm.get_build().
  from  d3fe741 Test both cache and non-cache versions.

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


- Log -
commit 0d802201adfe505c31eb4b32be3e3d8337d692cd
Author: Jelmer Vernooij 
Date:   Thu Nov 11 23:24:28 2010 +0100

Add tests for BuildFarm.get_build().

---

Summary of changes:
 buildfarm/tests/test_buildfarm.py |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/tests/test_buildfarm.py 
b/buildfarm/tests/test_buildfarm.py
index 4cec0b7..86e249a 100644
--- a/buildfarm/tests/test_buildfarm.py
+++ b/buildfarm/tests/test_buildfarm.py
@@ -93,6 +93,24 @@ class BuildFarmTestBase(object):
 self.assertEquals("git://foo", tree.repo)
 self.assertEquals("master", tree.branch)
 
+def test_get_build_rev(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", "12",
+contents="This is what a log file looks like.")
+build = self.x.get_build("tdb", "charis", "cc", "12")
+self.assertEquals("tdb", build.tree)
+self.assertEquals("charis", build.host)
+self.assertEquals("cc", build.compiler)
+self.assertEquals("12", build.rev)
+
+def test_get_build_no_rev(self):
+path = self.create_mock_logfile("tdb", "charis", "cc", 
+contents="This is what a log file looks like.")
+build = self.x.get_build("tdb", "charis", "cc")
+self.assertEquals("tdb", build.tree)
+self.assertEquals("charis", build.host)
+self.assertEquals("cc", build.compiler)
+self.assertIs(None, build.rev)
+
 
 class BuildFarmTests(BuildFarmTestBase, BuildFarmTestCase):
 


-- 
build.samba.org


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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  d3fe741 Test both cache and non-cache versions.
  from  6043bed Test both BuildFarm and CachingBuildFarm.

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


- Log -
commit d3fe741c17f8401ae5dfe1d1fcd10992405ed7e7
Author: Jelmer Vernooij 
Date:   Thu Nov 11 23:19:30 2010 +0100

Test both cache and non-cache versions.

---

Summary of changes:
 buildfarm/tests/test_data.py |   66 +
 1 files changed, 46 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index d576fb3..9a5f867 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -17,7 +17,6 @@
 
 from cStringIO import StringIO
 import os
-import tempfile
 import testtools
 import time
 import unittest
@@ -34,25 +33,13 @@ class NonexistantTests(unittest.TestCase):
 Exception, data.BuildResultStore, "somedirthatdoesn'texist", None)
 
 
-class BuildResultStoreTests(BuildFarmTestCase):
-
-def setUp(self):
-super(BuildResultStoreTests, self).setUp()
-
-self.x = data.CachingBuildResultStore(
-os.path.join(self.path, "data", "oldrevs"),
-os.path.join(self.path, "cache"))
+class BuildResultStoreTestBase(object):
 
 def test_build_fname(self):
 self.assertEquals(
 self.x.build_fname("mytree", "myhost", "cc", 123),
 "%s/data/oldrevs/build.mytree.myhost.cc-123" % self.path)
 
-def test_cache_fname(self):
-self.assertEquals(
-self.x.cache_fname("mytree", "myhost", "cc", 123),
-"%s/cache/build.mytree.myhost.cc-123" % self.path)
-
 def test_build_age_mtime(self):
 path = self.create_mock_logfile("tdb", "charis", "cc", "12")
 # Set mtime to something in the past
@@ -119,6 +106,31 @@ error3""")
 self.assertEquals(3, build.err_count())
 
 
+
+class BuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
+
+def setUp(self):
+super(BuildResultStoreTests, self).setUp()
+
+self.x = data.BuildResultStore(
+os.path.join(self.path, "data", "oldrevs"))
+
+
+class CachingBuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
+
+def setUp(self):
+super(CachingBuildResultStoreTests, self).setUp()
+
+self.x = data.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)
+
+
 class BuildStatusFromLogs(testtools.TestCase):
 
 def parse_logs(self, log, err):
@@ -252,21 +264,35 @@ class BuildStatusTest(testtools.TestCase):
 self.assertEquals(cmp(d, e), -1)
 
 
-class UploadBuildResultStoreTests(BuildFarmTestCase):
+class UploadBuildResultStoreTestBase(object):
+
+def test_build_fname(self):
+self.assertEquals(
+self.x.build_fname("mytree", "myhost", "cc"),
+"%s/data/upload/build.mytree.myhost.cc" % self.path)
+
+
+class 
UploadBuildResultStoreTests(UploadBuildResultStoreTestBase,BuildFarmTestCase):
 
 def setUp(self):
 super(UploadBuildResultStoreTests, self).setUp()
 
+self.x = data.UploadBuildResultStore(
+os.path.join(self.path, "data", "upload"))
+
+
+class 
CachingUploadBuildResultStoreTests(UploadBuildResultStoreTestBase,BuildFarmTestCase):
+
+def setUp(self):
+super(CachingUploadBuildResultStoreTests, self).setUp()
+
 self.x = data.CachingUploadBuildResultStore(
 os.path.join(self.path, "data", "upload"),
 os.path.join(self.path, "cache"))
 
-def test_build_fname(self):
-self.assertEquals(
-self.x.build_fname("mytree", "myhost", "cc"),
-"%s/data/upload/build.mytree.myhost.cc" % self.path)
-
 def test_cache_fname(self):
 self.assertEquals(
 self.x.cache_fname("mytree", "myhost", "cc"),
 "%s/cache/build.mytree.myhost.cc" % self.path)
+
+


-- 
build.samba.org


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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  6043bed Test both BuildFarm and CachingBuildFarm.
  from  3de05b3 Add some more base buildfarm tests.

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


- Log -
commit 6043bede719fb9eebab45f22e2fd1b51fee94981
Author: Jelmer Vernooij 
Date:   Thu Nov 11 22:59:47 2010 +0100

Test both BuildFarm and CachingBuildFarm.

---

Summary of changes:
 buildfarm/tests/test_buildfarm.py |   21 ++---
 1 files changed, 18 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/tests/test_buildfarm.py 
b/buildfarm/tests/test_buildfarm.py
index 9132445..4cec0b7 100644
--- a/buildfarm/tests/test_buildfarm.py
+++ b/buildfarm/tests/test_buildfarm.py
@@ -17,6 +17,7 @@
 
 from buildfarm import (
 BuildFarm,
+CachingBuildFarm,
 data,
 read_trees_from_conf,
 )
@@ -73,13 +74,11 @@ branch = HEAD
 "git")
 
 
-class BuildFarmTests(BuildFarmTestCase):
+class BuildFarmTestBase(object):
 
 def setUp(self):
-super(BuildFarmTests, self).setUp()
 self.write_compilers(["cc"])
 self.write_trees({"trivial": { "scm": "git", "repo": "git://foo", 
"branch": "master" }})
-self.x = BuildFarm(self.path)
 
 def test_get_new_builds_empty(self):
 self.assertEquals([], list(self.x.get_new_builds()))
@@ -93,3 +92,19 @@ class BuildFarmTests(BuildFarmTestCase):
 self.assertEquals("git", tree.scm)
 self.assertEquals("git://foo", tree.repo)
 self.assertEquals("master", tree.branch)
+
+
+class BuildFarmTests(BuildFarmTestBase, BuildFarmTestCase):
+
+def setUp(self):
+BuildFarmTestCase.setUp(self)
+BuildFarmTestBase.setUp(self)
+self.x = BuildFarm(self.path)
+
+
+class CachingBuildFarmTests(BuildFarmTestBase, BuildFarmTestCase):
+
+def setUp(self):
+BuildFarmTestCase.setUp(self)
+BuildFarmTestBase.setUp(self)
+self.x = CachingBuildFarm(self.path)


-- 
build.samba.org


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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  3de05b3 Add some more base buildfarm tests.
   via  23a0e49 Fix caching buildfarm.
   via  324bb02 make import-and-analyse executable.
  from  46d2d55 Reintroduce readonly parameter, remove unnecessary code.

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


- Log -
commit 3de05b3e869488cf6d8eb395a3086377254e3c35
Author: Jelmer Vernooij 
Date:   Thu Nov 11 22:56:15 2010 +0100

Add some more base buildfarm tests.

commit 23a0e4992b633a6e44c0dcfdf24702e2456b4e4a
Author: Jelmer Vernooij 
Date:   Thu Nov 11 22:41:46 2010 +0100

Fix caching buildfarm.

commit 324bb026c566f8ea0e796adaccf584e7bb8e7d23
Author: Jelmer Vernooij 
Date:   Thu Nov 11 22:38:35 2010 +0100

make import-and-analyse executable.

---

Summary of changes:
 buildfarm/__init__.py |   21 
 buildfarm/tests/__init__.py   |   63 
 buildfarm/tests/test_buildfarm.py |   95 +
 3 files changed, 106 insertions(+), 73 deletions(-)
 create mode 100644 buildfarm/tests/test_buildfarm.py
 mode change 100644 => 100755 import-and-analyse.py


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index ea5ecbd..fdb197c 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -49,6 +49,7 @@ def read_trees_from_conf(path):
 
 
 def lcov_extract_percentage(text):
+"""Extract the coverage percentage from the lcov file."""
 m = re.search('\Code\ \;covered\:\<\/td\>.*?\n.*?\([0-9.]+) \%', text)
 if m:
 return m.group(1)
@@ -102,7 +103,7 @@ class BuildFarm(object):
 file = os.path.join(self.lcovdir, self.LCOVHOST, tree, "index.html")
 try:
 lcov_html = util.FileLoad(file)
-except OSError:
+except (OSError, IOError):
 # File does not exist
 raise data.NoSuchBuildError(tree, self.LCOVHOST, "lcov")
 
@@ -136,30 +137,30 @@ class BuildFarm(object):
 class CachingBuildFarm(BuildFarm):
 
 def __init__(self, path=None, readonly=False, cachedirname=None):
+self._cachedirname = cachedirname
+self.readonly = readonly
 super(CachingBuildFarm, self).__init__(path)
 
-if cachedirname:
-self.cachedir = os.path.join(self.path, cachedirname)
+def _get_cachedir(self):
+if self._cachedirname is not None:
+return os.path.join(self.path, self._cachedirname)
 else:
-self.cachedir = os.path.join(self.path, "cache")
-self.builds = self._open_build_results()
-self.upload_builds = self._open_upload_build_results()
-self.readonly = readonly
+return os.path.join(self.path, "cache")
 
 def _open_build_results(self):
 from buildfarm import data
 return data.CachingBuildResultStore(os.path.join(self.path, "data", 
"oldrevs"),
-self.cachedir, reaodnly=self.readonly)
+self._get_cachedir(), readonly=self.readonly)
 
 def _open_upload_build_results(self):
 from buildfarm import data
 return data.CachingUploadBuildResultStore(os.path.join(self.path, 
"data", "upload"),
-self.cachedir, readonly=self.readonly)
+self._get_cachedir(), readonly=self.readonly)
 
 def lcov_status(self, tree):
 """get status of build"""
 from buildfarm import data, util
-cachefile = os.path.join(self.cachedir,
+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:
diff --git a/buildfarm/tests/__init__.py b/buildfarm/tests/__init__.py
index c414bb1..65912f8 100644
--- a/buildfarm/tests/__init__.py
+++ b/buildfarm/tests/__init__.py
@@ -15,13 +15,10 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-from buildfarm import BuildFarm
-
 import os
 from testtools import TestCase
 import shutil
 import tempfile
-import testtools
 
 
 class BuildFarmTestCase(TestCase):
@@ -78,63 +75,3 @@ class BuildFarmTestCase(TestCase):
 def tearDown(self):
 shutil.rmtree(self.path)
 super(BuildFarmTestCase, self).tearDown()
-
-
-class ReadTreesFromConfTests(testtools.TestCase):
-
-def create_file(self, contents):
-(fd, path) = tempfile.mkstemp()
-f = os.fdopen(fd, 'w')
-self.addCleanup(os.remove, path)
-try:
-f.write(contents)
-finally:
-  

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

2010-11-11 Thread Jelmer Vernooij
The branch, master has been updated
   via  46d2d55 Reintroduce readonly parameter, remove unnecessary code.
  from  d67fc5a Use the correct form for cmp

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


- Log -
commit 46d2d555c366289981592c9b3e9df75d9f2b84c3
Author: Jelmer Vernooij 
Date:   Thu Nov 11 22:17:21 2010 +0100

Reintroduce readonly parameter, remove unnecessary code.

---

Summary of changes:
 buildfarm/__init__.py |   22 +++---
 1 files changed, 7 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 51d4968..ea5ecbd 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -135,30 +135,26 @@ class BuildFarm(object):
 
 class CachingBuildFarm(BuildFarm):
 
-def __init__(self, path=None, cachedirname=None):
-self.cachedir = None
+def __init__(self, path=None, readonly=False, cachedirname=None):
 super(CachingBuildFarm, self).__init__(path)
 
 if cachedirname:
 self.cachedir = os.path.join(self.path, cachedirname)
 else:
-self.cachedir = os.path.join(self.path, "cache2")
+self.cachedir = os.path.join(self.path, "cache")
 self.builds = self._open_build_results()
 self.upload_builds = self._open_upload_build_results()
+self.readonly = readonly
 
 def _open_build_results(self):
 from buildfarm import data
-if not self.cachedir:
-return
 return data.CachingBuildResultStore(os.path.join(self.path, "data", 
"oldrevs"),
-self.cachedir)
+self.cachedir, reaodnly=self.readonly)
 
 def _open_upload_build_results(self):
 from buildfarm import data
-if not self.cachedir:
-return
 return data.CachingUploadBuildResultStore(os.path.join(self.path, 
"data", "upload"),
-self.cachedir)
+self.cachedir, readonly=self.readonly)
 
 def lcov_status(self, tree):
 """get status of build"""
@@ -183,11 +179,7 @@ class CachingBuildFarm(BuildFarm):
 return None
 return ret
 
-lcov_html = util.FileLoad(file)
-perc = lcov_extract_percentage(lcov_html)
-if perc is None:
-ret = ""
-else:
-ret = perc
+perc = super(CachingBuildFarm, self).lcov_status(tree)
+if not self.readonly:
 util.FileSave(cachefile, ret)
 return perc


-- 
build.samba.org


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

2010-11-10 Thread Jelmer Vernooij
The branch, master has been updated
   via  e7f5f8b Move lcov cache onto BuildFarm, simplify get_build.
  from  a6951b8 desactivate history for the moment (it's broken)

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


- Log -
commit e7f5f8bd5485ef4b1a742b6b64aa0cb49008ce01
Author: Jelmer Vernooij 
Date:   Thu Nov 11 01:50:54 2010 +0100

Move lcov cache onto BuildFarm, simplify get_build.

---

Summary of changes:
 buildfarm/__init__.py |   20 +---
 buildfarm/data.py |8 
 2 files changed, 5 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 118a729..85690e3 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -66,6 +66,7 @@ class BuildFarm(object):
 if path is None:
 path = os.path.abspath(os.path.join(os.path.dirname(__file__), 
".."))
 self.path = path
+self.cachedir = os.path.join(self.path, "cache")
 self.webdir = os.path.join(self.path, "web")
 if not os.path.isdir(path):
 raise Exception("web directory %s does not exist" % self.webdir)
@@ -99,7 +100,8 @@ class BuildFarm(object):
 def lcov_status(self, tree):
 """get status of build"""
 from buildfarm import data, util
-cachefile = self.builds.get_lcov_cached_status(self.LCOVHOST, tree)
+cachefile = os.path.join(self.cachedir, "lcov.%s.%s.status" % (
+self.LCOVHOST, tree))
 file = os.path.join(self.lcovdir, self.LCOVHOST, tree, "index.html")
 try:
 st1 = os.stat(file)
@@ -130,21 +132,9 @@ class BuildFarm(object):
 
 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)
+return self.builds.get_build(tree, host, compiler, rev)
 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)
+return self.upload_builds.get_build(tree, host, compiler)
 
 def get_new_builds(self):
 from buildfarm import data
diff --git a/buildfarm/data.py b/buildfarm/data.py
index f709422..9f7708c 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -396,9 +396,6 @@ class BuildResultStore(object):
 """
 self.path = path
 
-def get_lcov_cached_status(self, host, tree):
-return None
-
 def get_build(self, tree, host, compiler, rev):
 logf = self.build_fname(tree, host, compiler, rev) + ".log"
 if not os.path.exists(logf):
@@ -479,8 +476,3 @@ class CachingBuildResultStore(BuildResultStore):
 
 def cache_fname(self, tree, host, compiler, rev):
 return os.path.join(self.cachedir, "build.%s.%s.%s-%s" % (tree, host, 
compiler, rev))
-
-def get_lcov_cached_status(self, host, tree):
-return os.path.join(self.cachedir, "lcov.%s.%s.status" % (host, tree))
-
-


-- 
build.samba.org


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

2010-11-10 Thread Jelmer Vernooij
The branch, master has been updated
   via  4db119b We no longer have CVS-based projects, and should not 
introduce any newer; remove cvslog.pl.
  from  211abe8 More improvements to import-and-analyse.

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


- Log -
commit 4db119b01c2f86fbff7829d40c2ed45309f2c6a9
Author: Jelmer Vernooij 
Date:   Wed Nov 10 11:26:30 2010 +0100

We no longer have CVS-based projects, and should not introduce any newer; 
remove cvslog.pl.

---

Summary of changes:
 cvslog.pl |  282 -
 1 files changed, 0 insertions(+), 282 deletions(-)
 delete mode 100755 cvslog.pl


Changeset truncated at 500 lines:

diff --git a/cvslog.pl b/cvslog.pl
deleted file mode 100755
index 11d559e..000
--- a/cvslog.pl
+++ /dev/null
@@ -1,282 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Extract information about recent CVS commits
-#
-# tri...@samba.org, April 2001
-
-use strict;
-use util;
-use POSIX;
-use Data::Dumper;
-use File::stat;
-use Date::Parse;
-
-
-# parse a CVS date 
-sub cvs_parse_date($)
-{
-my $s = shift;
-
-if (! ($s =~ /@/)) {
-  return str2time($s);
-}
-
-if ($s =~ /(.*) (.*) ([0-9]+), ([0-9]+) @ ([0-9]+):([0-9]+)/) {
-   my $day = $1;
-   my $month = $2;
-   my $mday = $3;
-   my $year = $4;
-   my $hour = $5;
-   my $min = $6;
-   my (%months) = ('January' => 1, 'February' => 2, 'March' => 3, 'April' 
=> 4,
-   'May' => 5, 'June' => 6, 'July' => 7, 'August' => 8, 
'September' => 9,
-   'October' => 10, 'November' => 11, 'December' => 12);
-   my $t = mktime(0, $min, $hour, $mday, $months{$month}-1, $year-1900);
-   return $t;
-}
-
-print "ERROR: bad date format $s\n";
-return 0;
-}
-
-
-
-# push an entry onto the array
-
-# FIXME: This incorrectly handles multiple commits with the same log
-# message.  The cvslog output only shows the revisions for the last
-# commit, but actually we want to either not coalesce, or show the
-# overall delta.
-
-sub push_entry($)
-{
-  my $entry = shift;
-  my $log = shift;
-  my $days = shift;
-  my $tree = shift;
-  my $tag = shift;
-  my $lastentry = $log->[$#{$log}];
-
-  if ($lastentry->{DATE} && $lastentry->{AUTHOR} &&
-  ($lastentry->{DATE} > $entry->{DATE}-600) &&
-  ($lastentry->{AUTHOR} eq $entry->{AUTHOR}) &&
-  ((!$lastentry->{TAG} && !$entry->{TAG}) ||
-   ($lastentry->{TAG} eq $entry->{TAG})) &&
-  ((!$lastentry->{MESSAGE} && !$entry->{MESSAGE}) ||
-   ($lastentry->{MESSAGE} eq $entry->{MESSAGE}))) {
-
-if (exists $lastentry->{FILES}) {
-  $lastentry->{FILES} .= " $entry->{FILES}";
-} else {
-  $lastentry->{FILES} = $entry->{FILES};
-}
-
-if (exists $lastentry->{ADDED}) {
-  $lastentry->{ADDED} .= " $entry->{ADDED}";
-} else {
-  $lastentry->{ADDED} = $entry->{ADDED};
-}
-
-if (exists $lastentry->{REMOVED}) {
-  $lastentry->{REMOVED} .= " $entry->{REMOVED}";
-} else {
-  $lastentry->{REMOVED} = $entry->{REMOVED};
-}
-
-if (exists $lastentry->{REVISIONS}) {
-   $lastentry->{REVISIONS} = 
{%{$lastentry->{REVISIONS}},%{$entry->{REVISIONS}}};
-} else {
-   $lastentry->{REVISIONS} = $entry->{REVISIONS};
-}
-  } else {
-if (($entry->{DATE} > time() - $days*24*60*60) &&
-   ((!$entry->{TAG} && !$tag) || 
-($entry->{TAG} eq $tag)) &&
-   ($entry->{TREE} eq $tree)) {
-  push(@{$log}, $entry);
-}
-  }
-  return $log;
-}
-
-
-# return an array of logfile entries given a cvs log file. 
-# Only return entries newer than $days old
-sub cvs_parse()
-{
-my $file = shift;
-my $days = shift;
-my $tree = shift;
-my $tag = shift;
-my $log;
-my $entry;
-
-open(FILE, "< $file");
-while () {
-   my $line = $_;
-
-   # ignore separator lines
-   if ($line =~ /^[*]+/) { next; }
-
-   if ($line =~ /^Date:\s*(.*)/) {
-   if ($entry->{DATE}) {
- $log = push_entry($entry, $log, $days, $tree, $tag);
-   }
-   $entry = {};
-   $entry->{DATE} = cvs_parse_date($1);
-   $entry->{DIR} = "";
-   next;
-   }
-
-   if ($line =~ /^Author:\s*(.*)/) {
-   $entry->

<    1   2   3   4   5   6   7   8   9   10   >