[OE-core] [PATCH] devtool: Only register each plugin once

Christopher Larson clarson at kergoth.com
Mon Oct 10 19:12:30 UTC 2016


On Mon, Oct 10, 2016 at 7:19 AM, Ola x Nilsson <ola.x.nilsson at axis.com>
wrote:

> When a devtool plugin is shadowed in a higher-priorty layer the
> register_commands method was called on the shadowing plugin once for
> each found plugin with that name.  A simple unique operation on the list
> of loaded plugins solves that problem.  It may still be a problem that
> each plugin - shadowed or not - is loaded and initialized.
>
> Signed-off-by: Ola x Nilsson <ola.x.nilsson at axis.com>
> ---
>  scripts/devtool | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/devtool b/scripts/devtool
> index 0c32c50..7b134a6 100755
> --- a/scripts/devtool
> +++ b/scripts/devtool
> @@ -317,7 +317,7 @@ def main():
>          parser_create_workspace.add_argument('--create-only',
> action="store_true", help='Only create the workspace layer, do not alter
> configuration')
>          parser_create_workspace.set_defaults(func=create_workspace,
> no_workspace=True)
>
> -    for plugin in plugins:
> +    for plugin in set(plugins):
>          if hasattr(plugin, 'register_commands'):
>              plugin.register_commands(subparsers, context)
>

This is directly comparing the plugin modules or classes, which, if there’s
shadowing going on, will almost certainly be different, and we’ll still end
up with the same commands registered multiple times. And of course, use of
set will also change the plugin command registration order. If we’re going
to ignore commands on some of the plugins, it should have avoided loading
them entirely, not load them and then prevent registration. We should
change the plugin *loading* to only load the highest priority (first seen
in bbpath) file for a given .py, based on the file / module name, IMO.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20161010/02ad97d7/attachment-0002.html>


More information about the Openembedded-core mailing list