From b43165328658087277b667152fdbc04fe07cba08 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Tue, 15 May 2018 14:46:21 +0200 Subject: 3rd part of the layer/profile rework [1/2] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the last larger commit in this series and deals with the graphical part. We introduce the graphical profiles: - meta-agl-profile-graphical -- meta-agl-profile-graphical-html5 -- meta-agl-profile-graphical-qt5 Notable changes: - weston-ini-conf moved to the meta-agl-bsp layer. Most BSPs have bbappends, so we need to have the recipes present (but unused) even in the console images. - new image: agl-image-boot = terminal-only + network + package-manaager. Ready for using package-feeds - new image/sdk: agl-image-minimal-crosssdk - agl-service-mediaplayer has a dependency on weston, thus it cannot be in the 'core'. Moved it to profile-graphical. - The wayland-ivi-extension moved to the agl-demo-platform. - The app-framework layer included and pulled 'web-runtime' as dependency. This broke console-only images. This has been moved to be in meta-agl-demo only for now. - added and massaged the agl-features. - found and added a useful script 'oe-depends-dot' that helps to work with the dot files (produced with bitbake -g) Todo: - we'll need another pass through the packagegroups. The dependencies for the layers/profiles are now sorted-out but we might have to add/shuffle a few packages. For further details, see meta-agl/docs/profiles.md. v2: fix meta-agl/meta-security/conf/layer.conf - the immediate expansion previously used in there caused some recipes not being added to BBFILES. v3: fix packagegroup renaming (packagegroup-agl-devel -> packagegroup-agl-core-devel) v4: fix missing packagegroup inclusion (tnx Jose, Scott, Stephane) v5: fix missing packagegroup inclusion v6: explicitely put profile-graphical-qt5 on-top of profile-graphical v7: re-add 'procps' when agl-devel feature is on Bug-AGL: SPEC-145 Change-Id: I24cdcd1118932758d0c55d333338238f2a770877 Signed-off-by: Jan-Simon Möller --- meta-agl-distro/scripts/oe-depends-dot | 121 +++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100755 meta-agl-distro/scripts/oe-depends-dot (limited to 'meta-agl-distro/scripts') diff --git a/meta-agl-distro/scripts/oe-depends-dot b/meta-agl-distro/scripts/oe-depends-dot new file mode 100755 index 000000000..5cec23bf0 --- /dev/null +++ b/meta-agl-distro/scripts/oe-depends-dot @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +# +# 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. +# +# 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 +import argparse +import logging +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") + parser.add_argument("dotfile", + help = "Specify the dotfile", nargs = 1, action='store', default='') + parser.add_argument("-k", "--key", + help = "Specify the key, e.g., recipe name", + action="store", default='') + parser.add_argument("-d", "--depends", + help = "Print the key's dependencies", + action="store_true", default=False) + parser.add_argument("-w", "--why", + help = "Print why the key is built", + action="store_true", default=False) + parser.add_argument("-r", "--remove", + help = "Remove duplicated dependencies to reduce the size of the dot files." + " For example, A->B, B->C, A->C, then A->C can be removed.", + action="store_true", default=False) + + self.args = parser.parse_args() + + if len(sys.argv) != 3 and len(sys.argv) < 5: + print('ERROR: Not enough args, see --help for usage') + + def main(self): + #print(self.args.dotfile[0]) + # The format is {key: depends} + depends = {} + with open(self.args.dotfile[0], 'r') as f: + for line in f.readlines(): + if ' -> ' not in line: + continue + line_no_quotes = line.replace('"', '') + m = re.match("(.*) -> (.*)", line_no_quotes) + if not m: + print('WARNING: Found unexpected line: %s' % line) + continue + key = m.group(1) + if key == "meta-world-pkgdata": + continue + dep = m.group(2) + if key in depends: + if not key in depends[key]: + depends[key].add(dep) + else: + print('WARNING: Fonud duplicated line: %s' % line) + else: + depends[key] = set() + depends[key].add(dep) + + if self.args.remove: + reduced_depends = {} + for k, deps in depends.items(): + child_deps = set() + added = set() + # Both direct and indirect depends are already in the dict, so + # we don't have to do this recursively. + for dep in deps: + if dep in depends: + child_deps |= depends[dep] + + reduced_depends[k] = deps - child_deps + outfile= '%s-reduced%s' % (self.args.dotfile[0][:-4], self.args.dotfile[0][-4:]) + with open(outfile, 'w') as f: + print('Saving reduced dot file to %s' % outfile) + f.write('digraph depends {\n') + for k, v in reduced_depends.items(): + for dep in v: + f.write('"%s" -> "%s"\n' % (k, dep)) + f.write('}\n') + sys.exit(0) + + if self.args.key not in depends: + print("ERROR: Can't find key %s in %s" % (self.args.key, self.args.dotfile[0])) + sys.exit(1) + + if self.args.depends: + if self.args.key in depends: + print('Depends: %s' % ' '.join(depends[self.args.key])) + + 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) + print('Because: %s' % ' '.join(reverse_deps)) + +if __name__ == "__main__": + try: + dot = Dot() + ret = dot.main() + except Exception as esc: + ret = 1 + import traceback + traceback.print_exc() + sys.exit(ret) -- cgit 1.2.3-korg