diff options
author | Greg Becker <becker33@llnl.gov> | 2021-02-10 13:39:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 13:39:11 -0800 |
commit | 2b6f896ca744081a38579573a52824bf334fb54b (patch) | |
tree | b7ff3ac2c8b0b0189f081c20fd01e394fa37fe20 /lib/spack | |
parent | 5828a2cd31364e8850e30c6b6e635df39661ac0b (diff) | |
download | spack-2b6f896ca744081a38579573a52824bf334fb54b.tar.gz spack-2b6f896ca744081a38579573a52824bf334fb54b.tar.bz2 spack-2b6f896ca744081a38579573a52824bf334fb54b.tar.xz spack-2b6f896ca744081a38579573a52824bf334fb54b.zip |
Bugfix: environments/views on separate mounts (#20720)
Environment views fail when the tmpdir used for view generation is
on a separate mount from the install_tree because the files cannot
by symlinked between the two. The fix is to use an alternative
tmpdir located alongside the view.
Diffstat (limited to 'lib/spack')
-rw-r--r-- | lib/spack/spack/environment.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 3b26cd7050..4518cb25a9 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -556,11 +556,20 @@ class ViewDescriptor(object): # that cannot be resolved or have repos that have been removed # we always regenerate the view from scratch. We must first make # sure the root directory exists for the very first time though. - root = self.root - if not os.path.isabs(root): - root = os.path.normpath(os.path.join(self.base, self.root)) + root = os.path.normpath( + self.root if os.path.isabs(self.root) else os.path.join( + self.base, self.root) + ) fs.mkdirp(root) - with fs.replace_directory_transaction(root): + + # The tempdir for the directory transaction must be in the same + # filesystem mount as the view for symlinks to work. Provide + # dirname(root) as the tempdir for the + # replace_directory_transaction because it must be on the same + # filesystem mount as the view itself. Otherwise it may be + # impossible to construct the view in the tempdir even when it can + # be constructed in-place. + with fs.replace_directory_transaction(root, os.path.dirname(root)): view = self.view() view.clean() |