diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2022-07-12 16:12:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 16:12:43 +0200 |
commit | b2c519470b952350829c0baab78cf58fca8ef2a5 (patch) | |
tree | c08e078bf4c1dd7a7ccf8c6b395f44aa9a2007db /lib | |
parent | 9087224e04398f31d9545e260caab54eef184afa (diff) | |
download | spack-b2c519470b952350829c0baab78cf58fca8ef2a5.tar.gz spack-b2c519470b952350829c0baab78cf58fca8ef2a5.tar.bz2 spack-b2c519470b952350829c0baab78cf58fca8ef2a5.tar.xz spack-b2c519470b952350829c0baab78cf58fca8ef2a5.zip |
environment.py: only acquire write lock when necessary (#31493)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/environment/environment.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 7366468f7a..1c16c708b3 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -1612,9 +1612,10 @@ class Environment(object): # ensure specs already installed are marked explicit all_specs = specs or [cs for _, cs in self.concretized_specs()] specs_installed = [s for s in all_specs if s.installed] - with spack.store.db.write_transaction(): # do all in one transaction - for spec in specs_installed: - spack.store.db.update_explicit(spec, True) + if specs_installed: + with spack.store.db.write_transaction(): # do all in one transaction + for spec in specs_installed: + spack.store.db.update_explicit(spec, True) if not specs_to_install: tty.msg('All of the packages are already installed') |