summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Becker <becker33@llnl.gov>2020-05-04 23:10:25 -0700
committerGitHub <noreply@github.com>2020-05-04 23:10:25 -0700
commit3ae76d8c1e7ca0cbe09af8bb98c67751b4e0572a (patch)
tree6a3ed0fe5f982d5ec295d91f1245dd21eab74cfe /lib
parentb9ed788589d98f1c65f1659045439660ab5acafa (diff)
downloadspack-3ae76d8c1e7ca0cbe09af8bb98c67751b4e0572a.tar.gz
spack-3ae76d8c1e7ca0cbe09af8bb98c67751b4e0572a.tar.bz2
spack-3ae76d8c1e7ca0cbe09af8bb98c67751b4e0572a.tar.xz
spack-3ae76d8c1e7ca0cbe09af8bb98c67751b4e0572a.zip
bugfix: config:install_hash_length ignored (#15919)
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