summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-07-12 16:12:43 +0200
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-07-20 08:10:41 +0200
commit7405d18e988efb24543ed921a44213f02940770f (patch)
tree047230517261f713f28def9432f2a850133ee922 /lib
parentbff1de69a577b8118b4eb75f987d3f701cff19a2 (diff)
downloadspack-7405d18e988efb24543ed921a44213f02940770f.tar.gz
spack-7405d18e988efb24543ed921a44213f02940770f.tar.bz2
spack-7405d18e988efb24543ed921a44213f02940770f.tar.xz
spack-7405d18e988efb24543ed921a44213f02940770f.zip
environment.py: only acquire write lock when necessary (#31493)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/environment/environment.py7
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')