[llvm-commits] [LNT] r163168 - in /lnt/trunk/lnt/server/db: migrate.py util.py v4db.py
Michael Gottesman
mgottesman at apple.com
Tue Sep 4 19:42:57 PDT 2012
Ok.
On Sep 4, 2012, at 6:16 PM, Daniel Dunbar <daniel.dunbar at gmail.com> wrote:
> Instead of doing this, I'd rather just change the config loader to
> assert that all paths contain a DB specifier.
>
> - Daniel
>
>
> On Sep 4, 2012, at 14:58, Michael Gottesman <mgottesman at apple.com> wrote:
>
>> Author: mgottesman
>> Date: Tue Sep 4 16:54:58 2012
>> New Revision: 163168
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=163168&view=rev
>> Log:
>> [LNT] migrate.py, v4db.py: Updated code so that it assumes sqlite if
>> and only if the submitted path does not contain a db type.
>>
>> Added:
>> lnt/trunk/lnt/server/db/util.py
>> Modified:
>> lnt/trunk/lnt/server/db/migrate.py
>> lnt/trunk/lnt/server/db/v4db.py
>>
>> Modified: lnt/trunk/lnt/server/db/migrate.py
>> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrate.py?rev=163168&r1=163167&r2=163168&view=diff
>> ==============================================================================
>> --- lnt/trunk/lnt/server/db/migrate.py (original)
>> +++ lnt/trunk/lnt/server/db/migrate.py Tue Sep 4 16:54:58 2012
>> @@ -16,6 +16,8 @@
>> import sqlalchemy.orm
>> from sqlalchemy import Column, String, Integer
>>
>> +import lnt.server.db.util
>> +
>> ###
>> # Schema for in-database version information.
>>
>> @@ -218,11 +220,8 @@
>> logger.info("database auto-upgraded")
>>
>> def update_path(path):
>> - # If the path includes no database type, assume sqlite.
>> - #
>> - # FIXME: I would like to phase this out and force clients to propagate
>> - # paths, but it isn't a big deal.
>> - if not path.startswith('mysql://') and not path.startswith('sqlite://'):
>> + # If the path includes no database type, assume sqlite.
>> + if lnt.server.db.util.path_has_no_database_type(path):
>> path = 'sqlite:///' + path
>>
>> engine = sqlalchemy.create_engine(path)
>>
>> Added: lnt/trunk/lnt/server/db/util.py
>> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/util.py?rev=163168&view=auto
>> ==============================================================================
>> --- lnt/trunk/lnt/server/db/util.py (added)
>> +++ lnt/trunk/lnt/server/db/util.py Tue Sep 4 16:54:58 2012
>> @@ -0,0 +1,7 @@
>> +
>> +import re
>> +
>> +PATH_DATABASE_TYPE_RE = re.compile('\w+\:\/\/')
>> +
>> +def path_has_no_database_type(path):
>> + return PATH_DATABASE_TYPE_RE.match(path) is None
>>
>> Modified: lnt/trunk/lnt/server/db/v4db.py
>> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/v4db.py?rev=163168&r1=163167&r2=163168&view=diff
>> ==============================================================================
>> --- lnt/trunk/lnt/server/db/v4db.py (original)
>> +++ lnt/trunk/lnt/server/db/v4db.py Tue Sep 4 16:54:58 2012
>> @@ -6,6 +6,7 @@
>> import lnt.server.db.migrate
>>
>> from lnt.server.db import testsuite
>> +import lnt.server.db.util
>>
>> class V4DB(object):
>> """
>> @@ -60,10 +61,7 @@
>>
>> def __init__(self, path, echo=False):
>> # If the path includes no database type, assume sqlite.
>> - #
>> - # FIXME: I would like to phase this out and force clients to propagate
>> - # paths, but it isn't a big deal.
>> - if not path.startswith('mysql://') and not path.startswith('sqlite://'):
>> + if lnt.server.db.util.path_has_no_database_type(path):
>> path = 'sqlite:///' + path
>>
>> self.path = path
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list