Avoid replacing symlinked spack.yaml when concretizing an environment (#26428)
This commit is contained in:
parent
4ae71b0297
commit
90fa50d9df
@ -1944,7 +1944,7 @@ def _update_and_write_manifest(self, raw_yaml_dict, yaml_dict):
|
|||||||
written = os.path.exists(self.manifest_path)
|
written = os.path.exists(self.manifest_path)
|
||||||
if changed or not written:
|
if changed or not written:
|
||||||
self.raw_yaml = copy.deepcopy(self.yaml)
|
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)
|
_write_yaml(self.yaml, f)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
@ -248,6 +248,25 @@ def test_env_install_same_spec_twice(install_mockery, mock_fetch):
|
|||||||
assert 'already installed' in out
|
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(
|
def test_env_install_two_specs_same_dep(
|
||||||
install_mockery, mock_fetch, tmpdir, capsys):
|
install_mockery, mock_fetch, tmpdir, capsys):
|
||||||
"""Test installation of two packages that share a dependency with no
|
"""Test installation of two packages that share a dependency with no
|
||||||
|
Loading…
Reference in New Issue
Block a user