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.
This commit is contained in:
parent
26724688b1
commit
a06c6b0366
@ -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
|
||||
|
@ -260,6 +260,19 @@ def add_standalone(self, spec):
|
||||
% 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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user