[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Tue Nov 16 17:20:18 MST 2010
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 <jelmer at samba.org>
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 <build at samba.org>""" % 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 NoSuchBuildError(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,
StormBuild.id < cur_build.id)
result = result.order_by(Desc(StormBuild.id))
@@ -175,9 +175,9 @@ class StormCachingBuildResultStore(BuildResultStore):
def get_latest_revision(self, tree, host, compiler):
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))
result = result.order_by(Desc(StormBuild.id))
build = result.first()
if build is None:
@@ -200,11 +200,11 @@ 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, 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_str = build.status().__serialize__()
+ new_build.status_str = unicode(build.status().__serialize__())
self.store.add(new_build)
return new_build
diff --git a/buildfarm/tests/test_hostdb.py b/buildfarm/tests/test_hostdb.py
index a6f544d..f50c568 100644
--- a/buildfarm/tests/test_hostdb.py
+++ b/buildfarm/tests/test_hostdb.py
@@ -23,49 +23,49 @@ import testtools
class HostTests(testtools.TestCase):
def test_create_simple(self):
- host = hostdb.Host(name="foo")
+ host = hostdb.Host(name=u"foo")
self.assertEquals(None, host.owner)
self.assertEquals("foo", host.name)
def test_create_with_owner(self):
host = hostdb.Host(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
self.assertEquals((u"Jelmer", u"jelmer at samba.org"), host.owner)
- self.assertEquals("foo", host.name)
+ self.assertEquals(u"foo", host.name)
class HostDatabaseTests(object):
def test_createhost(self):
- self.db.createhost("charis", u"linux", u"Jelmer", u"jelmer at samba.org", u"bla", u"Pemrission?")
+ self.db.createhost(u"charis", u"linux", u"Jelmer", u"jelmer at samba.org", u"bla", u"Pemrission?")
hosts = list(self.db.hosts())
self.assertEquals(1, len(hosts))
self.assertEquals("charis", hosts[0].name)
def test_create_already_exists(self):
- host = self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
- self.assertRaises(hostdb.HostAlreadyExists, self.db.createhost, name="foo",
+ host = self.db.createhost(name=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
+ self.assertRaises(hostdb.HostAlreadyExists, self.db.createhost, name=u"foo",
owner=u"Jelmer", owner_email=u"jelmer at samba.org")
def test_delete(self):
- host = self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
- self.db.deletehost("foo")
+ host = self.db.createhost(name=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
+ self.db.deletehost(u"foo")
def test_delete_doesntexist(self):
- self.assertRaises(hostdb.NoSuchHost, self.db.deletehost, "foo")
+ self.assertRaises(hostdb.NoSuchHost, self.db.deletehost, u"foo")
def test_update_platform(self):
- host = self.db.createhost(name="foo", owner=u"Jelmer",
+ host = self.db.createhost(name=u"foo", owner=u"Jelmer",
owner_email=u"jelmer at samba.org")
host.update_platform(u"Debian")
def test_update_owner(self):
- host = self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
+ host = self.db.createhost(name=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
host.update_owner(new_owner=u"Matthieu", new_owner_email=u"mat at samba.org")
def test_create_hosts_list(self):
- self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+ self.db.createhost(name=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
platform=u"Debian")
- self.db.createhost(name="bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+ self.db.createhost(name=u"bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
platform=u"Fedora")
expected = [
"foo: Debian\n",
@@ -76,8 +76,8 @@ class HostDatabaseTests(object):
self.assertEquals(expected, got)
def test_create_rsync_secrets(self):
- self.db.createhost(name="foo")
- self.db.createhost(name="bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+ self.db.createhost(name=u"foo")
+ self.db.createhost(name=u"bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
platform=u"Fedora", password=u"o")
expected = [
"# rsyncd.secrets file\n",
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 6c2736f..2db0d05 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -617,7 +617,7 @@ class ViewRecentBuildsPage(BuildFarmPage):
for host in self.buildfarm.hostdb.hosts():
for compiler in self.buildfarm.compilers:
try:
- build = self.buildfarm.get_build(tree, host.name, compiler)
+ build = self.buildfarm.get_build(tree, host.name.encode("utf-8"), compiler)
status = build_status_html(myself, build)
except data.NoSuchBuildError:
pass
@@ -633,9 +633,9 @@ class ViewRecentBuildsPage(BuildFarmPage):
age_ctime,
host.platform.encode("utf-8"),
"<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>"
- % (myself, host.name,
- tree, compiler, host.name,
- host.name),
+ % (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])
@@ -677,7 +677,7 @@ class ViewHostPage(BuildFarmPage):
def _render_build_list_header(self, host):
yield "<div class='host summary'>"
yield "<a id='host' name='host'/>"
- yield "<h3>%s - %s</h3>" % (host, self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
+ yield "<h3>%s - %s</h3>" % (host.encode("utf-8"), self.buildfarm.hostdb.host(host).platform.encode("utf-8"))
yield "<table class='real'>"
yield "<thead><tr><th>Target</th><th>Build<br/>Revision</th><th>Build<br />Age</th><th>Status<br />config/build<br />install/test</th><th>Warnings</th></tr></thead>"
yield "<tbody>"
@@ -739,7 +739,7 @@ class ViewHostPage(BuildFarmPage):
"Tree", "Compiler", "Build Age", "Status", "Warnings")
for build in builds:
yield "%-12s %-10s %-10s %-10s %-10s\n" % (
- build.tree, build.compiler,
+ build.tree.encode("utf-8"), build.compiler.encode("utf-8"),
util.dhm_time(build.age_mtime()),
str(build.status()), build.err_count())
yield "\n"
@@ -911,7 +911,7 @@ class BuildFarmApp(object):
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()])
+ self.hosts = dict([(host.name.encode("utf-8"), host) for host in self.buildfarm.hostdb.hosts()])
def main_menu(self):
"""main page"""
--
build.samba.org
More information about the samba-cvs
mailing list