diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 6f62b6bbf64..0dd7a235865 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -39,7 +39,8 @@ def update_kwargs_from_args(args, kwargs): 'fake': args.fake, 'dirty': args.dirty, 'use_cache': args.use_cache, - 'install_global': args.install_global + 'install_global': args.install_global, + 'upstream': args.upstream }) if hasattr(args, 'setup'): setups = set() diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py index c196f35c6bc..26cf9e78ebb 100644 --- a/lib/spack/spack/cmd/uninstall.py +++ b/lib/spack/spack/cmd/uninstall.py @@ -94,7 +94,12 @@ def find_matching_specs(env, specs, allow_multiple_matches=False, force=False, spack.config.set('config:active_tree', global_root, scope='user') elif upstream: - raise NotImplementedError + if upstream not in spack.config.get('upstreams'): + tty.die("specified upstream does not exist") + root = spack.config.get('upstreams') + root = root[upstream]['install_tree'] + root = spack.util.path.canonicalize_path(root) + spack.config.set('config:active_tree', root, scope='user') else: for spec in specs: if isinstance(spec, spack.spec.Spec): diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index b20a201f149..aab80d14107 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -1492,7 +1492,7 @@ def do_install(self, **kwargs): dirty = kwargs.get('dirty', False) restage = kwargs.get('restage', False) install_global = kwargs.get('install_global', False) - upstream = kwargs.get('upstream', False) + upstream = kwargs.get('upstream', None) # Install Package to Global Upstream for multi-user use if install_global: @@ -1502,7 +1502,12 @@ def do_install(self, **kwargs): spack.config.set('config:active_tree', global_root, scope='user') elif upstream: - raise NotImplementedError + if upstream not in spack.config.get('upstreams'): + tty.die("specified upstream does not exist") + root = spack.config.get('upstreams') + root = root[upstream]['install_tree'] + root = spack.util.path.canonicalize_path(root) + spack.config.set('config:active_tree', root, scope='user') else: spack.config.set('config:active_tree', spack.config.get('config:install_tree'),