Avoid replacing symlinked spack.yaml when concretizing an environment (#26428)

This commit is contained in:
Pedro Demarchi Gomes 2021-10-04 11:59:03 -03:00 committed by GitHub
parent 4ae71b0297
commit 90fa50d9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -1944,7 +1944,7 @@ def _update_and_write_manifest(self, raw_yaml_dict, yaml_dict):
written = os.path.exists(self.manifest_path)
if changed or not written:
self.raw_yaml = copy.deepcopy(self.yaml)
with fs.write_tmp_and_move(self.manifest_path) as f:
with fs.write_tmp_and_move(os.path.realpath(self.manifest_path)) as f:
_write_yaml(self.yaml, f)
def __enter__(self):

View File

@ -248,6 +248,25 @@ def test_env_install_same_spec_twice(install_mockery, mock_fetch):
assert 'already installed' in out
def test_env_definition_symlink(install_mockery, mock_fetch, tmpdir):
filepath = str(tmpdir.join('spack.yaml'))
filepath_mid = str(tmpdir.join('spack_mid.yaml'))
env('create', 'test')
e = ev.read('test')
e.add('mpileaks')
os.rename(e.manifest_path, filepath)
os.symlink(filepath, filepath_mid)
os.symlink(filepath_mid, e.manifest_path)
e.concretize()
e.write()
assert os.path.islink(e.manifest_path)
assert os.path.islink(filepath_mid)
def test_env_install_two_specs_same_dep(
install_mockery, mock_fetch, tmpdir, capsys):
"""Test installation of two packages that share a dependency with no