From 87aec4134daba7dee43c958151b45ca72c02e617 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 11 Nov 2018 02:43:44 -0600 Subject: bugfix: preserve abstract specs when installing an environment - `spack install` was setting the root to be the concrete spec - abstract spec is now preserved --- lib/spack/spack/cmd/install.py | 14 +++++++------- lib/spack/spack/environment.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 2ec6efc04f..d42988303f 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -155,14 +155,14 @@ def default_log_file(spec): 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.""" # handle active environment, if any def install(spec, kwargs): env = ev.get_env(cli_args, 'install', required=False) if env: - env.install(spec, kwargs) + env.install(abstract_spec, spec, **kwargs) env.write() else: spec.package.do_install(**kwargs) @@ -230,12 +230,12 @@ def install(parser, args, **kwargs): if 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 if args.test == 'all' or args.run_tests: tests = True elif args.test == 'root': - tests = [spec.name for spec in specs] + tests = [spec.name for spec in abstract_specs] kwargs['tests'] = tests try: @@ -295,8 +295,8 @@ def install(parser, args, **kwargs): tty.die('Reinstallation aborted.') with fs.replace_directory_transaction(specs[0].prefix): - install_spec(args, kwargs, specs[0]) + install_spec(args, kwargs, abstract_specs[0], specs[0]) else: - for spec in specs: - install_spec(args, kwargs, spec) + for abstract, concrete in zip(abstract_specs, specs): + install_spec(args, kwargs, abstract, concrete) diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 1ac5a99159..40d63eaa0e 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -599,7 +599,7 @@ class Environment(object): recurse_dependencies=True, install_status=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. This will automatically concretize the single spec, but it won't @@ -608,7 +608,7 @@ class Environment(object): spec = Spec(user_spec) if self.add(spec): - concrete = spec.concretized() + concrete = concrete_spec if concrete_spec else spec.concretized() self._add_concrete_spec(spec, concrete) else: # spec might be in the user_specs, but not installed. -- cgit v1.2.3-60-g2f50