try adding all environment specs to installer

This commit is contained in:
Gregory Becker 2023-05-15 10:38:11 -07:00
parent cebd482300
commit 08a5a59b21

View File

@ -1751,41 +1751,8 @@ def install_all(self, **install_args):
self.install_specs(None, **install_args) self.install_specs(None, **install_args)
def install_specs(self, specs=None, **install_args): def install_specs(self, specs=None, **install_args):
tty.debug("Assessing installation status of environment packages") specs_to_install = specs or [concrete for _, concrete in self.concretized_specs()]
# If "spack install" is invoked repeatedly for a large environment tty.debug("Processing {0} specs".format(len(specs_to_install)))
# where all specs are already installed, the operation can take
# a large amount of time due to repeatedly acquiring and releasing
# locks. As a small optimization, drop already installed root specs.
installed_roots, uninstalled_roots = self._partition_roots_by_install_status()
overwrite = install_args.get("overwrite", [])
# Specs to install are those that aren't installed yet or are overwritten
if specs:
# Filter specs to install by CLI arguments
specs_to_install = [
s for s in specs if s not in installed_roots or s.dag_hash() in overwrite
]
specs_dropped = [
s for s in specs if s in installed_roots and s.dag_hash() not in overwrite
]
else:
specs_to_install = uninstalled_roots + [
s for s in installed_roots if s.dag_hash() in overwrite
]
specs_dropped = [s for s in installed_roots if s.dag_hash() not in overwrite]
# We need to repeat the work of the installer thanks to the above optimization:
# Already installed root specs should be marked explicitly installed in the
# database.
if specs_dropped:
with spack.store.db.write_transaction(): # do all in one transaction
for spec in specs_dropped:
spack.store.db.update_explicit(spec, True)
if not specs_to_install:
tty.msg("All of the packages are already installed")
else:
tty.debug("Processing {0} uninstalled specs".format(len(specs_to_install)))
specs_to_overwrite = self._get_overwrite_specs() specs_to_overwrite = self._get_overwrite_specs()
tty.debug("{0} specs need to be overwritten".format(len(specs_to_overwrite))) tty.debug("{0} specs need to be overwritten".format(len(specs_to_overwrite)))