All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] support/scripts/graph-depends cleanup done_deps global
@ 2023-01-22 23:43 Steve Hay via buildroot
  2023-01-22 23:43 ` [Buildroot] [PATCH 2/2] support/scripts/graph-depends allow for forward and reverse depends on same graph Steve Hay via buildroot
  2023-01-23  7:01 ` [Buildroot] [PATCH 1/2] support/scripts/graph-depends cleanup done_deps global Yann E. MORIN
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Hay via buildroot @ 2023-01-22 23:43 UTC (permalink / raw)
  To: buildroot; +Cc: Steve

From: Steve <me@stevenhay.com>

Signed-off-by: Steve Hay <me@stevenhay.com>
---
 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():
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/2] support/scripts/graph-depends cleanup done_deps global
@ 2023-01-23 20:32 Steve Hay via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Hay via buildroot @ 2023-01-23 20:32 UTC (permalink / raw)
  To: buildroot; +Cc: Steve Hay

This commit is cleanup to remove the global done_deps to allow multiple function calls to the DFS search.

Signed-off-by: Steve Hay <me@stevenhay.com>

---
Changes v1 -> v2:
  - Revised author to be full name. (Suggested by Yann)
  - Added a more detailed description of the patch. (Suggested by Yann)
  - Resolution of Yann's comment is that specificying [] (mutable) as default will create a static
    list associated with the function instead of creating a new empty list at each function
    invocation. The existing implementation of specifying None (immutable) and handling default
    case (None) in the function body is idiomatically correct for Python.
---
 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():
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-23 23:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-22 23:43 [Buildroot] [PATCH 1/2] support/scripts/graph-depends cleanup done_deps global Steve Hay via buildroot
2023-01-22 23:43 ` [Buildroot] [PATCH 2/2] support/scripts/graph-depends allow for forward and reverse depends on same graph Steve Hay via buildroot
2023-01-23  7:20   ` Yann E. MORIN
2023-01-23 23:06     ` ʎɐH ǝʌǝʇS via buildroot
2023-01-23  7:01 ` [Buildroot] [PATCH 1/2] support/scripts/graph-depends cleanup done_deps global Yann E. MORIN
     [not found]   ` <f1b4fdfa-786f-2b09-5396-33ad4e79b64f@stevenhay.com>
2023-01-23 20:15     ` ʎɐH ǝʌǝʇS via buildroot
  -- strict thread matches above, loose matches on Subject: below --
2023-01-23 20:32 Steve Hay via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.