diff options
Diffstat (limited to 'scripts/oe-depends-dot')
-rwxr-xr-x | scripts/oe-depends-dot | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/scripts/oe-depends-dot b/scripts/oe-depends-dot index 6c7e9d3383..d02ee455f6 100755 --- a/scripts/oe-depends-dot +++ b/scripts/oe-depends-dot @@ -2,18 +2,8 @@ # # Copyright (C) 2018 Wind River Systems, Inc. # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. +# SPDX-License-Identifier: GPL-2.0-only # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os import sys @@ -24,8 +14,8 @@ import re class Dot(object): def __init__(self): parser = argparse.ArgumentParser( - description="Analyse recipe-depends.dot generated by bitbake -g", - epilog="Use %(prog)s --help to get help") + description="Analyse task-depends.dot generated by bitbake -g", + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("dotfile", help = "Specify the dotfile", nargs = 1, action='store', default='') parser.add_argument("-k", "--key", @@ -42,6 +32,21 @@ class Dot(object): " For example, A->B, B->C, A->C, then A->C can be removed.", action="store_true", default=False) + parser.epilog = """ +Examples: +First generate the .dot file: + bitbake -g core-image-minimal + +To find out why a package is being built: + %(prog)s -k <package> -w ./task-depends.dot + +To find out what a package depends on: + %(prog)s -k <package> -d ./task-depends.dot + +Reduce the .dot file packages only, no tasks: + %(prog)s -r ./task-depends.dot +""" + self.args = parser.parse_args() if len(sys.argv) != 3 and len(sys.argv) < 5: @@ -109,6 +114,10 @@ class Dot(object): if key == "meta-world-pkgdata": continue dep = m.group(2) + key = key.split('.')[0] + dep = dep.split('.')[0] + if key == dep: + continue if key in depends: if not key in depends[key]: depends[key].add(dep) @@ -150,9 +159,14 @@ class Dot(object): reverse_deps = [] if self.args.why: - for k, v in depends.items(): - if self.args.key in v and not k in reverse_deps: - reverse_deps.append(k) + key_list = [self.args.key] + current_key = self.args.key + while (len(key_list) != 0): + current_key = key_list.pop() + for k, v in depends.items(): + if current_key in v and not k in reverse_deps: + reverse_deps.append(k) + key_list.append(k) print('Because: %s' % ' '.join(reverse_deps)) Dot.print_dep_chains(self.args.key, reverse_deps, depends) |