kiwi.repository Package

Submodules

kiwi.repository.base Module

class kiwi.repository.base.RepositoryBase(root_bind, custom_args=None)[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, uri, repo_type, prio, dist, components, user, secret, credentials_file, repo_gpgcheck, pkg_gpgcheck)[source]

Add repository

Implementation in specialized repository class

Parameters
  • name (str) – unused

  • uri (str) – unused

  • repo_type – unused

  • prio (int) – unused

  • dist – unused

  • components – unused

  • user – unused

  • secret – unused

  • credentials_file – unused

  • repo_gpgcheck – unused

  • pkg_gpgcheck – unused

cleanup_unused_repos()[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()[source]

Delete all repositories

Implementation in specialized repository class

delete_repo(name)[source]

Delete repository

Implementation in specialized repository class

Parameters

name (str) – unused

delete_repo_cache(name)[source]

Delete repository cache

Implementation in specialized repository class

Parameters

name (str) – unused

import_trusted_keys(signing_keys)[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)[source]

Post initialization method

Implementation in specialized repository class

Parameters

custom_args (list) – unused

runtime_config()[source]

Repository runtime configuration and environment

Implementation in specialized repository class

setup_package_database_configuration()[source]

Setup package database configuration

Implementation in specialized repository class

use_default_location()[source]

Call repository operations with default repository manager setup

Implementation in specialized repository class

kiwi.repository.dnf Module

class kiwi.repository.dnf.RepositoryDnf(root_bind, custom_args=None)[source]

Bases: kiwi.repository.base.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, uri, repo_type='rpm-md', prio=None, dist=None, components=None, user=None, secret=None, credentials_file=None, repo_gpgcheck=None, pkg_gpgcheck=None)[source]

Add dnf repository

Parameters
  • name (str) – repository base file name

  • uri (str) – repository URI

  • repo_type – repostory type name

  • prio (int) – dnf repostory priority

  • dist – unused

  • components – unused

  • user – unused

  • secret – unused

  • credentials_file – unused

  • repo_gpgcheck (bool) – enable repository signature validation

  • pkg_gpgcheck (bool) – enable package signature validation

cleanup_unused_repos()[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_all_repos()[source]

Delete all dnf repositories

delete_repo(name)[source]

Delete dnf repository

Parameters

name (str) – repository base file name

delete_repo_cache(name)[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)[source]

Imports trusted keys into the image

Parameters

signing_keys (list) – list of the key files to import

post_init(custom_args=None)[source]

Post initialization method

Store custom dnf arguments and create runtime configuration and environment

Parameters

custom_args (list) – dnf arguments

runtime_config()[source]

dnf runtime configuration and environment

Returns

dnf_args:list, command_env:dict

Return type

dict

setup_package_database_configuration()[source]

Setup rpm macros for bootstrapping and image building

  1. Create the rpm image macro which persists during the build

  2. 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.

use_default_location()[source]

Setup dnf repository operations to store all data in the default places

kiwi.repository.zypper Module

class kiwi.repository.zypper.RepositoryZypper(root_bind, custom_args=None)[source]

Bases: kiwi.repository.base.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, uri, repo_type='rpm-md', prio=None, dist=None, components=None, user=None, secret=None, credentials_file=None, repo_gpgcheck=None, pkg_gpgcheck=None)[source]

Add zypper repository

Parameters
  • name (str) – repository name

  • uri (str) – repository URI

  • repo_type – repostory type name

  • prio (int) – zypper repostory priority

  • dist – unused

  • components – unused

  • user – credentials username

  • secret – credentials password

  • credentials_file – zypper credentials file

  • repo_gpgcheck (bool) – enable repository signature validation

  • pkg_gpgcheck (bool) – enable package signature validation

cleanup_unused_repos()[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_all_repos()[source]

Delete all zypper repositories

delete_repo(name)[source]

Delete zypper repository

Parameters

name (str) – repository name

delete_repo_cache(name)[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)[source]

Imports trusted keys into the image

Parameters

signing_keys (list) – list of the key files to import

post_init(custom_args=None)[source]

Post initialization method

Store custom zypper arguments and create runtime configuration and environment

Parameters

custom_args (list) – zypper arguments

runtime_config()[source]

zypper runtime configuration and environment

setup_package_database_configuration()[source]

Setup rpm macros for bootstrapping and image building

  1. Create the rpm image macro which persists during the build

  2. 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.

  3. Create zypper compat link

use_default_location()[source]

Setup zypper repository operations to store all data in the default places

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