From 0c2e6050cc7cae25dfbae1fb6795e7b21e3362d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=8E=C9=90H=20=C7=9D=CA=8C=C7=9D=CA=87S?= Date: Mon, 23 Jan 2023 21:32:11 +0100 Subject: [PATCH] support/scripts/graph-depends: remove global done_deps variable Instead of having done_deps as a global variable, pass it as an argument to the print_pkg_deps function. This will allow the recursive search to be started multiple times. Signed-off-by: Steve Hay Signed-off-by: Arnout Vandecappelle --- support/scripts/graph-depends | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends index a66fb28f41..3e3373950f 100755 --- a/support/scripts/graph-depends +++ b/support/scripts/graph-depends @@ -197,12 +197,11 @@ def print_attrs(outfile, pkg, pkg_type, pkg_version, depth, colors): outfile.write("%s [color=%s,style=filled]\n" % (name, color)) -done_deps = [] - - # Print the dependency graph of a package def print_pkg_deps(outfile, dict_deps, dict_types, dict_versions, stop_list, exclude_list, - arrow_dir, draw_graph, depth, max_depth, pkg, colors): + arrow_dir, draw_graph, depth, max_depth, pkg, colors, done_deps=None): + if done_deps is None: + done_deps = [] if pkg in done_deps: return done_deps.append(pkg) @@ -234,7 +233,7 @@ def print_pkg_deps(outfile, dict_deps, dict_types, dict_versions, stop_list, exc if draw_graph: outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) print_pkg_deps(outfile, dict_deps, dict_types, dict_versions, stop_list, exclude_list, - arrow_dir, draw_graph, depth + 1, max_depth, d, colors) + arrow_dir, draw_graph, depth + 1, max_depth, d, colors, done_deps) def parse_args():