Deploy for development
This project uses pip to manage the package. If you want to work on the
project yourself you can create the necessary links via:
$ pip3 install --user -e .
That will install a backlink ~/.local/bin/kas to this project. Now you are
able to call it from anywhere.
Docker image build
For the Yocto/OE build image, just run:
$ docker build -t <kas_image_name> .
For the Yocto/OE build image, use:
$ docker build --target kas-isar -t <kas-isar_image_name> .
When you need a proxy to access the internet, add:
--build-arg http_proxy=<http_proxy> --build-arg https_proxy=<https_proxy>
--build-arg ftp_proxy=<ftp_proxy> --build-arg no_proxy=<no_proxy>
to the call.
Class reference documentation
kas.kas
Module
This module is the main entry point for kas, setup tool for bitbake based
projects
-
kas.kas.
create_logger
()[source]
Setup the logging environment
-
kas.kas.
interruption
()[source]
Ignore SIGINT/SIGTERM in kas, let them be handled by our sub-processes
-
kas.kas.
kas
(argv)[source]
The actual main entry point of kas.
-
kas.kas.
kas_get_argparser
()[source]
Creates an argparser for kas with all plugins.
-
kas.kas.
main
()[source]
The main function that operates as a wrapper around kas.
kas.libkas
Module
This module contains the core implementation of kas.
-
class
kas.libkas.
LogOutput
(live)[source]
Handles the log output of executed applications
-
log_stderr
(line)[source]
This method is called when a line is received over stderr.
-
log_stdout
(line)[source]
This method is called when a line is received over stdout.
-
kas.libkas.
find_program
(paths, name)[source]
Find a file within the paths array and returns its path.
-
kas.libkas.
get_build_environ
(build_system)[source]
Creates the build environment variables.
-
kas.libkas.
repos_apply_patches
(repos)[source]
Applies the patches to the repositories.
-
kas.libkas.
repos_fetch
(repos)[source]
Fetches the list of repositories to the kas_work_dir.
-
kas.libkas.
run_cmd
(cmd, cwd, env=None, fail=True, liveupdate=True)[source]
Runs a command synchronously.
-
kas.libkas.
run_cmd_async
(cmd, cwd, env=None, fail=True, liveupdate=True)[source]
Run a command asynchronously.
-
kas.libkas.
ssh_add_key
(env, key)[source]
Adds an ssh key to the ssh-agent
-
kas.libkas.
ssh_add_key_file
(env, key_path)[source]
Adds an ssh key file to the ssh-agent
-
kas.libkas.
ssh_cleanup_agent
()[source]
Removes the identities and stops the ssh-agent instance
-
kas.libkas.
ssh_no_host_key_check
()[source]
Disables ssh host key check
-
kas.libkas.
ssh_setup_agent
(envkeys=None)[source]
Starts the ssh-agent
kas.libcmds
Module
This module contains common commands used by kas plugins.
-
class
kas.libcmds.
CleanupSSHAgent
[source]
Removes all the identities and stops the ssh-agent instance.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
Command
[source]
An abstract class that defines the interface of a command.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
FinishSetupRepos
[source]
Finalizes the repo setup loop
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
InitSetupRepos
[source]
Prepares setting up repos including the include logic
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
Loop
(name)[source]
A class that defines a set of commands as a loop.
-
add
(command)[source]
Appends a command to the loop.
-
execute
(ctx)[source]
Executes the loop.
-
class
kas.libcmds.
Macro
(use_common_setup=True, use_common_cleanup=True)[source]
Contains commands and provides method to run them.
-
add
(command)[source]
Appends commands to the command list.
-
run
(ctx, skip=None)[source]
Runs a command from the command list with respect to the
configuration.
-
class
kas.libcmds.
ReposApplyPatches
[source]
Applies the patches defined in the configuration to the repositories.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
ReposCheckout
[source]
Ensures that the right revision of each repo is checked out.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
ReposFetch
[source]
Fetches repositories defined in the configuration
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
SetupDir
[source]
Creates the build directory.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
SetupEnviron
[source]
Sets up the kas environment.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
SetupHome
[source]
Sets up the home directory of kas.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
SetupReposStep
[source]
Single step of the checkout repos loop
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
SetupSSHAgent
[source]
Sets up the ssh agent configuration.
-
execute
(ctx)[source]
This method executes the command.
-
class
kas.libcmds.
WriteBBConfig
[source]
Writes bitbake configuration files into the build directory.
-
execute
(ctx)[source]
This method executes the command.
kas.config
Module
This module contains the implementation of the kas configuration.
-
class
kas.config.
Config
(ctx, filename, target=None, task=None)[source]
Implements the kas configuration based on config files.
-
find_missing_repos
(repo_paths={})[source]
Returns repos that are in config but not on disk
Returns the bblayers.conf header
-
get_bitbake_targets
()[source]
Returns a list of bitbake targets
-
get_bitbake_task
()[source]
Returns the bitbake task
-
get_build_system
()[source]
Returns the pre-selected build system
-
get_config
()[source]
Returns the config dict.
-
get_distro
()[source]
Returns the distro
-
get_environment
()[source]
Returns the configured environment variables from the configuration
file with possible overwritten values from the environment.
Returns the local.conf header
-
get_machine
()[source]
Returns the machine
-
get_multiconfig
()[source]
Returns the multiconfig array as bitbake string
-
get_repo
(name)[source]
Returns a Repo instance for the configuration with the key
name.
-
get_repos
()[source]
Returns the list of repos.
-
get_repos_config
()[source]
Returns the repository configuration
kas.repos
Module
This module contains the Repo class.
-
class
kas.repos.
GitRepo
(name, url, path, refspec, layers, patches, disable_operations)[source]
Provides the git functionality for a Repo.
-
class
kas.repos.
MercurialRepo
(name, url, path, refspec, layers, patches, disable_operations)[source]
Provides the hg functionality for a Repo.
-
class
kas.repos.
Repo
(name, url, path, refspec, layers, patches, disable_operations)[source]
Represents a repository in the kas configuration.
-
static
factory
(name, repo_config, repo_defaults, repo_fallback_path)[source]
Returns a Repo instance depending on params.
-
static
get_root_path
(path, fallback=True)[source]
Checks if path is under version control and returns its root path.
-
class
kas.repos.
RepoImpl
(name, url, path, refspec, layers, patches, disable_operations)[source]
Provides a generic implementation for a Repo.
-
apply_patches_async
()[source]
Applies patches to a repository asynchronously.
-
checkout
()[source]
Checks out the correct revision of the repo.
-
fetch_async
()[source]
Starts asynchronous repository fetch.
kas.includehandler
Module
This module implements how includes of configuration files are handled in
kas.
-
exception
kas.includehandler.
IncludeException
[source]
Class for exceptions that appear in the include mechanism.
-
class
kas.includehandler.
IncludeHandler
(top_files, top_repo_path)[source]
Implements a handler where every configuration file should
contain a dictionary as the base type with and ‘includes’
key containing a list of includes.
The includes can be specified in two ways: as a string
containing the path, relative to the repository root from the
current file, or as a dictionary. The dictionary must have a
‘file’ key containing the path to the include file and a ‘repo’
key containing the key of the repository. The path is interpreted
relative to the repository root path.
The includes are read and merged from the deepest level upwards.
-
get_config
(repos=None)[source]
- Parameters:
- repos – A dictionary that maps repo names to directory paths
- Returns:
- (config, repos)
- config – A dictionary containing the configuration
repos – A list of missing repo names that are needed to create a complete configuration
-
exception
kas.includehandler.
LoadConfigException
(message, filename)[source]
Class for exceptions that appear while loading a configuration file.
-
kas.includehandler.
load_config
(filename)[source]
Load the configuration file and test if version is supported.
kas.plugins
Module
This module contains and manages kas plugins
-
kas.plugins.
all
()[source]
Get a list of all loaded kas plugin classes
-
kas.plugins.
get
(name)[source]
Lookup a kas plugin class by name
-
kas.plugins.
load
()[source]
Import all kas plugins
-
kas.plugins.
register_plugins
(mod)[source]
Register all kas plugins found in a module