From c69acfa5c80fc4ea93787c19f9f4a6f3cf833f9c Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Fri, 15 Apr 2016 12:21:32 +0200
Subject: [PATCH] naming work correctly

---
 lib/spack/spack/modules.py | 11 +++++++----
 share/spack/setup-env.sh   |  6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index e6e9be1eff..a24d5e5d09 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -276,8 +276,7 @@ def tokens(self):
         tokens = {
             'name': self.spec.name,
             'version': self.spec.version,
-            'compiler': self.spec.compiler,
-            'hash': self.spec.dag_hash()
+            'compiler': self.spec.compiler
         }
         return tokens
 
@@ -289,6 +288,10 @@ def use_name(self):
         naming_tokens = self.tokens
         naming_scheme = self.naming_scheme
         name = naming_scheme.format(**naming_tokens)
+        name += '-' + self.spec.dag_hash()  # Always append the hash to make the module file unique
+        # Not everybody is working on linux...
+        parts = name.split('/')
+        name = join_path(*parts)
         return name
 
     @property
@@ -430,7 +433,7 @@ class Dotkit(EnvModule):
 
     prerequisite_format = None  # TODO : does something like prerequisite exist for dotkit?
 
-    default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}-{hash}'
+    default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}'
 
     @property
     def file_name(self):
@@ -473,7 +476,7 @@ class TclModule(EnvModule):
 
     prerequisite_format = 'prereq {module_file}\n'
 
-    default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}-{hash}'
+    default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}'
 
     @property
     def file_name(self):
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 764af68400..0c9e5b2409 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -41,7 +41,7 @@
 # commands.  This allows the user to use packages without knowing all
 # their installation details.
 #
-# e.g., rather than requring a full spec for libelf, the user can type:
+# e.g., rather than requiring a full spec for libelf, the user can type:
 #
 #     spack use libelf
 #
@@ -110,11 +110,11 @@ function spack {
                         unuse $_sp_module_args $_sp_full_spec
                     fi ;;
                 "load")
-                    if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+                    if _sp_full_spec=$(command spack $_sp_flags module find tcl $_sp_spec); then
                         module load $_sp_module_args $_sp_full_spec
                     fi ;;
                 "unload")
-                    if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+                    if _sp_full_spec=$(command spack $_sp_flags module find tcl $_sp_spec); then
                         module unload $_sp_module_args $_sp_full_spec
                     fi ;;
             esac
-- 
GitLab