kiwi.package_manager Package

Submodules

kiwi.package_manager.base Module

class kiwi.package_manager.base.PackageManagerBase(repository: kiwi.repository.base.RepositoryBase, custom_args: List = [])[source]

Bases: object

Implements base class for Package Management

Parameters
  • repository (object) – instance of Repository

  • root_dir (str) – root directory path name

  • package_requests (list) – list of packages to install or delete

  • collection_requests (list) – list of collections to install

  • product_requests (list) – list of products to install

clean_leftovers() None[source]

Cleans package manager related data not needed in the resulting image such as custom macros

Implementation in specialized package manager class

cleanup_requests() None[source]

Cleanup request queues

database_consistent() None[source]
dump_reload_package_database(version: int = 45) None[source]
static has_failed(returncode: int) bool[source]

Evaluate given result return code

Any returncode != 0 is considered an error unless overwritten in specialized package manager class

Parameters

returncode (int) – return code number

Returns

True|False

Return type

boolean

match_package_deleted(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been deleted

Implementation in specialized package manager class

Parameters
  • package_name (str) – unused

  • package_manager_output (str) – unused

Returns

True|False

Return type

bool

match_package_installed(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been installed

Implementation in specialized package manager class

Parameters
  • package_name (str) – unused

  • package_manager_output (str) – unused

Returns

True|False

Return type

bool

post_init(custom_args: List = []) None[source]

Post initialization method

Implementation in specialized package manager class

Parameters

custom_args (list) – unused

post_process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) None[source]

Process extra code required after bootstrapping

Implementation in specialized package manager class

process_delete_requests(force: bool = False) kiwi.command.command_call_type[source]

Process package delete requests (chroot)

Implementation in specialized package manager class

Parameters

force (bool) – unused

process_install_requests() kiwi.command.command_call_type[source]

Process package install requests for image phase (chroot)

Implementation in specialized package manager class

process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) kiwi.command.command_call_type[source]

Process package install requests for bootstrap phase (no chroot)

Implementation in specialized package manager class

process_only_required() None[source]

Setup package processing only for required packages

Implementation in specialized package manager class

Setup package processing to also include recommended dependencies

Implementation in specialized package manager class

request_collection(name: str) None[source]

Queue a package collection

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package(name: str) None[source]

Queue a package request

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package_exclusion(name: str) None[source]

Queue a package exclusion(skip) request

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package_lock(name: str) None[source]
request_product(name: str) None[source]

Queue a product request

Implementation in specialized package manager class

Parameters

name (str) – unused

update() kiwi.command.command_call_type[source]

Process package update requests (chroot)

Implementation in specialized package manager class

kiwi.package_manager.dnf Module

class kiwi.package_manager.dnf.PackageManagerDnf(repository: kiwi.repository.base.RepositoryBase, custom_args: List = [])[source]

Bases: kiwi.package_manager.base.PackageManagerBase

*Implements base class for installation/deletion of packages and collections using dnf*

Parameters
  • dnf_args (doct) – dnf arguments from repository runtime configuration

  • command_env (dict) – dnf command environment from repository runtime configuration

clean_leftovers() None[source]

Cleans package manager related data not needed in the resulting image such as custom macros

match_package_deleted(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been deleted

Parameters
  • package_name (str) – package_name

  • package_manager_output (str) – dnf status line

Returns

True|False

Return type

bool

match_package_installed(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been installed

This match for the package to be installed in the output of the dnf command is not 100% accurate. There might be false positives due to sub package names starting with the same base package name

Parameters
  • package_name (str) – package_name

  • package_manager_output (str) – dnf status line

Returns

True|False

Return type

bool

post_init(custom_args: List = []) None[source]

Post initialization method

Parameters

custom_args (list) – custom dnf arguments

post_process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) None[source]

Move the rpm database to the place as it is expected by the rpm package installed during bootstrap phase

Parameters

root_bind (object) – unused

process_delete_requests(force: bool = False) kiwi.command.command_call_type[source]

Process package delete requests (chroot)

Parameters

force (bool) – force deletion: true|false

Raises

KiwiRequestError – if none of the packages to delete is installed.

Returns

process results in command type

Return type

namedtuple

process_install_requests() kiwi.command.command_call_type[source]

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) kiwi.command.command_call_type[source]

Process package install requests for bootstrap phase (no chroot)

Parameters

root_bind (object) – unused

Returns

process results in command type

Return type

namedtuple

process_only_required() None[source]

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

request_collection(name: str) None[source]

Queue a collection request

Parameters

name (str) – dnf group ID name

request_package(name: str) None[source]

Queue a package request

Parameters

name (str) – package name

request_package_exclusion(name: str) None[source]

Queue a package exclusion(skip) request

Parameters

name (str) – package name

request_product(name: str) None[source]

Queue a product request

There is no product definition in the fedora repo data

Parameters

name (str) – unused

update() kiwi.command.command_call_type[source]

Process package update requests (chroot)

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.zypper Module

class kiwi.package_manager.zypper.PackageManagerZypper(repository: kiwi.repository.base.RepositoryBase, custom_args: List = [])[source]

Bases: kiwi.package_manager.base.PackageManagerBase

Implements Installation/Deletion of packages/collections with zypper

Parameters
  • zypper_args (list) – zypper arguments from repository runtime configuration

  • command_env (dict) – zypper command environment from repository runtime configuration

clean_leftovers() None[source]

Cleans package manager related data not needed in the resulting image such as custom macros

static has_failed(returncode: int) bool[source]

Evaluate given result return code

In zypper any return code == 0 or >= 100 is considered success. Any return code different from 0 and < 100 is treated as an error we care for. Return codes >= 100 indicates an issue like ‘new kernel needs reboot of the system’ or similar which we don’t care in the scope of image building

Parameters

returncode (int) – return code number

Returns

True|False

Return type

boolean

match_package_deleted(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been deleted

Parameters
  • package_name (str) – package_name

  • package_manager_output (str) – zypper status line

Returns

True|False

Return type

bool

match_package_installed(package_name: str, package_manager_output: str) bool[source]

Match expression to indicate a package has been installed

This match for the package to be installed in the output of the zypper command is not 100% accurate. There might be false positives due to sub package names starting with the same base package name

Parameters
  • package_name (str) – package_name

  • package_manager_output (str) – zypper status line

Returns

True|False

Return type

bool

post_init(custom_args: List = []) None[source]

Post initialization method

Store custom zypper arguments

Parameters

custom_args (list) – custom zypper arguments

post_process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) None[source]

Move the rpm database to the place as it is expected by the rpm package installed during bootstrap phase

Parameters

root_bind (object) – unused

process_delete_requests(force: bool = False) kiwi.command.command_call_type[source]

Process package delete requests (chroot)

Parameters

force (bool) – force deletion: true|false

Raises

KiwiRequestError – if none of the packages to delete is installed

Returns

process results in command type

Return type

namedtuple

process_install_requests() kiwi.command.command_call_type[source]

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

process_install_requests_bootstrap(root_bind: Optional[kiwi.system.root_bind.RootBind] = None) kiwi.command.command_call_type[source]

Process package install requests for bootstrap phase (no chroot)

Parameters

root_bind (object) – unused

Returns

process results in command type

Return type

namedtuple

process_only_required() None[source]

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

request_collection(name: str) None[source]

Queue a collection request

Parameters

name (str) – zypper pattern name

request_package(name: str) None[source]

Queue a package request

Parameters

name (str) – package name

request_package_exclusion(name: str) None[source]

Queue a package exclusion(skip) request

Parameters

name (str) – package name

request_product(name: str) None[source]

Queue a product request

Parameters

name (str) – zypper product name

update() kiwi.command.command_call_type[source]

Process package update requests (chroot)

Returns

process results in command type

Return type

namedtuple

Module Contents

class kiwi.package_manager.PackageManager[source]

Bases: object

Package manager factory

Parameters
  • repository (object) – instance of Repository

  • package_manager (str) – package manager name

  • custom_args (list) – custom package manager arguments list

Raises

KiwiPackageManagerSetupError – if the requested package manager type is not supported

Returns

package manager

Return type

PackageManagerBase subclass

static new(repository: object, package_manager_name: str, custom_args: Optional[List] = None)[source]