diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-04-13 17:32:22 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-04-13 17:32:22 -0700 |
commit | 79c5dd095273dba5481580da242959b4417e680f (patch) | |
tree | 87005c4a898d85f49fc34b49b80293206c1fac3f | |
parent | 59a3b8dc67fcfd7f82de1fbd6fe6a1fafb66b115 (diff) | |
download | spack-79c5dd095273dba5481580da242959b4417e680f.tar.gz spack-79c5dd095273dba5481580da242959b4417e680f.tar.bz2 spack-79c5dd095273dba5481580da242959b4417e680f.tar.xz spack-79c5dd095273dba5481580da242959b4417e680f.zip |
Fix SPACK-21: stage names are too long
Stage names now hash dependencies like install prefixes.
-rw-r--r-- | lib/spack/spack/directory_layout.py | 14 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/spec.py | 16 | ||||
-rw-r--r-- | var/spack/packages/stat/package.py | 18 |
4 files changed, 21 insertions, 29 deletions
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 2e4b6f89c8..ad9f669f90 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -138,18 +138,8 @@ class SpecHashDirectoryLayout(DirectoryLayout): def relative_path_for_spec(self, spec): _check_concrete(spec) - - path = join_path( - spec.architecture, - spec.compiler, - "%s@%s%s" % (spec.name, spec.version, spec.variants)) - - if spec.dependencies: - path += "-" - sha1 = spec.dependencies.sha1() - path += sha1[:self.prefix_size] - - return path + dir_name = spec.format('$_$@$+$#') + return join_path(spec.architecture, spec.compiler, dir_name) def write_spec(self, spec, path): diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index ff020fb44c..b3b1538b31 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -407,7 +407,7 @@ class Package(object): if self._stage is None: mirror_path = "%s/%s" % (self.name, os.path.basename(self.url)) self._stage = Stage( - self.url, mirror_path=mirror_path, name=str(self.spec)) + self.url, mirror_path=mirror_path, name=self.spec.short_spec) return self._stage diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index a4f585b28a..6ec66d1afa 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -466,6 +466,13 @@ class Spec(object): @property + def short_spec(self): + """Returns a version of the spec with the dependencies hashed + instead of completely enumerated.""" + return self.format('$_$@$%@$+$=$#') + + + @property def prefix(self): return Prefix(spack.install_layout.path_for_spec(self)) @@ -998,15 +1005,18 @@ class Spec(object): $%@ Compiler & compiler version $+ Options $= Architecture - $# Dependencies' 6-char sha1 prefix + $# Dependencies' 8-char sha1 prefix $$ $ Anything else is copied verbatim into the output stream. *Example:* ``$_$@$+`` translates to the name, version, and options of the package, but no dependencies, arch, or compiler. + + TODO: allow, e.g., $6# to customize short hash length + TODO: allow, e.g., $## for full hash. """ - color = kwargs.get('color', False) + color = kwargs.get('color', False) length = len(format_string) out = StringIO() escape = compiler = False @@ -1037,7 +1047,7 @@ class Spec(object): write(c + str(self.architecture), c) elif c == '#': if self.dependencies: - out.write('-' + self.dependencies.sha1()[:6]) + out.write('-' + self.dependencies.sha1()[:8]) elif c == '$': out.write('$') escape = False diff --git a/var/spack/packages/stat/package.py b/var/spack/packages/stat/package.py index d621bcef01..71f3b086a0 100644 --- a/var/spack/packages/stat/package.py +++ b/var/spack/packages/stat/package.py @@ -10,26 +10,18 @@ class Stat(Package): depends_on('libdwarf') depends_on('dyninst') depends_on('graphlib') - #depends_on('launchmon') # TODO: when added, path gets too long (Jira SPACK-21)! + depends_on('launchmon') depends_on('mrnet') def install(self, spec, prefix): configure( "--enable-gui", "--prefix=%s" % prefix, - - # TODO: this uses the launchmon package, but path is - # too long (see depends_on above) (Jira SPACK-21) - # "--with-launchmon=%s" % spec['launchmon'].prefix, - - # TODO: launchmon line above is the proper one once - # SPACK-21 is fixed - "--with-launchmon=/collab/usr/global/tools/launchmon/chaos_5_x86_64_ib/launchmon-1.0.0-20140312", - - "--with-mrnet=%s" % spec['mrnet'].prefix, - "--with-graphlib=%s" % spec['graphlib'].prefix, + "--with-launchmon=%s" % spec['launchmon'].prefix, + "--with-mrnet=%s" % spec['mrnet'].prefix, + "--with-graphlib=%s" % spec['graphlib'].prefix, "--with-stackwalker=%s" % spec['dyninst'].prefix, - "--with-libdwarf=%s" % spec['libdwarf'].prefix) + "--with-libdwarf=%s" % spec['libdwarf'].prefix) # TODO: remove once SPACK-19 is fixed import shutil |