diff options
Diffstat (limited to 'bitbake/bin/bitbake-layers')
-rwxr-xr-x | bitbake/bin/bitbake-layers | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index d4b1d1aaf2..341ecbcd97 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers | |||
@@ -18,13 +18,14 @@ import warnings | |||
18 | warnings.simplefilter("default") | 18 | warnings.simplefilter("default") |
19 | 19 | ||
20 | bindir = os.path.dirname(__file__) | 20 | bindir = os.path.dirname(__file__) |
21 | toolname = os.path.basename(__file__).split(".")[0] | ||
21 | topdir = os.path.dirname(bindir) | 22 | topdir = os.path.dirname(bindir) |
22 | sys.path[0:0] = [os.path.join(topdir, 'lib')] | 23 | sys.path[0:0] = [os.path.join(topdir, 'lib')] |
23 | 24 | ||
24 | import bb.tinfoil | 25 | import bb.tinfoil |
25 | import bb.msg | 26 | import bb.msg |
26 | 27 | ||
27 | logger = bb.msg.logger_create('bitbake-layers', sys.stdout) | 28 | logger = bb.msg.logger_create(toolname, sys.stdout) |
28 | 29 | ||
29 | def main(): | 30 | def main(): |
30 | parser = argparse.ArgumentParser( | 31 | parser = argparse.ArgumentParser( |
@@ -33,7 +34,7 @@ def main(): | |||
33 | add_help=False) | 34 | add_help=False) |
34 | parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') | 35 | parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') |
35 | parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') | 36 | parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') |
36 | parser.add_argument('-F', '--force', help='Force add without recipe parse verification', action='store_true') | 37 | parser.add_argument('-F', '--force', help='Forced execution: can be specified multiple times. -F will force add without recipe parse verification and -FF will additionally force the run withput layer parsing.', action='count', default=0) |
37 | parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') | 38 | parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') |
38 | 39 | ||
39 | global_args, unparsed_args = parser.parse_known_args() | 40 | global_args, unparsed_args = parser.parse_known_args() |
@@ -57,18 +58,23 @@ def main(): | |||
57 | level=logger.getEffectiveLevel()) | 58 | level=logger.getEffectiveLevel()) |
58 | 59 | ||
59 | plugins = [] | 60 | plugins = [] |
60 | tinfoil = bb.tinfoil.Tinfoil(tracking=True) | 61 | with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: |
61 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) | 62 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) |
62 | try: | 63 | |
63 | tinfoil.prepare(True) | 64 | if global_args.force > 1: |
64 | for path in ([topdir] + | 65 | bbpaths = [] |
65 | tinfoil.config_data.getVar('BBPATH').split(':')): | 66 | else: |
66 | pluginpath = os.path.join(path, 'lib', 'bblayers') | 67 | tinfoil.prepare(True) |
68 | bbpaths = tinfoil.config_data.getVar('BBPATH').split(':') | ||
69 | |||
70 | for path in ([topdir] + bbpaths): | ||
71 | pluginbasepath = {"bitbake-layers":'bblayers', 'bitbake-config-build':'bbconfigbuild'}[toolname] | ||
72 | pluginpath = os.path.join(path, 'lib', pluginbasepath) | ||
67 | bb.utils.load_plugins(logger, plugins, pluginpath) | 73 | bb.utils.load_plugins(logger, plugins, pluginpath) |
68 | 74 | ||
69 | registered = False | 75 | registered = False |
70 | for plugin in plugins: | 76 | for plugin in plugins: |
71 | if hasattr(plugin, 'tinfoil_init'): | 77 | if hasattr(plugin, 'tinfoil_init') and global_args.force <= 1: |
72 | plugin.tinfoil_init(tinfoil) | 78 | plugin.tinfoil_init(tinfoil) |
73 | if hasattr(plugin, 'register_commands'): | 79 | if hasattr(plugin, 'register_commands'): |
74 | registered = True | 80 | registered = True |
@@ -86,8 +92,6 @@ def main(): | |||
86 | tinfoil.config_data.enableTracking() | 92 | tinfoil.config_data.enableTracking() |
87 | 93 | ||
88 | return args.func(args) | 94 | return args.func(args) |
89 | finally: | ||
90 | tinfoil.shutdown() | ||
91 | 95 | ||
92 | 96 | ||
93 | if __name__ == "__main__": | 97 | if __name__ == "__main__": |