spack/share/spack
Alec Scott ff26d2f833
spack env track command (#41897)
This PR adds a sub-command to `spack env` (`track`) which allows users to add/link
anonymous environments into their installation as named environments. This allows
users to more easily track their installed packages and the environments they're
dependencies of. For example, with the addition of #41731 it's now easier to remove
all packages not required by any environments with,

```
spack gc -bE
```

#### Usage
```
spack env track /path/to/env
==> Linked environment in /path/to/env
==> You can activate this environment with:
==>     spack env activate env
```

By default `track /path/to/env` will use the last directory in the path as the name of 
the environment. However users may customize the name of the linked environment
with `-n | --name`. Shown below.
```
spack env track /path/to/env --name foo 
==> Tracking environment in /path/to/env
==> You can activate this environment with:
==>     spack env activate foo
```

When removing a linked environment, Spack will remove the link to the environment
but will keep the structure of the environment within the directory. This will allow
users to remove a linked environment from their installation without deleting it from
a shared repository.

There is a `spack env untrack` command that can be used to *only* untrack a tracked
environment -- it will fail if it is used on a managed environment.  Users can also use
`spack env remove` to untrack an environment.

This allows users to continue to share environments in git repositories  while also having
the dependencies of those environments be remembered by Spack.

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-08 00:16:01 -08:00
..
bash Update copyright year to 2024 (#41919) 2024-01-02 09:21:30 +01:00
bootstrap bootstrap: add clingo 3.13 binaries and more (#47126) 2024-10-24 08:55:14 +02:00
csh Fix setup-env when going back and forth between instances (#40924) 2024-01-05 11:31:32 -06:00
docker Update copyright year to 2024 (#41919) 2024-01-02 09:21:30 +01:00
docs/docker/module-file-tutorial Update copyright year to 2024 (#41919) 2024-01-02 09:21:30 +01:00
fish Update copyright year to 2024 (#41919) 2024-01-02 09:21:30 +01:00
gitlab/cloud_pipelines omega-h: new version and cuda conflicts for prior versions (#47473) 2024-11-06 22:36:59 +00:00
keys update tutorial command for v0.18.0 and new gpg key (#30904) 2022-05-28 02:36:20 +00:00
logo add artisanal handcrafted SVG Spack logo. (#6165) 2017-11-06 22:42:16 -08:00
qa Fix spack -c <override> when env active (#47403) 2024-11-06 17:18:58 +01:00
templates env depfile: generate Makefile with absolute script path (#46966) 2024-10-15 13:52:31 +00:00
setup-env.bat Normalize Spack Win entry points (#38648) 2024-10-25 15:23:29 -04:00
setup-env.csh fix 'command -v' not in csh (#45845) 2024-10-02 19:15:35 +02:00
setup-env.fish Remove execution permission from setup-env.sh (#45641) 2024-08-09 13:27:07 -07:00
setup-env.ps1 Normalize Spack Win entry points (#38648) 2024-10-25 15:23:29 -04:00
setup-env.sh Remove execution permission from setup-env.sh (#45641) 2024-08-09 13:27:07 -07:00
setup-tutorial-env.sh Remove execution permission from setup-env.sh (#45641) 2024-08-09 13:27:07 -07:00
spack-completion.bash spack env track command (#41897) 2024-11-08 00:16:01 -08:00
spack-completion.fish spack env track command (#41897) 2024-11-08 00:16:01 -08:00