summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2017-10-26 14:03:22 -0400
committerscheibelp <scheibel1@llnl.gov>2017-11-02 18:45:40 -0700
commita06c6b0366a0d35b259556ab88fa9f4244bc7e97 (patch)
treecf6e613d6cd436f18769d2e9c344cc9c8ac55f34 /lib
parent26724688b133d21b399e72def17827623de9d9a1 (diff)
downloadspack-a06c6b0366a0d35b259556ab88fa9f4244bc7e97.tar.gz
spack-a06c6b0366a0d35b259556ab88fa9f4244bc7e97.tar.bz2
spack-a06c6b0366a0d35b259556ab88fa9f4244bc7e97.tar.xz
spack-a06c6b0366a0d35b259556ab88fa9f4244bc7e97.zip
filesystem_view: reject packages with activations
If there are extensions that are globally activated, reject adding them to a view. Those extensions should not be implicitly activated.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/view.py11
-rw-r--r--lib/spack/spack/filesystem_view.py13
-rw-r--r--lib/spack/spack/test/cmd/view.py13
3 files changed, 26 insertions, 11 deletions
diff --git a/lib/spack/spack/cmd/view.py b/lib/spack/spack/cmd/view.py
index 03670329e6..4c1f1172e8 100644
--- a/lib/spack/spack/cmd/view.py
+++ b/lib/spack/spack/cmd/view.py
@@ -202,17 +202,6 @@ def view(parser, args):
# status and remove can map the name to packages in view
specs = relaxed_disambiguate(args.specs, view)
- activated = list(filter(lambda s: s.package.is_extension and
- s.package.is_activated(), specs))
-
- if len(activated) > 0:
- tty.error("Globally activated extensions cannot be used in "
- "conjunction with filesystem views. "
- "Please deactivate the following specs: ")
- spack.cmd.display_specs(activated, flags=True, variants=True,
- long=args.verbose)
- return
-
with_dependencies = args.dependencies.lower() in ['true', 'yes']
# Map action to corresponding functionality
diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py
index a3ed27e912..be47ad0b0c 100644
--- a/lib/spack/spack/filesystem_view.py
+++ b/lib/spack/spack/filesystem_view.py
@@ -260,6 +260,19 @@ class YamlFilesystemView(FilesystemView):
% colorize_spec(spec))
return True
+ if spec.package.extendable:
+ # Check for globally activated extensions in the extendee that
+ # we're looking at.
+ activated = [p.spec for p in
+ spack.store.db.activated_extensions_for(spec)]
+ if activated:
+ tty.error("Globally activated extensions cannot be used in "
+ "conjunction with filesystem views. "
+ "Please deactivate the following specs: ")
+ spack.cmd.display_specs(activated, flags=True, variants=True,
+ long=False)
+ return False
+
tree = LinkTree(spec.prefix)
if not self.ignore_conflicts:
diff --git a/lib/spack/spack/test/cmd/view.py b/lib/spack/spack/test/cmd/view.py
index 7c429f7fbc..26fc019deb 100644
--- a/lib/spack/spack/test/cmd/view.py
+++ b/lib/spack/spack/test/cmd/view.py
@@ -89,3 +89,16 @@ def test_view_extension_global_activation(
assert 'extension1@1.0' in view_activated
assert 'extension1@2.0' not in view_activated
assert 'extension2@1.0' not in view_activated
+
+
+def test_view_extendee_with_global_activations(
+ tmpdir, builtin_mock, mock_archive, mock_fetch, config,
+ install_mockery):
+ install('extendee')
+ install('extension1@1.0')
+ install('extension1@2.0')
+ install('extension2@1.0')
+ viewpath = str(tmpdir.mkdir('view'))
+ activate('extension1@2.0')
+ output = view('symlink', viewpath, 'extension1@1.0')
+ assert 'Error: Globally activated extensions cannot be used' in output