summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-11-11 02:43:44 -0600
committerPeter Scheibel <scheibel1@llnl.gov>2018-11-11 18:32:24 -0600
commit87aec4134daba7dee43c958151b45ca72c02e617 (patch)
tree4b6903f70171a4141c551e208eb79b0f4b01418f
parent0f2bfd74924da41264b7007f20c6832cabf51b4d (diff)
downloadspack-87aec4134daba7dee43c958151b45ca72c02e617.tar.gz
spack-87aec4134daba7dee43c958151b45ca72c02e617.tar.bz2
spack-87aec4134daba7dee43c958151b45ca72c02e617.tar.xz
spack-87aec4134daba7dee43c958151b45ca72c02e617.zip
bugfix: preserve abstract specs when installing an environment
- `spack install` was setting the root to be the concrete spec - abstract spec is now preserved
-rw-r--r--lib/spack/spack/cmd/install.py14
-rw-r--r--lib/spack/spack/environment.py4
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.