Commit Graph

8 Commits

Author SHA1 Message Date
Jan Kiszka
d4a615bb0b Command line based configuration file merge
This extends the command line syntax for specifying configuration files.
You can now combine files by concatenating them, separated by colons:

kas build base.yml:board.yml:feature.yml

The motivation for this feature is to avoid having to write tons of
configuration files that perform this combinations statically via
includes.

In order to avoid complications and prevent that users shoot themselves
too easily into their feet, we deny the case of distributing the
configuration files over multiple repositories. Either all files
specified on the command line come from the same repo, or they are all
local (without versioning control).

Based on idea by Claudius Heine.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2018-08-27 07:54:32 +02:00
Jan Kiszka
5c28272d73 includehandler: Fold GlobalIncludes into IncludeHandler class
No user for this abstraction in sight.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2018-08-27 07:48:08 +02:00
Daniel Wagner
9fc8c7735c test_includehandler: Fix indention
pylint reports

tests/test_includehandler.py:343:0: C0330: Wrong hanging indentation before block (add 4 spaces).
            'x.yml': header.format('''  includes: ["y.yml", "z.yml"]
            ^   | (bad-continuation)
tests/test_includehandler.py:345:0: C0330: Wrong hanging indentation before block (add 4 spaces).
            os.path.abspath('y.yml'): header.format('''  includes: ["z.yml"]
            ^   | (bad-continuation)
tests/test_includehandler.py:347:0: C0330: Wrong hanging indentation before block (add 4 spaces).
            os.path.abspath('z.yml'): header.format('''
            ^   | (bad-continuation)

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2018-07-18 16:26:47 +02:00
Daniel Wagner
f60a8b4e6d test_includehandler: Remove useless object inheritanc
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2018-07-18 16:26:47 +02:00
Daniel Wagner
c1e5c4f379 build: Fix all style reports by pycodestyle v2.4.0
pycodestyle v2.4.0 checks for W606 (async deprecated), but
we can't disable it on source code level with '# noqa'. Let's disable
the check globaly. We will still catch it with pylint.

By disabling the W606 we need also to list the W503 which was
previously active.

While at it fix following things:

./docs/conf.py:252:6: E121 continuation line under-indented for hanging indent
./docs/conf.py:257:6: E126 continuation line over-indented for hanging indent
./kas/build.py:123:17: W504 line break after binary operator
./kas/configschema.py:48:25: E123 closing bracket does not match indentation of opening bracket's line
./kas/configschema.py:49:21: E123 closing bracket does not match indentation of opening bracket's line
./tests/test_includehandler.py:82:13: E123 closing bracket does not match indentation of opening bracket's line
./tests/test_includehandler.py:121:13: E123 closing bracket does not match indentation of opening bracket's line

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2018-05-17 13:00:26 +02:00
Claudius Heine
75fa095aa5 config: Added schema validation for configuration files
Currently many of the error messages regarding the configuration file
are not really helpful.

To improve reporting this patch adds validation of the configuration
files using the jsonschema module.

Example:

  Forgetting ':' at the end of a layer definition, like this:

    repos:
      meta-iot2000:
        layers:
          meta-iot2000-example
                              ^

  Exception before:

    TypeError: string indices must be integers

  Exception after:

    Validation Error:
     'meta-iot2000-example' is not of type 'object'

     Failed validating 'type' in schema['properties']['repos']['additionalProperties']['properties']['layers']:
         {'additionalProperties': {'oneOf': [{'type': 'null'},
                                             {'type': 'integer'},
                                             {'type': 'boolean'},
                                             {'type': 'string'}]},
          'type': 'object'}

     On instance['repos']['meta-iot2000']['layers']:
         'meta-iot2000-example'

This patch adds 'jsonschema' as an additional dependency.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-13 14:11:10 +02:00
Jan Kiszka
2a618686f1 Switch to separate config file version
Use a separately incremented integer to track the configuration file
format version. We start with 2 due to the change that 23c3a951f6
introduced. 1 is declared to be equivalent to the original '0.10'.

The separate versioning has the advantage of being able to increment it
already during the development cycle, and using it with config files
that test/exploit the new format.

Using an integer has the advantages of a) differentiating it clearly
from the now independent kas version and b) simplifying the version
parsing. We can now also remove the string type restriction.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-20 15:31:23 +02:00
Claudius Heine
a482a86eb0 tests/includehandler: added initial tests for includehandler
Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-07 16:56:49 +02:00