Fix SPACK-21: stage names are too long

Stage names now hash dependencies like install prefixes.
This commit is contained in:
Todd Gamblin 2014-04-13 17:32:22 -07:00
parent 59a3b8dc67
commit 79c5dd0952
4 changed files with 21 additions and 29 deletions

View File

@ -138,18 +138,8 @@ def __init__(self, root, **kwargs):
def relative_path_for_spec(self, spec): def relative_path_for_spec(self, spec):
_check_concrete(spec) _check_concrete(spec)
dir_name = spec.format('$_$@$+$#')
path = join_path( return join_path(spec.architecture, spec.compiler, dir_name)
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
def write_spec(self, spec, path): def write_spec(self, spec, path):

View File

@ -407,7 +407,7 @@ def stage(self):
if self._stage is None: if self._stage is None:
mirror_path = "%s/%s" % (self.name, os.path.basename(self.url)) mirror_path = "%s/%s" % (self.name, os.path.basename(self.url))
self._stage = Stage( 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 return self._stage

View File

@ -465,6 +465,13 @@ def preorder_traversal(self, visited=None, d=0, **kwargs):
yield elt yield elt
@property
def short_spec(self):
"""Returns a version of the spec with the dependencies hashed
instead of completely enumerated."""
return self.format('$_$@$%@$+$=$#')
@property @property
def prefix(self): def prefix(self):
return Prefix(spack.install_layout.path_for_spec(self)) return Prefix(spack.install_layout.path_for_spec(self))
@ -998,15 +1005,18 @@ def format(self, format_string='$_$@$%@$+$=', **kwargs):
$%@ Compiler & compiler version $%@ Compiler & compiler version
$+ Options $+ Options
$= Architecture $= Architecture
$# Dependencies' 6-char sha1 prefix $# Dependencies' 8-char sha1 prefix
$$ $ $$ $
Anything else is copied verbatim into the output stream. Anything else is copied verbatim into the output stream.
*Example:* ``$_$@$+`` translates to the name, version, and options *Example:* ``$_$@$+`` translates to the name, version, and options
of the package, but no dependencies, arch, or compiler. 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) length = len(format_string)
out = StringIO() out = StringIO()
escape = compiler = False escape = compiler = False
@ -1037,7 +1047,7 @@ def write(s, c):
write(c + str(self.architecture), c) write(c + str(self.architecture), c)
elif c == '#': elif c == '#':
if self.dependencies: if self.dependencies:
out.write('-' + self.dependencies.sha1()[:6]) out.write('-' + self.dependencies.sha1()[:8])
elif c == '$': elif c == '$':
out.write('$') out.write('$')
escape = False escape = False

View File

@ -10,26 +10,18 @@ class Stat(Package):
depends_on('libdwarf') depends_on('libdwarf')
depends_on('dyninst') depends_on('dyninst')
depends_on('graphlib') depends_on('graphlib')
#depends_on('launchmon') # TODO: when added, path gets too long (Jira SPACK-21)! depends_on('launchmon')
depends_on('mrnet') depends_on('mrnet')
def install(self, spec, prefix): def install(self, spec, prefix):
configure( configure(
"--enable-gui", "--enable-gui",
"--prefix=%s" % prefix, "--prefix=%s" % prefix,
"--with-launchmon=%s" % spec['launchmon'].prefix,
# TODO: this uses the launchmon package, but path is "--with-mrnet=%s" % spec['mrnet'].prefix,
# too long (see depends_on above) (Jira SPACK-21) "--with-graphlib=%s" % spec['graphlib'].prefix,
# "--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-stackwalker=%s" % spec['dyninst'].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 # TODO: remove once SPACK-19 is fixed
import shutil import shutil