浏览代码

graph-depends: avoid use of global var 'rule' in get_depends

Function get_depends was recently changed to support both normal
dependencies as reverse dependencies, via a global variable 'rule' that
equals 'show-depends' or 'show-rdepends'.

As a subsequent function will extract this function get_depends to a
separate file, the use of globals is problematic.

Instead, pass the global as an argument.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas De Schampheleire 8 年之前
父节点
当前提交
bd8b531d24
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      support/scripts/graph-depends

+ 2 - 2
support/scripts/graph-depends

@@ -161,7 +161,7 @@ def get_targets():
 # Execute the "make <pkg>-show-depends" command to get the list of
 # Execute the "make <pkg>-show-depends" command to get the list of
 # dependencies of a given list of packages, and return the list of
 # dependencies of a given list of packages, and return the list of
 # dependencies formatted as a Python dictionary.
 # dependencies formatted as a Python dictionary.
-def get_depends(pkgs):
+def get_depends(pkgs, rule):
     sys.stderr.write("Getting dependencies for %s\n" % pkgs)
     sys.stderr.write("Getting dependencies for %s\n" % pkgs)
     cmd = ["make", "-s", "--no-print-directory" ]
     cmd = ["make", "-s", "--no-print-directory" ]
     for pkg in pkgs:
     for pkg in pkgs:
@@ -204,7 +204,7 @@ def get_all_depends(pkgs):
     if len(filtered_pkgs) == 0:
     if len(filtered_pkgs) == 0:
         return []
         return []
 
 
-    depends = get_depends(filtered_pkgs)
+    depends = get_depends(filtered_pkgs, rule)
 
 
     deps = set()
     deps = set()
     for pkg in filtered_pkgs:
     for pkg in filtered_pkgs: