kiwi.repository Package
Submodules
kiwi.repository.base
Module
- class kiwi.repository.base.RepositoryBase(root_bind: RootBind, custom_args: List = [])[source]
Bases:
object
Implements base class for package manager repository handling
Attributes
- Parameters:
root_bind (object) – instance of
RootBind
root_dir (str) – root directory path name
shared_location (str) – shared directory between image root and build system root
- add_repo(name: str, uri: str, repo_type: str, prio: int, dist: str, components: str, user: str, secret: str, credentials_file: str, repo_gpgcheck: bool, pkg_gpgcheck: bool, sourcetype: str, customization_script: str | None = None, architectures: str | None = None) None [source]
Add repository
Implementation in specialized repository class
- Parameters:
name (str) – unused
uri (str) – unused
repo_type (str) – unused
prio (int) – unused
dist (str) – unused
components (str) – unused
user (str) – unused
secret (str) – unused
credentials_file (str) – unused
repo_gpgcheck (bool) – unused
pkg_gpgcheck (bool) – unused
sourcetype (str) – unused
customization_script (str) – unused
architectures (str) – unused
- cleanup_unused_repos() None [source]
Cleanup/Delete unused repositories
Only configured repositories according to the image configuration are allowed to be active when building
Implementation in specialized repository class
- delete_all_repos() None [source]
Delete all repositories
Implementation in specialized repository class
- delete_repo(name: str) None [source]
Delete repository
Implementation in specialized repository class
- Parameters:
name (str) – unused
- delete_repo_cache(name: str) None [source]
Delete repository cache
Implementation in specialized repository class
- Parameters:
name (str) – unused
- import_trusted_keys(signing_keys: List) None [source]
Imports trusted keys into the image
Implementation in specialized repository class
- Parameters:
signing_keys (list) – list of the key files to import
- post_init(custom_args: List = []) None [source]
Post initialization method
Implementation in specialized repository class
- Parameters:
custom_args (list) – unused
- static run_repo_customize(script_path: str, repo_file) None [source]
Run an optional customization script
- Parameters:
script_path (str) – unused
repo_file (str) – unused
- runtime_config() Dict [source]
Repository runtime configuration and environment
Implementation in specialized repository class
kiwi.repository.dnf4
Module
- class kiwi.repository.dnf4.RepositoryDnf4(root_bind: RootBind, custom_args: List = [])[source]
Bases:
RepositoryBase
Implements repository handling for dnf package manager
- Parameters:
shared_dnf_dir (str) – shared directory between image root and build system root
runtime_dnf_config_file (str) – dnf runtime config file name
command_env (dict) – customized os.environ for dnf
runtime_dnf_config (str) – instance of
ConfigParser
- add_repo(name: str, uri: str, repo_type: str = 'rpm-md', prio: int | None = None, dist: str | None = None, components: str | None = None, user: str | None = None, secret: str | None = None, credentials_file: str | None = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, sourcetype: str | None = None, customization_script: str | None = None, architectures: str | None = None) None [source]
Add dnf repository
- Parameters:
name (str) – repository base file name
uri (str) – repository URI
repo_type (str) – repostory type name
prio (int) – dnf repostory priority
dist (str) – unused
components (str) – unused
user (str) – unused
secret (str) – unused
credentials_file (str) – unused
repo_gpgcheck (bool) – enable repository signature validation
pkg_gpgcheck (bool) – enable package signature validation
sourcetype (str) – source type, one of ‘baseurl’, ‘metalink’ or ‘mirrorlist’
customization_script (str) – custom script called after the repo file was created
architectures (str) – unused
- cleanup_unused_repos() None [source]
Delete unused dnf repositories
Repository configurations which are not used for this build must be removed otherwise they are taken into account for the package installations
- delete_repo(name: str) None [source]
Delete dnf repository
- Parameters:
name (str) – repository base file name
- delete_repo_cache(name: str) None [source]
Delete dnf repository cache
The cache data for each repository is stored in a directory and additional files all starting with the repository name. The method glob deletes all files and directories matching the repository name followed by any characters to cleanup the cache information
- Parameters:
name (str) – repository name
- import_trusted_keys(signing_keys: List) None [source]
Imports trusted keys into the image
- Parameters:
signing_keys (list) – list of the key files to import
- post_init(custom_args: List = []) None [source]
Post initialization method
Store custom dnf arguments and create runtime configuration and environment
- Parameters:
custom_args (list) – dnf arguments
- runtime_config() Dict [source]
dnf runtime configuration and environment
- Returns:
dnf_args:list, command_env:dict
- Return type:
dict
- setup_package_database_configuration() None [source]
Setup rpm macros for bootstrapping and image building
Create the rpm image macro which persists during the build
Create the rpm bootstrap macro to make sure for bootstrapping the rpm database location matches the host rpm database setup. This macro only persists during the bootstrap phase. If the image was already bootstrapped a compat link is created instead.
kiwi.repository.zypper
Module
- class kiwi.repository.zypper.RepositoryZypper(root_bind: RootBind, custom_args: List = [])[source]
Bases:
RepositoryBase
Implements repo handling for zypper package manager
- Parameters:
shared_zypper_dir (str) – shared directory between image root and build system root
runtime_zypper_config_file (str) – zypper runtime config file name
runtime_zypp_config_file (str) – libzypp runtime config file name
zypper_args (list) – zypper caller args plus additional custom args
command_env (dict) – customized os.environ for zypper
runtime_zypper_config (object) – instance of
ConfigParser
- add_repo(name: str, uri: str, repo_type: str = 'rpm-md', prio: int | None = None, dist: str | None = None, components: str | None = None, user: str | None = None, secret: str | None = None, credentials_file: str | None = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, sourcetype: str | None = None, customization_script: str | None = None, architectures: str | None = None) None [source]
Add zypper repository
- Parameters:
name (str) – repository name
uri (str) – repository URI
repo_type (str) – repostory type name
prio (int) – zypper repostory priority
dist (str) – unused
components (str) – unused
user (str) – credentials username
secret (str) – credentials password
credentials_file (str) – zypper credentials file
repo_gpgcheck (bool) – enable repository signature validation
pkg_gpgcheck (bool) – enable package signature validation
sourcetype (str) – unused
customization_script (str) – custom script called after the repo file was created
architectures (str) – unused
- cleanup_unused_repos() None [source]
Delete unused zypper repositories
zypper creates a system solvable which is unwanted for the purpose of building images. In addition zypper fails with an error message ‘Failed to cache rpm database’ if such a system solvable exists and a new root system is created
All other repository configurations which are not used for this build must be removed too, otherwise they are taken into account for the package installations
- delete_repo(name: str) None [source]
Delete zypper repository
- Parameters:
name (str) – repository name
- delete_repo_cache(name: str) None [source]
Delete zypper repository cache
The cache data for each repository is stored in a list of directories of the same name as the repository name. The method deletes these directories to cleanup the cache information
- Parameters:
name (str) – repository name
- import_trusted_keys(signing_keys: List) None [source]
Imports trusted keys into the image
- Parameters:
signing_keys (list) – list of the key files to import
- post_init(custom_args: List = []) None [source]
Post initialization method
Store custom zypper arguments and create runtime configuration and environment
- Parameters:
custom_args (list) – zypper arguments
- setup_package_database_configuration() None [source]
Setup rpm macros for bootstrapping and image building
Create the rpm image macro which persists during the build
Create the rpm bootstrap macro to make sure for bootstrapping the rpm database location matches the host rpm database setup. This macro only persists during the bootstrap phase. If the image was already bootstrapped a compat link is created instead.
Create zypper compat link
Module Contents
- class kiwi.repository.Repository[source]
Bases:
object
Repository factory
- Parameters:
root_bind (object) – instance of RootBind
package_manager (str) – package manager name
custom_args (list) – list of custom package manager arguments to setup the repository
- Raises:
KiwiRepositorySetupError – if package_manager is not supported