summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2017-02-03 18:27:34 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2017-02-03 18:27:34 -0800
commit968199de7d15fa6150c26f94100c19f4202f139b (patch)
tree06ebe4c06cb8b3a41e706f264fbe19a9e37b568f /lib
parent5aefaa6ffec851f6b6ed704257a4889efd47837a (diff)
downloadspack-968199de7d15fa6150c26f94100c19f4202f139b.tar.gz
spack-968199de7d15fa6150c26f94100c19f4202f139b.tar.bz2
spack-968199de7d15fa6150c26f94100c19f4202f139b.tar.xz
spack-968199de7d15fa6150c26f94100c19f4202f139b.zip
Fix spec hash printing (#2941)
- Fix format printing to match command line for hashes and full name formats - Update spack graph to use new format - Changed format string signifier for hashes from `$#` to `$/`
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/dependents.py2
-rw-r--r--lib/spack/spack/cmd/uninstall.py2
-rw-r--r--lib/spack/spack/database.py2
-rw-r--r--lib/spack/spack/graph.py2
-rw-r--r--lib/spack/spack/spec.py16
-rw-r--r--lib/spack/spack/test/graph.py12
6 files changed, 18 insertions, 18 deletions
diff --git a/lib/spack/spack/cmd/dependents.py b/lib/spack/spack/cmd/dependents.py
index 8c533561e3..42181b5502 100644
--- a/lib/spack/spack/cmd/dependents.py
+++ b/lib/spack/spack/cmd/dependents.py
@@ -45,7 +45,7 @@ def dependents(parser, args):
tty.die("spack dependents takes only one spec.")
spec = spack.cmd.disambiguate_spec(specs[0])
- tty.msg("Dependents of %s" % spec.format('$_$@$%@$#', color=True))
+ tty.msg("Dependents of %s" % spec.format('$_$@$%@$/', color=True))
deps = spack.store.db.installed_dependents(spec)
if deps:
spack.cmd.display_specs(deps)
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index f8b5408ba1..fb9094f1b4 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -177,7 +177,7 @@ def get_uninstall_list(args):
if dependent_list and not args.dependents and not args.force:
for spec, lst in dependent_list.items():
tty.error("Will not uninstall %s" %
- spec.format("$_$@$%@$#", color=True))
+ spec.format("$_$@$%@$/", color=True))
print('')
print("The following packages depend on it:")
spack.cmd.display_specs(lst, **display_args)
diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
index ff55223351..d3fc03fb40 100644
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -239,7 +239,7 @@ class Database(object):
if dhash not in data:
tty.warn("Missing dependency not in database: ",
"%s needs %s-%s" % (
- spec.format('$_$#'), dname, dhash[:7]))
+ spec.format('$_$/'), dname, dhash[:7]))
continue
child = data[dhash].spec
diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py
index 7cc2046b9d..91230263f1 100644
--- a/lib/spack/spack/graph.py
+++ b/lib/spack/spack/graph.py
@@ -571,7 +571,7 @@ def graph_dot(specs, deptype=None, static=False, out=None):
else:
def key_label(s):
- return s.dag_hash(), "%s-%s" % (s.name, s.dag_hash(7))
+ return s.dag_hash(), "%s/%s" % (s.name, s.dag_hash(7))
for s in spec.traverse(deptype=deptype):
skey, slabel = key_label(s)
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 36806b757d..0df0ff71ea 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1145,13 +1145,13 @@ class Spec(object):
def short_spec(self):
"""Returns a version of the spec with the dependencies hashed
instead of completely enumerated."""
- return self.format('$_$@$%@$+$=$#')
+ return self.format('$_$@$%@$+$=$/')
@property
def cshort_spec(self):
"""Returns a version of the spec with the dependencies hashed
instead of completely enumerated."""
- return self.format('$_$@$%@$+$=$#', color=True)
+ return self.format('$_$@$%@$+$=$/', color=True)
@property
def prefix(self):
@@ -2374,7 +2374,7 @@ class Spec(object):
prefixes as above
$+ Options
$= Architecture prefixed by 'arch='
- $# 7-char prefix of DAG hash with '-' prefix
+ $/ 7-char prefix of DAG hash with '-' prefix
$$ $
You can also use full-string versions, which elide the prefixes::
@@ -2408,7 +2408,7 @@ class Spec(object):
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.
+ TODO: allow, e.g., ``$//`` for full hash.
"""
color = kwargs.get('color', False)
length = len(format_string)
@@ -2455,8 +2455,8 @@ class Spec(object):
if self.architecture and str(self.architecture):
a_str = ' arch' + c + str(self.architecture) + ' '
write(fmt % (a_str), c)
- elif c == '#':
- out.write('-' + fmt % (self.dag_hash(7)))
+ elif c == '/':
+ out.write('/' + fmt % (self.dag_hash(7)))
elif c == '$':
if fmt != '%s':
raise ValueError("Can't use format width with $$.")
@@ -2529,7 +2529,7 @@ class Spec(object):
hashlen = int(hashlen)
else:
hashlen = None
- out.write(fmt % (self.dag_hash(hashlen)))
+ out.write('/' + fmt % (self.dag_hash(hashlen)))
named = False
@@ -3161,7 +3161,7 @@ class UnsatisfiableDependencySpecError(UnsatisfiableSpecError):
class AmbiguousHashError(SpecError):
def __init__(self, msg, *specs):
- specs_str = '\n ' + '\n '.join(spec.format('$.$@$%@+$+$=$#')
+ specs_str = '\n ' + '\n '.join(spec.format('$.$@$%@+$+$=$/')
for spec in specs)
super(AmbiguousHashError, self).__init__(msg + specs_str)
diff --git a/lib/spack/spack/test/graph.py b/lib/spack/spack/test/graph.py
index 09dbcd0548..ce7b07ed86 100644
--- a/lib/spack/spack/test/graph.py
+++ b/lib/spack/spack/test/graph.py
@@ -84,16 +84,16 @@ def test_dynamic_dot_graph_mpileaks(builtin_mock):
dot = stream.getvalue()
- mpileaks_hash, mpileaks_lbl = s.dag_hash(), s.format('$_$#')
- mpi_hash, mpi_lbl = s['mpi'].dag_hash(), s['mpi'].format('$_$#')
+ mpileaks_hash, mpileaks_lbl = s.dag_hash(), s.format('$_$/')
+ mpi_hash, mpi_lbl = s['mpi'].dag_hash(), s['mpi'].format('$_$/')
callpath_hash, callpath_lbl = (
- s['callpath'].dag_hash(), s['callpath'].format('$_$#'))
+ s['callpath'].dag_hash(), s['callpath'].format('$_$/'))
dyninst_hash, dyninst_lbl = (
- s['dyninst'].dag_hash(), s['dyninst'].format('$_$#'))
+ s['dyninst'].dag_hash(), s['dyninst'].format('$_$/'))
libdwarf_hash, libdwarf_lbl = (
- s['libdwarf'].dag_hash(), s['libdwarf'].format('$_$#'))
+ s['libdwarf'].dag_hash(), s['libdwarf'].format('$_$/'))
libelf_hash, libelf_lbl = (
- s['libelf'].dag_hash(), s['libelf'].format('$_$#'))
+ s['libelf'].dag_hash(), s['libelf'].format('$_$/'))
assert ' "%s" [label="%s"]\n' % (mpileaks_hash, mpileaks_lbl) in dot
assert ' "%s" [label="%s"]\n' % (callpath_hash, callpath_lbl) in dot