1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
From: Johannes 'josch' Schauer <josch@debian.org>
Date: Sun, 22 Jul 2018 15:53:10 +0200
X-Dgit-Generated: 0.21-6 7f3ce50bab648d130983dac64c7bd46e8a98c1d4
Subject: tools/graph-difference.py: allow comparison of arbitrary input graphs
---
--- botch-0.21.orig/Makefile
+++ botch-0.21/Makefile
@@ -146,7 +146,7 @@ define diff_tmp_out
for f in tests/$(1)/$$t/* $$t/*; do basename "$$f"; done | sort | uniq | while read f; do \
echo checking $$f; \
case "$$f" in \
- *.xml) \
+ *.xml|*.dot) \
echo "+ ./tools/graph-difference.py \"tests/$(1)/$$t/$$f\" \"$$t/$$f\""; \
while : ; do ./tools/graph-difference.py "tests/$(1)/$$t/$$f" "$$t/$$f"; exit=$$?; if [ $$exit -eq 139 ]; then echo segfault; continue; fi; if [ $$exit -ne 0 ]; then exit 1; else break; fi; done;; \
*) \
--- botch-0.21.orig/tools/graph-difference.py
+++ botch-0.21/tools/graph-difference.py
@@ -21,34 +21,31 @@ def graph_difference(g, h, verbose=False
return False
def normalize_node(attr):
- if not attr.get('kind'):
- raise Exception("need kind node attribute")
# We delete the cudfversion attribute because vertices should be unique
# by their name and version and not by the cudfversion which may have
# been differently assigned
- if attr.get('version') is not None:
+ if attr.get('version') is not None and 'cudfversion' in attr:
del attr['cudfversion']
- if attr['kind'] == "SCC":
+ if attr.get('kind') == "SCC":
if not attr.get('binaries'):
raise Exception("nodes of kind SCC need the sources attribute")
attr['sources'] = frozenset(
[s for s in attr['sources'].split(',')])
- elif attr['kind'] == "InstSet":
+ elif attr.get('kind') == "InstSet":
if not attr.get('binaries'):
raise Exception(
"nodes of kind InstSet need the binaries attribute")
attr['binaries'] = frozenset(
[p for p in attr['binaries'].split(',')])
- elif attr['kind'] == "SrcPkg":
+ elif attr.get('kind') == "SrcPkg":
pass
- else:
- raise Exception("unknown node type %s" % attr['kind'])
return frozenset(attr.items())
def normalize_edge(attr):
# we delete the id attribute as it has no meaning. Edges are unique by
# the vertices they connect because there can be no multi-edges
- del attr['id']
+ if 'id' in attr:
+ del attr['id']
# only buildgraphs have the kind attribute
if attr.get('kind'):
if attr['kind'] == "buildsfrom":
@@ -66,9 +63,6 @@ def graph_difference(g, h, verbose=False
if attr.get('binaries'):
attr['binaries'] = frozenset(
[s for s in attr['binaries'].split(',')])
- else:
- raise Exception(
- "edge must have binaries attribute in srcgraph")
if attr.get('strong'):
attr['strong'] = frozenset(
[s for s in attr['strong'].split(',')])
|