summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/directory_layout.py1
-rw-r--r--lib/spack/spack/test/config_values.py41
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index a2e871ee1a..0f4c9663ba 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -190,6 +190,7 @@ class YamlDirectoryLayout(DirectoryLayout):
"{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(
diff --git a/lib/spack/spack/test/config_values.py b/lib/spack/spack/test/config_values.py
new file mode 100644
index 0000000000..ff97f26db4
--- /dev/null
+++ b/lib/spack/spack/test/config_values.py
@@ -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