Developer Guide

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

Just run:

$ docker build -t <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 main entry point of kas.

kas.kas.kas_get_argparser()[source]

Creates a 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 over stderr is received.

log_stdout(line)[source]

This method is called when a line over stdout is received.

kas.libkas.find_program(paths, name)[source]

Find a file within the paths array and returns its path.

kas.libkas.get_build_environ(config, build_dir)[source]

Create the build environment variables.

kas.libkas.kasplugin(plugin_class)[source]

A decorator that registeres kas plugins

kas.libkas.repos_apply_patches(config, repos)[source]

Applies the patches to the repositories.

kas.libkas.repos_fetch(config, repos)[source]

Fetches the list of repositories to the kas_work_dir.

kas.libkas.run_cmd(cmd, cwd, env=None, fail=True, shell=False, liveupdate=True)[source]

Runs a command synchronously.

kas.libkas.run_cmd_async(cmd, cwd, env=None, fail=True, shell=False, liveupdate=True)[source]

Run a command asynchronously.

kas.libkas.ssh_add_key(env, key)[source]

Add ssh key to the ssh-agent

kas.libkas.ssh_cleanup_agent(config)[source]

Removes the identities and stop the ssh-agent instance

kas.libkas.ssh_no_host_key_check(_)[source]

Disables ssh host key check

kas.libkas.ssh_setup_agent(config, envkeys=None)[source]

Starts the ssh-agent

kas.libcmds Module

This module contain common commands used by kas plugins.

class kas.libcmds.CleanupSSHAgent[source]

Remove all the identities and stop the ssh-agent instance.

execute(config)[source]

This method executes the command.

class kas.libcmds.Command[source]

An abstract class that defines the interface of a command.

execute(config)[source]

This method executes the command.

class kas.libcmds.Macro[source]

Contains commands and provide method to run them.

add(command)[source]

Appends commands to the command list.

run(config, skip=None)[source]

Runs command from the command list respective to the configuration.

class kas.libcmds.ReposApplyPatches[source]

Applies the patches defined in the configuration to the repositories.

execute(config)[source]

This method executes the command.

class kas.libcmds.ReposCheckout[source]

Ensures that the right revision of each repo is check out.

execute(config)[source]

This method executes the command.

class kas.libcmds.ReposFetch[source]

Fetches repositories defined in the configuration

execute(config)[source]

This method executes the command.

class kas.libcmds.SetupDir[source]

Creates the build directory.

execute(config)[source]

This method executes the command.

class kas.libcmds.SetupEnviron[source]

Setups the kas environment.

execute(config)[source]

This method executes the command.

class kas.libcmds.SetupHome[source]

Setups the home directory of kas.

execute(config)[source]

This method executes the command.

class kas.libcmds.SetupProxy[source]

Setups proxy configuration in the kas environment.

execute(config)[source]

This method executes the command.

class kas.libcmds.SetupSSHAgent[source]

Setup the ssh agent configuration.

execute(config)[source]

This method executes the command.

class kas.libcmds.WriteConfig[source]

Writes bitbake configuration files into the build directory.

execute(config)[source]

This method executes the command.

kas.build Module

The build plugin for kas.

class kas.build.BuildCommand(task)[source]

Implement the bitbake build step.

execute(config)[source]

Executes the bitbake build command.

kas.shell Module

This module contains a kas plugin that opens a shell within the kas environment

class kas.shell.ShellCommand(cmd)[source]

This class implements the command that starts a shell.

execute(config)[source]

This method executes the command.

kas.config Module

This module contains the implementation of the kas configuration.

class kas.config.Config(filename, target, task=None)[source]

Implements the kas configuration based on config files.

build_dir

The path of the build directory.

get_bblayers_conf_header()[source]

Returns the bblayers.conf header

get_bitbake_targets()[source]

Returns a list of bitbake targets

get_bitbake_task()[source]

Return the bitbake task

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.

get_gitlabci_config()[source]

Returns the GitlabCI configuration

get_local_conf_header()[source]

Returns the local.conf header

get_machine()[source]

Returns the machine

get_multiconfig()[source]

Returns the multiconfig array as bitbake string

get_proxy_config()[source]

Returns the proxy settings

get_repo_ref_dir()[source]

The path to the directory that contains the repository references.

get_repos()[source]

Returns the list of repos.

kas_work_dir

The path to the kas work directory.

setup_environ()[source]

Sets the environment variables for process that are started by kas.

kas.config.get_distro_id_base()[source]

Wrapper around platform.dist to simulate distro.id platform.dist is deprecated and will be removed in python 3.7 Use the ‘distro’ package instead.

kas.repos Module

This module contains the Repo class.

class kas.repos.GitRepo(url, path, refspec, layers, patches, disable_operations)[source]

Provides the git implementations for a Repo.

class kas.repos.MercurialRepo(url, path, refspec, layers, patches, disable_operations)[source]

Provides the hg implementations for a Repo.

class kas.repos.Repo(url, path, refspec, layers, patches, disable_operations)[source]

Represents a repository in the kas configuration.

static factory(name, repo_config, config)[source]

Return an instance Repo depending on params.

static get_root_path(path, environ)[source]

Check if path is a version control repo and return its root path.

class kas.repos.RepoImpl(url, path, refspec, layers, patches, disable_operations)[source]

Provides a generic implementation for a Repo.

apply_patches_async(config)[source]

Applies patches to repository asynchronously.

checkout(config)[source]

Checks out the correct revision of the repo.

fetch_async(config)[source]

Start asynchronous repository fetch.

kas.includehandler Module