Skip to content

Commit

Permalink
Merge Initial sqlalchemification
Browse files Browse the repository at this point in the history
* commit 'eda77ef44ad6d5b093279d3f5ac134e468a2e8ed':
  Initial sqlalchemification
  • Loading branch information
djmitche committed Dec 21, 2010
2 parents 98c7392 + eda77ef commit 6dfee06
Show file tree
Hide file tree
Showing 49 changed files with 1,731 additions and 2,248 deletions.
3 changes: 2 additions & 1 deletion master/MANIFEST.in
Expand Up @@ -8,13 +8,14 @@ include docs/Makefile
include docs/version.py
include docs/buildbot.1

include buildbot/db/schema/tables.sql
include buildbot/scripts/sample.cfg
include buildbot/status/web/files/*
include buildbot/status/web/templates/*.html buildbot/status/web/templates/*.xml
include buildbot/clients/debug.glade
include buildbot/buildbot.png

include buildbot/db/migrate/README

include contrib/* contrib/windows/* contrib/os-x/* contrib/css/*
include contrib/trac/* contrib/trac/bbwatcher/* contrib/trac/bbwatcher/templates/*
include contrib/init-scripts/*
9 changes: 9 additions & 0 deletions master/NEWS
Expand Up @@ -8,6 +8,15 @@ Major User visible changes in Buildbot. -*- outline -*-

* Buildbot 0.8.3 (December 19, 2010)

** SQLAlchemy & SQLAlchemy-Migrate

Buildbot now uses SQLAlchemy as a database abstraction layer. This will give
us greater inter-database compatibility and a more stable and reliable basis
for this core component of the framework. SQLAlchemy-Migrate is used to manage
changes to the database schema from version to version.

* Next Release

** PBChangeSource now supports authentication

PBChangeSource now supports the `user` and `passwd` arguments. Users with a
Expand Down
18 changes: 17 additions & 1 deletion master/buildbot/changes/changes.py
Expand Up @@ -219,7 +219,7 @@ def saveYourself(self):
# bytestrings in an old changes.pck into unicode strings
def recode_changes(self, old_encoding, quiet=False):
"""Processes the list of changes, with the change attributes re-encoded
as UTF-8 bytestrings"""
unicode objects"""
nconvert = 0
for c in self.changes:
# give revision special handling, in case it is an integer
Expand All @@ -235,6 +235,22 @@ def recode_changes(self, old_encoding, quiet=False):
except UnicodeDecodeError:
raise UnicodeError("Error decoding %s of change #%s as %s:\n%r" %
(attr, c.number, old_encoding, a))

# filenames are a special case, but in general they'll have the same encoding
# as everything else on a system. If not, well, hack this script to do your
# import!
newfiles = []
for filename in util.flatten(c.files):
if isinstance(filename, str):
try:
filename = filename.decode(old_encoding)
nconvert += 1
except UnicodeDecodeError:
raise UnicodeError("Error decoding filename '%s' of change #%s as %s:\n%r" %
(filename.decode('ascii', 'replace'),
c.number, old_encoding, a))
newfiles.append(filename)
c.files = newfiles
if not quiet:
print "converted %d strings" % nconvert

Expand Down
23 changes: 14 additions & 9 deletions master/buildbot/db/schema/base.py → master/buildbot/db/base.py
Expand Up @@ -13,15 +13,20 @@
#
# Copyright Buildbot Team Members

class Upgrader(object):
"""
Base classes for database handling
"""

def __init__(self, dbapi, conn, basedir, quiet=False):
self.dbapi = dbapi
self.conn = conn
self.basedir = basedir
self.quiet = quiet
class DBConnectorComponent(object):
"""
A fixed component of the DBConnector, handling one particular aspect of the
database. Instances of subclasses are assigned to attributes of the
DBConnector object, so that they are available at e.g., C{master.db.model}
or C{master.db.changes}. This parent class takes care of the necessary
backlinks and other housekeeping.
"""

self.dbapiName = dbapi.__name__
connector = None

def upgrade(self):
raise NotImplementedError
def __init__(self, connector):
self.connector = connector

0 comments on commit 6dfee06

Please sign in to comment.