Versioning the database -- automatic reindex
This commit is contained in:
parent
3fc1344865
commit
1bb7bfaf7f
2 changed files with 7 additions and 3 deletions
|
@ -248,15 +248,18 @@ def check(cond, msg):
|
|||
check('installs' in db, "No 'installs' in YAML DB.")
|
||||
check('version' in db, "No 'version' in YAML DB.")
|
||||
|
||||
|
||||
installs = db['installs']
|
||||
|
||||
# TODO: better version checking semantics.
|
||||
version = Version(db['version'])
|
||||
if version > _db_version:
|
||||
raise InvalidDatabaseVersionError(_db_version, version)
|
||||
elif version < _db_version:
|
||||
self.reindex(spack.install_layout)
|
||||
installs = dict((k, v.to_dict()) for k, v in self._data.items())
|
||||
|
||||
# Iterate through database and check each record.
|
||||
installs = db['installs']
|
||||
data = {}
|
||||
for hash_key, rec in installs.items():
|
||||
try:
|
||||
|
@ -293,6 +296,7 @@ def reindex(self, directory_layout):
|
|||
|
||||
"""
|
||||
with self.write_transaction():
|
||||
print "reindex"
|
||||
old_data = self._data
|
||||
try:
|
||||
self._data = {}
|
||||
|
|
|
@ -817,8 +817,8 @@ def from_node_dict(node):
|
|||
elif 'variants' in node:
|
||||
for name, value in node['variants'].items():
|
||||
spec.variants[name] = VariantSpec(name, value)
|
||||
for name in FlagMap.valid_compiler_flags():
|
||||
spec.compiler_flags[name] = []
|
||||
# for name in FlagMap.valid_compiler_flags():
|
||||
# spec.compiler_flags[name] = []
|
||||
else:
|
||||
raise SpackRecordError("Did not find a valid format for variants in YAML file")
|
||||
|
||||
|
|
Loading…
Reference in a new issue