Move logic for tracking the build log into package.py (since that is what is
managing the build log) and expose as package.build_log_path.
This commit is contained in:
@@ -97,21 +97,14 @@ def create_test_output(topSpec, newInstalls, output):
|
|||||||
bId = BuildId(spec.name, spec.version, spec.dag_hash())
|
bId = BuildId(spec.name, spec.version, spec.dag_hash())
|
||||||
|
|
||||||
package = spack.db.get(spec)
|
package = spack.db.get(spec)
|
||||||
if package.installed:
|
with open(package.build_log_path, 'rb') as F:
|
||||||
buildLogPath = spack.install_layout.build_log_path(spec)
|
|
||||||
else:
|
|
||||||
#TODO: search recursively under stage.path instead of only within
|
|
||||||
# stage.source_path
|
|
||||||
buildLogPath = join_path(package.stage.source_path, 'spack-build.out')
|
|
||||||
|
|
||||||
with open(buildLogPath, 'rb') as F:
|
|
||||||
lines = F.readlines()
|
lines = F.readlines()
|
||||||
errMessages = list(line for line in lines if
|
errMessages = list(line for line in lines if
|
||||||
re.search('error:', line, re.IGNORECASE))
|
re.search('error:', line, re.IGNORECASE))
|
||||||
errOutput = errMessages if errMessages else lines[-10:]
|
errOutput = errMessages if errMessages else lines[-10:]
|
||||||
errOutput = '\n'.join(itertools.chain(
|
errOutput = '\n'.join(itertools.chain(
|
||||||
[spec.to_yaml(), "Errors:"], errOutput,
|
[spec.to_yaml(), "Errors:"], errOutput,
|
||||||
["Build Log:", buildLogPath]))
|
["Build Log:", package.build_log_path]))
|
||||||
|
|
||||||
output.add_test(bId, package.installed, errOutput)
|
output.add_test(bId, package.installed, errOutput)
|
||||||
|
|
||||||
|
@@ -863,6 +863,14 @@ def do_install_dependencies(self, **kwargs):
|
|||||||
dep.package.do_install(**kwargs)
|
dep.package.do_install(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def build_log_path(self):
|
||||||
|
if self.installed:
|
||||||
|
return spack.install_layout.build_log_path(spec)
|
||||||
|
else:
|
||||||
|
return join_path(self.stage.source_path, 'spack-build.out')
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def module(self):
|
def module(self):
|
||||||
"""Use this to add variables to the class's module's scope.
|
"""Use this to add variables to the class's module's scope.
|
||||||
|
Reference in New Issue
Block a user