summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-01-03 17:58:37 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-01-03 17:58:37 -0800
commitb4b8339d0d13e508119813877559f33049eefbd1 (patch)
tree15add9518079899a633f01a32b99c2c351e9ac9d
parent0a0291678e283bf154081df67b0a1f5c909d1d19 (diff)
downloadspack-b4b8339d0d13e508119813877559f33049eefbd1.tar.gz
spack-b4b8339d0d13e508119813877559f33049eefbd1.tar.bz2
spack-b4b8339d0d13e508119813877559f33049eefbd1.tar.xz
spack-b4b8339d0d13e508119813877559f33049eefbd1.zip
bugfix for dot graphs of virtual packages.
-rw-r--r--lib/spack/spack/cmd/graph.py2
-rw-r--r--lib/spack/spack/graph.py26
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/spack/spack/cmd/graph.py b/lib/spack/spack/cmd/graph.py
index 13efab5fe5..58a411be71 100644
--- a/lib/spack/spack/cmd/graph.py
+++ b/lib/spack/spack/cmd/graph.py
@@ -39,7 +39,7 @@ def setup_parser(subparser):
'--dot', action='store_true',
help="Generate graph in dot format and print to stdout.")
- method.add_argument(
+ subparser.add_argument(
'--concretize', action='store_true', help="Concretize specs before graphing.")
subparser.add_argument(
diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py
index 142c9c5c8f..08bd6f18bb 100644
--- a/lib/spack/spack/graph.py
+++ b/lib/spack/spack/graph.py
@@ -46,6 +46,7 @@ from llnl.util.lang import *
from llnl.util.tty.color import *
import spack
+from spack.spec import Spec
def topological_sort(spec, **kwargs):
@@ -455,23 +456,28 @@ def graph_dot(*specs, **kwargs):
return '"%s"' % string
if not specs:
- packages = spack.db.all_packages()
+ specs = [p.name for p in spack.db.all_packages()]
else:
- packages = []
- for spec in specs:
- packages.extend(s.package for s in spec.normalized().traverse())
+ roots = specs
+ specs = set()
+ for spec in roots:
+ specs.update(Spec(s.name) for s in spec.normalized().traverse())
deps = []
- for pkg in packages:
- out.write(' %-30s [label="%s"]\n' % (quote(pkg.name), pkg.name))
+ for spec in specs:
+ out.write(' %-30s [label="%s"]\n' % (quote(spec.name), spec.name))
+
+ # Skip virtual specs (we'll find out about them from concrete ones.
+ if spec.virtual:
+ continue
# Add edges for each depends_on in the package.
- for dep_name, dep in pkg.dependencies.iteritems():
- deps.append((pkg.name, dep_name))
+ for dep_name, dep in spec.package.dependencies.iteritems():
+ deps.append((spec.name, dep_name))
# If the package provides something, add an edge for that.
- for provider in set(p.name for p in pkg.provided):
- deps.append((provider, pkg.name))
+ for provider in set(s.name for s in spec.package.provided):
+ deps.append((provider, spec.name))
out.write('\n')