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

Jelmer Vernooij jelmer at samba.org
Wed Nov 17 03:18:30 MST 2010


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 <jelmer at samba.org>
Date:   Wed Nov 17 11:17:41 2010 +0100

    Get rid of some unicode.

commit e4f96367b2b828953b357827fe28fedc645f911b
Author: Jelmer Vernooij <jelmer at samba.org>
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 <build at samba.org>""" % 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="owner")
     owner_email = Unicode()
     password = Unicode()
@@ -111,7 +111,8 @@ 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()
@@ -129,7 +130,7 @@ class StormHostDatabase(HostDatabase):
         return self.store.find(StormHost).order_by(StormHost.name)
 
     def host(self, name):
-        ret = self.store.find(StormHost, StormHost.name==unicode(name)).one()
+        ret = self.store.find(StormHost, StormHost.name==name).one()
         if ret is None:
             raise NoSuchHost(name)
         return ret
@@ -153,18 +154,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 NoSuchBuildError(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,
             StormBuild.id < cur_build.id)
         result = result.order_by(Desc(StormBuild.id))
@@ -175,9 +176,9 @@ class StormCachingBuildResultStore(BuildResultStore):
 
     def get_latest_revision(self, tree, host, compiler):
         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)
         result = result.order_by(Desc(StormBuild.id))
         build = result.first()
         if build is None:
@@ -200,19 +201,19 @@ 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, build.tree, build.host,
+            build.compiler, rev)
         new_build.checksum = build.log_checksum()
         new_build.age = build.age
-        new_build.status_str = unicode(build.status().__serialize__())
+        new_build.status_str = build.status().__serialize__()
         self.store.add(new_build)
         return new_build
 
     def get_old_revs(self, tree, host, compiler):
         return self.store.find(StormBuild,
-            StormBuild.tree == unicode(tree),
-            StormBuild.host == unicode(host),
-            StormBuild.compiler == unicode(compiler)).order_by(Desc(StormBuild.age))
+            StormBuild.tree == tree,
+            StormBuild.host == host,
+            StormBuild.compiler == compiler).order_by(Desc(StormBuild.age))
 
 
 class StormCachingBuildFarm(BuildFarm):
@@ -249,7 +250,7 @@ class StormCachingBuildFarm(BuildFarm):
     def get_last_builds(self, tree=None):
         extra_expr = []
         if tree is not None:
-            extra_expr.append(StormBuild.tree == unicode(tree))
+            extra_expr.append(StormBuild.tree == tree)
         return self._get_store().find(StormBuild, *extra_expr)
 
     def commit(self):
@@ -257,9 +258,9 @@ class StormCachingBuildFarm(BuildFarm):
 
 
 def setup_schema(db):
-    db.execute("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);", noresult=True)
+    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 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 text, revision text, host text, compiler text, checksum text, age int, status text, commit_revision text);", 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)
 
 
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 87e8dc9..4ed8a16 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -134,7 +134,7 @@ BUILD COMMIT REVISION: myrev
 
     def test_get_old_revs_none(self):
         self.assertEquals([],
-            list(self.x.get_old_revs(u"tdb", u"charis", u"gcc")))
+            list(self.x.get_old_revs("tdb", "charis", "gcc")))
 
     def test_get_old_revs(self):
         path = self.create_mock_logfile("tdb", "charis", "cc",
@@ -154,7 +154,7 @@ BUILD COMMIT REVISION: 15
 BUILD COMMIT REVISION: 15
 """)
         self.assertEquals([b1, b2],
-            list(self.x.get_old_revs(u"tdb", u"charis", u"cc")))
+            list(self.x.get_old_revs("tdb", "charis", "cc")))
 
 
 class BuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
diff --git a/buildfarm/tests/test_hostdb.py b/buildfarm/tests/test_hostdb.py
index ca406f4..f946080 100644
--- a/buildfarm/tests/test_hostdb.py
+++ b/buildfarm/tests/test_hostdb.py
@@ -23,7 +23,7 @@ import testtools
 class HostTests(testtools.TestCase):
 
     def test_create_simple(self):
-        host = hostdb.Host(name=u"foo")
+        host = hostdb.Host(name="foo")
         self.assertEquals(None, host.owner)
         self.assertEquals("foo", host.name)
 
@@ -36,41 +36,41 @@ class HostTests(testtools.TestCase):
 class HostDatabaseTests(object):
 
     def test_createhost(self):
-        self.db.createhost(u"charis", u"linux", u"Jelmer", u"jelmer at samba.org", u"bla", u"Pemrission?")
+        self.db.createhost("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_host(self):
-        newhost = self.db.createhost(u"charis", u"linux", u"Jelmer", u"jelmer at samba.org", u"bla", u"Pemrission?")
-        samehost = self.db.host(u"charis")
+        newhost = self.db.createhost("charis", u"linux", u"Jelmer", u"jelmer at samba.org", u"bla", u"Pemrission?")
+        samehost = self.db.host("charis")
         self.assertEquals(samehost, newhost)
 
     def test_create_already_exists(self):
-        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",
+        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",
             owner=u"Jelmer", owner_email=u"jelmer at samba.org")
 
     def test_delete(self):
-        host = self.db.createhost(name=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
-        self.db.deletehost(u"foo")
+        host = self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
+        self.db.deletehost("foo")
 
     def test_delete_doesntexist(self):
-        self.assertRaises(hostdb.NoSuchHost, self.db.deletehost, u"foo")
+        self.assertRaises(hostdb.NoSuchHost, self.db.deletehost, "foo")
 
     def test_update_platform(self):
-        host = self.db.createhost(name=u"foo", owner=u"Jelmer",
+        host = self.db.createhost(name="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=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org")
+        host = self.db.createhost(name="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=u"foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+        self.db.createhost(name="foo", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
             platform=u"Debian")
-        self.db.createhost(name=u"bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+        self.db.createhost(name="bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
             platform=u"Fedora")
         expected = [
             "foo: Debian\n",
@@ -81,8 +81,8 @@ class HostDatabaseTests(object):
         self.assertEquals(expected, got)
 
     def test_create_rsync_secrets(self):
-        self.db.createhost(name=u"foo")
-        self.db.createhost(name=u"bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
+        self.db.createhost(name="foo")
+        self.db.createhost(name="bla", owner=u"Jelmer", owner_email=u"jelmer at samba.org",
             platform=u"Fedora", password=u"o")
         expected = [
             "# rsyncd.secrets file\n",


-- 
build.samba.org


More information about the samba-cvs mailing list