2017-06-14 13:36:37 +02:00
|
|
|
# kas - setup tool for bitbake based projects
|
|
|
|
#
|
2018-09-05 11:13:03 +02:00
|
|
|
# Copyright (c) Siemens AG, 2017-2018
|
2017-06-14 13:36:37 +02:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be
|
|
|
|
# included in all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
2017-06-21 13:32:56 +02:00
|
|
|
"""
|
|
|
|
This module contains the implementation of the kas configuration.
|
|
|
|
"""
|
2017-06-14 13:36:37 +02:00
|
|
|
|
|
|
|
import os
|
|
|
|
from .repos import Repo
|
2018-08-24 19:18:08 +02:00
|
|
|
from .includehandler import IncludeHandler, IncludeException
|
2017-06-14 13:36:37 +02:00
|
|
|
|
|
|
|
__license__ = 'MIT'
|
2018-09-05 11:13:03 +02:00
|
|
|
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
|
2017-06-14 13:36:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
2017-06-21 13:32:56 +02:00
|
|
|
"""
|
2017-09-25 18:59:43 +02:00
|
|
|
Implements the kas configuration based on config files.
|
2017-06-21 13:32:56 +02:00
|
|
|
"""
|
2017-09-25 18:59:43 +02:00
|
|
|
def __init__(self, filename, target, task=None):
|
2018-11-07 17:09:47 +01:00
|
|
|
self._override_target = target
|
|
|
|
self._override_task = task
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
self._config = {}
|
2018-08-24 19:18:08 +02:00
|
|
|
self.filenames = []
|
|
|
|
|
|
|
|
for configfile in filename.split(':'):
|
|
|
|
configfile = os.path.abspath(configfile)
|
|
|
|
repo_path = Repo.get_root_path(os.path.dirname(configfile),
|
|
|
|
fallback=False)
|
|
|
|
if self.filenames == []:
|
|
|
|
common_path = repo_path
|
|
|
|
elif repo_path != common_path:
|
|
|
|
raise IncludeException('All concatenated config files must '
|
|
|
|
'belong to the same repository or all '
|
|
|
|
'must be outside of versioning control')
|
|
|
|
self.filenames.append(configfile)
|
|
|
|
|
|
|
|
self.handler = IncludeHandler(self.filenames)
|
2018-04-03 17:36:42 +02:00
|
|
|
self.repo_dict = self._get_repo_dict()
|
2017-10-13 12:20:03 +02:00
|
|
|
|
2018-08-13 14:11:22 +02:00
|
|
|
def find_missing_repos(self):
|
2017-06-21 13:32:56 +02:00
|
|
|
"""
|
2018-08-13 14:11:22 +02:00
|
|
|
Returns repos that are in config but not on disk
|
2017-06-21 13:32:56 +02:00
|
|
|
"""
|
2018-08-13 14:11:22 +02:00
|
|
|
repo_paths = {}
|
|
|
|
(self._config, missing_repo_names) = \
|
|
|
|
self.handler.get_config(repos=repo_paths)
|
2017-06-21 13:32:56 +02:00
|
|
|
|
2018-08-13 14:11:22 +02:00
|
|
|
return missing_repo_names
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
|
|
|
def get_repos(self):
|
|
|
|
"""
|
|
|
|
Returns the list of repos.
|
|
|
|
"""
|
|
|
|
|
2018-08-13 14:11:22 +02:00
|
|
|
# Always keep repo_dict and repos synchronous
|
|
|
|
# when calling get_repos
|
|
|
|
self.repo_dict = self._get_repo_dict()
|
2018-04-03 17:36:42 +02:00
|
|
|
return list(self.repo_dict.values())
|
2017-09-25 18:59:43 +02:00
|
|
|
|
2018-04-03 17:36:42 +02:00
|
|
|
def _get_repo_dict(self):
|
2017-09-25 18:59:43 +02:00
|
|
|
"""
|
|
|
|
Returns a dictionary containing the repositories with
|
2018-09-05 11:13:03 +02:00
|
|
|
their names (as it is defined in the config file) as keys
|
|
|
|
and the `Repo` instances as values.
|
2017-09-25 18:59:43 +02:00
|
|
|
"""
|
|
|
|
repo_config_dict = self._config.get('repos', {})
|
2020-07-04 09:53:38 +02:00
|
|
|
repo_defaults = self._config.get('defaults', {}).get('repos', {})
|
2017-09-25 18:59:43 +02:00
|
|
|
repo_dict = {}
|
2018-08-24 19:18:08 +02:00
|
|
|
repo_fallback_path = os.path.dirname(self.filenames[0])
|
2017-09-25 18:59:43 +02:00
|
|
|
for repo in repo_config_dict:
|
|
|
|
repo_config_dict[repo] = repo_config_dict[repo] or {}
|
2018-08-24 19:18:02 +02:00
|
|
|
repo_dict[repo] = Repo.factory(repo,
|
|
|
|
repo_config_dict[repo],
|
2020-07-04 09:53:38 +02:00
|
|
|
repo_defaults,
|
2018-08-24 19:18:02 +02:00
|
|
|
repo_fallback_path)
|
2018-01-05 16:00:29 +01:00
|
|
|
|
2017-09-25 18:59:43 +02:00
|
|
|
return repo_dict
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
2017-10-13 12:20:04 +02:00
|
|
|
def get_bitbake_targets(self):
|
|
|
|
"""
|
|
|
|
Returns a list of bitbake targets
|
|
|
|
"""
|
2018-11-07 17:09:47 +01:00
|
|
|
if self._override_target:
|
|
|
|
return self._override_target
|
2017-10-13 12:20:04 +02:00
|
|
|
environ_targets = [i
|
|
|
|
for i in os.environ.get('KAS_TARGET', '').split()
|
|
|
|
if i]
|
|
|
|
if environ_targets:
|
|
|
|
return environ_targets
|
|
|
|
target = self._config.get('target', 'core-image-minimal')
|
|
|
|
if isinstance(target, str):
|
|
|
|
return [target]
|
|
|
|
return target
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
2017-09-25 09:08:09 +02:00
|
|
|
def get_bitbake_task(self):
|
|
|
|
"""
|
2018-09-05 11:13:03 +02:00
|
|
|
Returns the bitbake task
|
2017-09-25 09:08:09 +02:00
|
|
|
"""
|
2018-11-07 17:09:47 +01:00
|
|
|
if self._override_task:
|
|
|
|
return self._override_task
|
2017-09-25 09:08:09 +02:00
|
|
|
return os.environ.get('KAS_TASK',
|
|
|
|
self._config.get('task', 'build'))
|
|
|
|
|
2017-07-03 11:34:31 +02:00
|
|
|
def _get_conf_header(self, header_name):
|
|
|
|
"""
|
|
|
|
Returns the local.conf header
|
|
|
|
"""
|
|
|
|
header = ''
|
2017-07-17 22:38:07 +02:00
|
|
|
for key, value in sorted(self._config.get(header_name, {}).items()):
|
2017-07-03 11:34:31 +02:00
|
|
|
header += '# {}\n{}\n'.format(key, value)
|
|
|
|
return header
|
|
|
|
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
def get_bblayers_conf_header(self):
|
|
|
|
"""
|
|
|
|
Returns the bblayers.conf header
|
|
|
|
"""
|
2017-07-03 11:34:31 +02:00
|
|
|
return self._get_conf_header('bblayers_conf_header')
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
|
|
|
def get_local_conf_header(self):
|
|
|
|
"""
|
|
|
|
Returns the local.conf header
|
|
|
|
"""
|
2017-07-03 11:34:31 +02:00
|
|
|
return self._get_conf_header('local_conf_header')
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
|
|
|
def get_machine(self):
|
|
|
|
"""
|
|
|
|
Returns the machine
|
|
|
|
"""
|
2017-06-28 14:48:39 +02:00
|
|
|
return os.environ.get('KAS_MACHINE',
|
2020-02-15 14:10:30 +01:00
|
|
|
self._config.get('machine', 'qemux86-64'))
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
|
|
|
def get_distro(self):
|
|
|
|
"""
|
|
|
|
Returns the distro
|
|
|
|
"""
|
2017-06-28 14:48:39 +02:00
|
|
|
return os.environ.get('KAS_DISTRO',
|
|
|
|
self._config.get('distro', 'poky'))
|
added initial implementation of a include handler
Splitting configuration files into multiple files and implementing an
include mechanism allows to handle configurations more flexible and
allowing following scenarios:
- including kas configuration file from external meta layer into
own project
- splitting many different similar configurations into multiple files
with only a couple of common files
To include file its necessary to add a 'includes' entry into the kas
configuration. To include files from the same repo, do it like this:
-----
includes:
- ../base/base_include.yml
-----
The path is relative to the current configuration file. If they start
with a path seperator ("/") they are absolute.
To include files from a different repository, do it like this:
-----
includes:
- file: bsps/my_machine_include.yml
repo: collected_machines
repos:
collected_machines:
url: https://url.to.git.repo/
revspec: master
-----
You have to make sure that the repository definition is available
in your current file, or in any include that is available at this
point.
Yaml ("*.yml") and Json ("*.json") files are supported.
Included in this patch are also some changes to the configuration
file structure. Here is an overview:
The value of the 'repos' key is a dictionary that maps a repo identifier
to a dictionary that contains 5 entries:
- url: The url to the repository. If that is missing, no git operations
are used
- refspec: The git refspec of the repository that is used. If that is
missing the latest commit of the default branch is used.
- name: The is defines under which name the repository is stored. If
that is missing the repository identifier is used
- path: The path where the repository is stored. If no url is given and
a path is missing, the repository is referencing the repository under
which the configuration file is stored. If no url is given and a path is
specified, the repository is referencing a directory where layers might
be stored. If an url is specified, path can be used to overwrite the
default (kas_work_dir + repo.name) checkout directory.
- layers: This contains a dictionary of layers, that should be included
into the bblayers.conf. The keys are paths relative to the repository
and the values can be used to exclude layers if they are one of
"excluded", "disabled", "false", "0", "n", or "no". Also boolean values
are accepted. Any other value, including "None" means that this layer is
included into the bblayers.conf. If "layers" is missing or empty, the
repository itself is included into the bblayers. If this is specified, the
repository itself is not included into the bblayers.conf.
Signed-off-by: Claudius Heine <ch@denx.de>
2017-06-21 13:32:58 +02:00
|
|
|
|
2017-11-23 14:15:51 +01:00
|
|
|
def get_environment(self):
|
|
|
|
"""
|
|
|
|
Returns the configured environment variables from the configuration
|
2018-09-05 11:13:03 +02:00
|
|
|
file with possible overwritten values from the environment.
|
2017-11-23 14:15:51 +01:00
|
|
|
"""
|
|
|
|
env = self._config.get('env', {})
|
|
|
|
return {var: os.environ.get(var, env[var]) for var in env}
|
|
|
|
|
2017-11-07 17:20:17 +01:00
|
|
|
def get_multiconfig(self):
|
|
|
|
"""
|
|
|
|
Returns the multiconfig array as bitbake string
|
|
|
|
"""
|
2019-11-07 21:12:35 +01:00
|
|
|
multiconfigs = []
|
|
|
|
for target in self.get_bitbake_targets():
|
|
|
|
if target.startswith('multiconfig:') or target.startswith('mc:'):
|
|
|
|
multiconfigs.append(target.split(':')[1])
|
|
|
|
return ' '.join(multiconfigs)
|