Commit Graph

85 Commits

Author SHA1 Message Date
Henning Schild
62cf4fb0eb libkas: include another space when extending BB_ENV_EXTRAWHITE
the way the env variable got extended broke the last entry in it and the
first entry in the added string because the two strings where not space
separated

i.e.
  "... no_proxySSTATE_DIR ..."
now you shoud get
  "... no_proxy SSTATE_DIR ..."

Seems that problem was in kas since day one.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2018-01-02 12:59:30 +01:00
Henning Schild
4140961b11 libcmds: create directory before open in case it is not there
This could happen if you use kas to checkout repos that do not contain
the directory. i.e. repos that are not actually bb layers

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2018-01-02 12:59:30 +01:00
Henning Schild
19e518cd25 config: support "gentoo" as a known distro
Signed-off-by: Henning Schild <henning.schild@siemens.com>
2018-01-02 12:59:30 +01:00
Daniel Wagner
3c960140fd Release 0.15.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-12-06 16:47:28 +01:00
Claudius Heine
95015045db implementation of environment variable passthrough
With this its possible to create custom environment variables within the kas
configuration file, that are passed through to the build environment:

    env:
      VARIABLE_NAME: "default variable value"

Those variables can be overwritten by variables of the environment kas is
started in:

    $ VARIABLE_NAME="overwritten variable value" kas shell ...

Those variables are also added to the 'BB_ENV_EXTRAWHITE' variable list to make
them available to bitbake.

This is useful for instance storing sensitive information, that should not be
part of the configuration files or bitbake recipes.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-11-24 10:19:12 +01:00
Daniel Wagner
7aff26d105 libkas: Add /sbin and /usr/sbin to PATH
/sbin and /usr/sbin might contain tools Yocto depens on, e.g. 'ip'.

"""
The following required tools (as specified by HOSTTOOLS) appear to be
unavailable in PATH, please install them in order to proceed:

	ip
"""

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-11-20 14:12:28 +01:00
Cedric Hombourger
06b05a35b6 config: support major distro variants
Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
2017-11-09 09:26:43 +01:00
Claudius Heine
fa1575790f multiconfig: implement initial support
This patch adds multiconfig support to kas by defining the
"BBMULTICONFIG" variable in the "local.conf" file.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-11-08 09:42:56 +01:00
Daniel Wagner
f24b341745 Release 0.14.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-11-02 16:02:33 +01:00
Claudius Heine
aa79374f7e config: debug message for list of missing repo names
Its useful to know the missing repos that are required to
create the full configuration as they are detected.

This might help to find problems within the configuration and kas code
in the future.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-19 17:15:26 +02:00
Claudius Heine
3eff938a54 kas: added version output when starting kas
The used version of kas is useful to have in resulting build logs.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-19 17:15:26 +02:00
Claudius Heine
5d7fae7094 configschema: Added copyright and license variables
Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-18 13:49:09 +02:00
Claudius Heine
41fc9c8261 __version__: Added note about updating docs/format-changelog.rst
Since its easy to forget to update the documentation when changing the
configuration file format version, this patch adds a small note to
remind the developer about it.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-18 13:49:06 +02:00
Claudius Heine
4940d4d580 includehandler: remove possible duplicates from the missing_repos list
I was observed that in some more evolved configurations the build
stopped because kas wanted to clone a git repository multiple times
concurrently. This failed.

This patch should prevent these issues by removing all possible
duplicates from the missing_repos list prior to returning it to the
configuration.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-18 10:04:06 +02:00
Claudius Heine
845d212f02 Added 'ftp_proxy' environment variable support
Some bitbake recipes use FTP to fetch objects. This patch adds support
for the ftp_proxy variable to kas. Is now usable in the same manner as
the 'http_proxy' variable

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-16 11:03:07 +02:00
Claudius Heine
f140d7905c config: includehandler: remove other checks that are no longer needed
Using the jsonschema module makes some checks in the includehandler
redundant and can be removed. This patch does this.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-13 14:11:19 +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
Claudius Heine
ab8e4cd375 config: Implemented multi-target support
With this patch support for building multiple targets in parallel with
bitbake is now supported.

Changes:

  - Its now possible to state a list of targets under the target key in
    the configuration file.

    Example:

        target:
          - product-image
          - product-update-image

  - Its now possible to define multiple targets in the kas command line.

    Example:

        $ kas build --target product-image --target product-update-image \
          kas.yml

  - Its now possible to define multiple targets via the environment:

    Example:

        $ export KAS_TARGET="product-image product-update-image"
        $ kas build kas.yml

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-13 14:11:00 +02:00
Claudius Heine
f7d2e5ae20 config: added debug output of complete configuration
It might be useful to see the merged configuration in case of debugging.
This patch adds it to the debug output log level.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-10-13 14:10:47 +02:00
Daniel Wagner
15e6fb0a81 Release 0.13.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-10-10 09:13:50 +02:00
Jan Kiszka
4f76e47090 config: Belatedly increment file version to account for task field
Captain Hindsight: We should have never committed 13a87cb8c7 ("Allow
to define task in config and environment") without forwarding the file
version. Without this, no config file writer can tell kas versions
apart that support task control from those that don't.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-10-10 09:12:20 +02:00
Daniel Wagner
d1968a7f84 Release 0.12.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-10-09 17:53:40 +02:00
Daniel Wagner
133f1be38a libcmds: Remove unused pre and post hooks
9e136e532d ("config: Remove dynamic configuration variant")
removed the posibility to add pre and post hooks. Remove the remaining
bits from libcmds.

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-09-27 10:49:35 +02:00
Jan Kiszka
bfd7770b81 config: Fold ConfigStatic into Config
Now that we no longer have two different configuration variants, we can
remove the abstract class and make Config the primary interface.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-09-27 10:48:59 +02:00
Jan Kiszka
9e136e532d config: Remove dynamic configuration variant
We no longer see an urging use case for it. All field scenarios can
perfectly be modeled with the static format.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-09-27 10:48:35 +02:00
Jan Kiszka
13a87cb8c7 Allow to define task in config and environment
Based on original patch by Sascha Weisenberger.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-09-25 09:33:43 +02:00
Henning Schild
d06bdc4781 libkas: do not use absolute paths when executing programs
Using absolute paths breaks on systems that place the binaries in
another directory and it defeats local overlays with PATH.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2017-09-11 10:19:09 +02:00
Jan Kiszka
affd1184e7 entry: Consistently call python3
This may not be needed in practice, but it is cleaner to align all
shebangs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-08-31 22:31:41 +02:00
Claudius Heine
8745aabb62 kas/shell: add 'keep-config-unchanged' switch
This patch adds a command line argument to the shell plugin, that allows to
enter the shell without changing the bitbake configuration.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-08-04 09:53:50 +02:00
Claudius Heine
11f047a408 kas/shell: Prepare complete bitbake configuration before entering shell
Before this patch, starting the shell in a clean environment, does not
checkout all repository or configures all layers correctly.

This patch adds the missing checkout and configuration steps to the
shell plugin.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-08-01 09:35:34 +02:00
Jan Kiszka
2d6b1ce6a0 libkas: Detect and report multiple init scripts
Having more than one them is a sign of serious problems in the
configuration. Better catch that early and fail loudly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-28 17:29:54 +02:00
Jan Kiszka
eb284afb8e libkas: Detect error of init script
Do not swallow errors of the init script. Rather leave our wrapper
immediately and let run_cmd report the splash and terminate kas.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-28 17:11:54 +02:00
Daniel Wagner
39dba6fe75 Release 0.11.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-07-24 17:17:36 +02:00
Jan Kiszka
bb853cec02 config: Write proper info message about root of URL-less repos
Instead of flooding the log with misleading error messages, always print
a note which path is used as root for repositories that have no URLs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-21 15:34:20 +02:00
Claudius Heine
96034e2d9a config: Allow in-tree repos not to be in a git repo.
If the repo, where the configuration file resides in (in-tree
configuration) is not a git repository, take the directory where the
configuration file is located at as the path of this repo instead of failing.

This patch does not need to raise the configuration file version,
because it does not depend on the configuration file.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-20 16:08:34 +02:00
Jan Kiszka
100c7e047f libkas: Pass git proxy related environment variables
This allows to define GIT_PROXY_COMMAND="oe-git-proxy" outside of kas
and pass this to the build. Now we can pull from native git repos when
there is only a http proxy available.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-20 16:08:34 +02:00
Jan Kiszka
c9326cc1ed Write deterministic local.conf and bblayers.conf
Sort the header sections by their keys and the layers by their names.
This will re-enable writing deterministic config files, and bitbake can
use its cache again, accelerating rebuild startup times a lot.

While at it, indent the layers in bblayers.conf nicely.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-20 15:32:06 +02:00
Jan Kiszka
ef0ef7c60c kas: Also print config format version on --version
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-20 15:31:34 +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
23c3a951f6 config: ConfigStatic should only try to fetch missing known repos
When a configuration file depends on a include from a repo, which is
defined in another included file, a 'KeyError' occures.

This fixes this, so that only known repos are tried to be fetched.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-12 10:22:15 +02:00
Jan Kiszka
f3e8d9ffd8 includehandler: Format LoadConfigException message nicely
This exception is always thrown with both a message and a file name.
Combine them to a single string, instead of throwing tuples.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-12 10:22:15 +02:00
Daniel Wagner
6bc7715f15 Release 0.10.0
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
2017-07-10 12:27:26 +02:00
Jan Kiszka
49cb9b7a7b Fix overwriting of target via command line with static configs
ConfigStatic does not respect the --target overwrite so far. Fix this
by pulling the default definition into ConfigPython (ConfigStatic
already does that via the Config base class) and set the target provided
via the command line in the static config after parsing all files.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-08 22:08:47 +02:00
Jan Kiszka
8e3862112c libkas: Fix false positive of pylint
As suggested by Claudius Heine, reorder the blocks so that we can add
the pylint exception to the if half.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-07 16:57:21 +02:00
Claudius Heine
f10718043e config: Removes file extension check for ConfigStatic
The `load_config` function in the includehandler already checks for the
file extension, so checking it before that, is redundant.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-07 16:57:21 +02:00
Jan Kiszka
f58d44f190 libkas: Properly format stderr dump of failing commands
Inject the linefeed that we removed in f0a18868c9 and add an
introduction line.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-07 16:57:21 +02:00
Claudius Heine
7ef96e732a includehandler: removed sys.exit(), expanded error checks
The application should not be stopped from this code, removed `sys.exit`
and added exceptions to improve error handling.

Also added some more checks that were missing.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-07 16:56:49 +02:00
Jan Kiszka
2be4007113 config: Initialize proxy environment prior to fetching includes
In case of ConfigStatic, proxy settings only come from the host
environment. We need them early, prior to fetching the first missing
repo that is pulled via an include.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-06 09:10:11 +02:00
Claudius Heine
6f37db72d4 Compare the distro_id in lowercase
For me 'distro.id()' returned 'ubuntu' and thats not equal to 'Ubuntu'.
This patch converts the distro id to lowercase before comparing it.

Signed-off-by: Claudius Heine <ch@denx.de>
2017-07-06 09:10:09 +02:00
Jan Kiszka
dd04836896 Ignore SIGINT/TERM at kas level, let sub-processes handle it
This seems to be the cleanest and simplest way of properly terminating
kas while one or more sub-processes are running: just ignore the signal.
The sub-processes will get it as well, and they will terminate
themselves properly. kas will get an error then and shut down. Problem
solved.

Forwarding the signal didn't work reliably anyway because we couldn't
count on kas being a process group leader in all cases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2017-07-06 09:05:52 +02:00