bugfix: config:install_hash_length ignored (#15919)
This commit is contained in:
parent
b9ed788589
commit
3ae76d8c1e
@ -190,6 +190,7 @@ def __init__(self, root, **kwargs):
|
||||
"{architecture}/"
|
||||
"{compiler.name}-{compiler.version}/"
|
||||
"{name}-{version}-{hash}")
|
||||
self.path_scheme = self.path_scheme.lower()
|
||||
if self.hash_len is not None:
|
||||
if re.search(r'{hash:\d+}', self.path_scheme):
|
||||
raise InvalidDirectoryLayoutParametersError(
|
||||
|
41
lib/spack/spack/test/config_values.py
Normal file
41
lib/spack/spack/test/config_values.py
Normal file
@ -0,0 +1,41 @@
|
||||
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import spack.spec
|
||||
|
||||
|
||||
def test_set_install_hash_length(mock_packages, mutable_config, monkeypatch):
|
||||
# spack.store.layout caches initial config values, so we monkeypatch
|
||||
mutable_config.set('config:install_hash_length', 5)
|
||||
monkeypatch.setattr(spack.store, 'store', spack.store._store())
|
||||
|
||||
spec = spack.spec.Spec('libelf').concretized()
|
||||
prefix = spec.prefix
|
||||
hash = prefix.rsplit('-')[-1]
|
||||
|
||||
assert len(hash) == 5
|
||||
|
||||
mutable_config.set('config:install_hash_length', 9)
|
||||
monkeypatch.setattr(spack.store, 'store', spack.store._store())
|
||||
|
||||
spec = spack.spec.Spec('libelf').concretized()
|
||||
prefix = spec.prefix
|
||||
hash = prefix.rsplit('-')[-1]
|
||||
|
||||
assert len(hash) == 9
|
||||
|
||||
|
||||
def test_set_install_hash_length_upper_case(mock_packages, mutable_config,
|
||||
monkeypatch):
|
||||
# spack.store.layout caches initial config values, so we monkeypatch
|
||||
mutable_config.set('config:install_path_scheme', '{name}-{HASH}')
|
||||
mutable_config.set('config:install_hash_length', 5)
|
||||
monkeypatch.setattr(spack.store, 'store', spack.store._store())
|
||||
|
||||
spec = spack.spec.Spec('libelf').concretized()
|
||||
prefix = spec.prefix
|
||||
hash = prefix.rsplit('-')[-1]
|
||||
|
||||
assert len(hash) == 5
|
Loading…
Reference in New Issue
Block a user