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:
Peter Scheibel
2015-10-15 12:44:02 -07:00
parent c985ad7644
commit 4997f0fe57
2 changed files with 10 additions and 9 deletions

View File

@@ -97,21 +97,14 @@ def create_test_output(topSpec, newInstalls, output):
bId = BuildId(spec.name, spec.version, spec.dag_hash())
package = spack.db.get(spec)
if package.installed:
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:
with open(package.build_log_path, 'rb') as F:
lines = F.readlines()
errMessages = list(line for line in lines if
re.search('error:', line, re.IGNORECASE))
errOutput = errMessages if errMessages else lines[-10:]
errOutput = '\n'.join(itertools.chain(
[spec.to_yaml(), "Errors:"], errOutput,
["Build Log:", buildLogPath]))
["Build Log:", package.build_log_path]))
output.add_test(bId, package.installed, errOutput)

View File

@@ -863,6 +863,14 @@ def do_install_dependencies(self, **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
def module(self):
"""Use this to add variables to the class's module's scope.