BobBuildTool/bob

plugin and configuration issue

mahaase opened this issue · 3 comments

depending on #428 it seams like, there is something still out of order:

msys2:

$ bob dev -c shortpath amd64::windows/image::example/
An internal Exception has occured. This should not have happenend.
Please open an issue at https://github.com/BobBuildTool/bob with the following backtrace:
Bob version 0.19.2.dev44+g76d4469
Traceback (most recent call last):
  File "/home/mhaase/bob/pym/bob/scripts.py", line 147, in catchErrors
    ret = fun(*args, **kwargs)
  File "/home/mhaase/bob/pym/bob/scripts.py", line 248, in cmd
    ret = cmd(args.args, bobRoot)
  File "/home/mhaase/bob/pym/bob/scripts.py", line 29, in __develop
    doDevelop(*args, **kwargs)
  File "/home/mhaase/bob/pym/bob/cmds/build/build.py", line 313, in doDevelop
    commonBuildDevelop(parser, argv, bobRoot, True)
  File "/home/mhaase/bob/pym/bob/cmds/build/build.py", line 148, in commonBuildDevelop
    recipes.parse(defines)
  File "/home/mhaase/bob/pym/bob/input.py", line 3442, in parse
    self.__parse(envOverrides, platform)
  File "/home/mhaase/bob/pym/bob/input.py", line 3456, in __parse
    self.__parseLayer([], "9999")
  File "/home/mhaase/bob/pym/bob/input.py", line 3550, in __parseLayer
    self.__parseUserConfig(os.path.join(rootDir, "default.yaml"))
  File "/home/mhaase/bob/pym/bob/input.py", line 3597, in __parseUserConfig
    self.__parseUserConfig(p + ".yaml", relativeIncludes)
  File "/home/mhaase/bob/pym/bob/input.py", line 3588, in __parseUserConfig
    if name != "include" and name != "require": self.__settings[name].merge(value)
KeyError: 'ShortPath'

linux:

Parse error: Error while validating user.yaml: Wrong key 'ShortPath' in {'ShortPath': {'path': '/tmp/.bob'}}

i have a plugin in root-recipes-tree: BobBuildTool/basement#94
and tried user.yaml and bob dev -c configfile.

I think the first issue is some caching problem. The Yaml files are loaded and validated. The result is cached but the cache is not invalidated if the schema changes due to plugins being loaded/changed. This has been lurking there since a long time.

But the linux problem is something different. It looks like the plugin was not yet loaded so the "ShortPath" key that should be defined by the plugin does not exist yet. Any chance you could provide some reproducing minimal recipes?

What did change with the last commit was that global configuration files (e.g. /etc/bobdefault.yaml, ~/.config/bob/default.yaml) cannot have keys that are defined by plugins. The simple reason is that plugins are project specific and the global config files get parsed now before a plugin is loaded. The same goes for layers. The default.yaml in a deeper layer cannot have keys of plugins that are loaded in upper layers.

Please see #431 which should fix the issue.

works fine here now. thanks a lot. 👍