bugfix: preserve abstract specs when installing an environment

- `spack install` was setting the root to be the concrete spec
- abstract spec is now preserved
This commit is contained in:
Todd Gamblin 2018-11-11 02:43:44 -06:00 committed by Peter Scheibel
parent 0f2bfd7492
commit 87aec4134d
2 changed files with 9 additions and 9 deletions

View File

@ -155,14 +155,14 @@ def default_log_file(spec):
return fs.os.path.join(dirname, basename) return fs.os.path.join(dirname, basename)
def install_spec(cli_args, kwargs, spec): def install_spec(cli_args, kwargs, abstract_spec, spec):
"""Do the actual installation.""" """Do the actual installation."""
# handle active environment, if any # handle active environment, if any
def install(spec, kwargs): def install(spec, kwargs):
env = ev.get_env(cli_args, 'install', required=False) env = ev.get_env(cli_args, 'install', required=False)
if env: if env:
env.install(spec, kwargs) env.install(abstract_spec, spec, **kwargs)
env.write() env.write()
else: else:
spec.package.do_install(**kwargs) spec.package.do_install(**kwargs)
@ -230,12 +230,12 @@ def install(parser, args, **kwargs):
if args.log_file: if args.log_file:
reporter.filename = args.log_file reporter.filename = args.log_file
specs = spack.cmd.parse_specs(args.package) abstract_specs = spack.cmd.parse_specs(args.package)
tests = False tests = False
if args.test == 'all' or args.run_tests: if args.test == 'all' or args.run_tests:
tests = True tests = True
elif args.test == 'root': elif args.test == 'root':
tests = [spec.name for spec in specs] tests = [spec.name for spec in abstract_specs]
kwargs['tests'] = tests kwargs['tests'] = tests
try: try:
@ -295,8 +295,8 @@ def install(parser, args, **kwargs):
tty.die('Reinstallation aborted.') tty.die('Reinstallation aborted.')
with fs.replace_directory_transaction(specs[0].prefix): with fs.replace_directory_transaction(specs[0].prefix):
install_spec(args, kwargs, specs[0]) install_spec(args, kwargs, abstract_specs[0], specs[0])
else: else:
for spec in specs: for abstract, concrete in zip(abstract_specs, specs):
install_spec(args, kwargs, spec) install_spec(args, kwargs, abstract, concrete)

View File

@ -599,7 +599,7 @@ def concretize(self, force=False):
recurse_dependencies=True, install_status=True, recurse_dependencies=True, install_status=True,
hashlen=7, hashes=True)) hashlen=7, hashes=True))
def install(self, user_spec, install_args=None): def install(self, user_spec, concrete_spec=None, **install_args):
"""Install a single spec into an environment. """Install a single spec into an environment.
This will automatically concretize the single spec, but it won't This will automatically concretize the single spec, but it won't
@ -608,7 +608,7 @@ def install(self, user_spec, install_args=None):
spec = Spec(user_spec) spec = Spec(user_spec)
if self.add(spec): if self.add(spec):
concrete = spec.concretized() concrete = concrete_spec if concrete_spec else spec.concretized()
self._add_concrete_spec(spec, concrete) self._add_concrete_spec(spec, concrete)
else: else:
# spec might be in the user_specs, but not installed. # spec might be in the user_specs, but not installed.