-
Notifications
You must be signed in to change notification settings - Fork 2.4k
spack gc: remove packages not used by an environment #14695
Copy link
Copy link
Closed
Labels
Milestone
Description
I would like spack gc to have the additional functionality that would allow it to uninstall all packages that are not currently activated by some environment.
Rationale
I use Spack as a replacement for Homebrew. I would like functionality similar to brew cleanup that would allow me to uninstall all old versions of software that are no longer used by my environment.
Description
Preferably, this wouldn't include build dependencies needed to install my environment, since I will need to reinstall the environment from time-to-time , and since Spack currently automatically installs build dependencies even when they aren't needed (#7695).
In the meantime, @becker33 came up with the following script that could likely be adapted to work for spack gc:
#!/usr/bin/env spack-python
from spack.cmd.uninstall import dependent_environments
import spack.store
installed = spack.store.db.query()
for spec in installed:
if not dependent_environments([spec]):
spec.package.do_uninstall()Reactions are currently unavailable