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