Initialize report generator before parsing specs
This will allow us to generate reports for concretization errors
This commit is contained in:
parent
de01d70ae4
commit
e4e8c72fa1
@ -191,6 +191,10 @@ def install(parser, args, **kwargs):
|
|||||||
tty.warn("Deprecated option: --run-tests: use --test=all instead")
|
tty.warn("Deprecated option: --run-tests: use --test=all instead")
|
||||||
|
|
||||||
# 1. Abstract specs from cli
|
# 1. Abstract specs from cli
|
||||||
|
reporter = spack.report.collect_info(args.log_format)
|
||||||
|
if args.log_file:
|
||||||
|
reporter.filename = args.log_file
|
||||||
|
|
||||||
specs = spack.cmd.parse_specs(args.package)
|
specs = spack.cmd.parse_specs(args.package)
|
||||||
if args.test == 'all' or args.run_tests:
|
if args.test == 'all' or args.run_tests:
|
||||||
spack.package_testing.test_all()
|
spack.package_testing.test_all()
|
||||||
@ -216,8 +220,10 @@ def install(parser, args, **kwargs):
|
|||||||
if len(specs) == 0:
|
if len(specs) == 0:
|
||||||
tty.die('The `spack install` command requires a spec to install.')
|
tty.die('The `spack install` command requires a spec to install.')
|
||||||
|
|
||||||
filename = args.log_file or default_log_file(specs[0])
|
if not args.log_file:
|
||||||
with spack.report.collect_info(specs, args.log_format, filename):
|
reporter.filename = default_log_file(specs[0])
|
||||||
|
reporter.specs = specs
|
||||||
|
with reporter:
|
||||||
if args.overwrite:
|
if args.overwrite:
|
||||||
# If we asked to overwrite an existing spec we must ensure that:
|
# If we asked to overwrite an existing spec we must ensure that:
|
||||||
# 1. We have only one spec
|
# 1. We have only one spec
|
||||||
|
@ -249,20 +249,17 @@ class collect_info(object):
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: when ``format_name`` is not in ``valid_formats``
|
ValueError: when ``format_name`` is not in ``valid_formats``
|
||||||
"""
|
"""
|
||||||
def __init__(self, specs, format_name, filename):
|
def __init__(self, format_name):
|
||||||
self.specs = specs
|
|
||||||
self.format_name = format_name
|
self.format_name = format_name
|
||||||
|
|
||||||
# Check that the format is valid
|
# Check that the format is valid
|
||||||
if format_name not in itertools.chain(valid_formats, [None]):
|
if format_name not in itertools.chain(valid_formats, [None]):
|
||||||
raise ValueError('invalid report type: {0}'.format(format_name))
|
raise ValueError('invalid report type: {0}'.format(format_name))
|
||||||
|
|
||||||
self.filename = filename
|
|
||||||
self.collector = InfoCollector(specs) if self.format_name else None
|
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
if self.format_name:
|
if self.format_name:
|
||||||
# Start the collector and patch PackageBase.do_install
|
# Start the collector and patch PackageBase.do_install
|
||||||
|
self.collector = InfoCollector(self.specs)
|
||||||
self.collector.__enter__()
|
self.collector.__enter__()
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
Loading…
Reference in New Issue
Block a user