kiwi.package_manager Package

Submodules

kiwi.package_manager.base Module

class kiwi.package_manager.base.PackageManagerBase(repository, custom_args=None)[source]

Bases: object

Implements base class for installation/deletion of packages and collections using a package manager

Parameters
  • repository (object) – instance of Repository

  • root_dir (str) – root directory path name

  • root_bind (object) – instance of RootBind

  • 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

cleanup_requests()[source]

Cleanup request queues

database_consistent()[source]

OBSOLETE: Will be removed 2019-06-05

dump_reload_package_database(version=45)[source]

OBSOLETE: Will be removed 2019-06-05

has_failed(returncode)[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_list, log_line)[source]

Match expression to indicate a package has been deleted

Implementation in specialized package manager class

Parameters
  • package_list (list) – unused

  • log_line (str) – unused

match_package_installed(package_list, log_line)[source]

Match expression to indicate a package has been installed

Implementation in specialized package manager class

Parameters
  • package_list (list) – unused

  • log_line (str) – unused

post_init(custom_args=None)[source]

Post initialization method

Implementation in specialized package manager class

Parameters

custom_args (list) – unused

post_process_install_requests_bootstrap()[source]

Process extra code required after bootstrapping

Implementation in specialized package manager class

process_delete_requests(force=False)[source]

Process package delete requests (chroot)

Implementation in specialized package manager class

Parameters

force (bool) – unused

process_install_requests()[source]

Process package install requests for image phase (chroot)

Implementation in specialized package manager class

process_install_requests_bootstrap()[source]

Process package install requests for bootstrap phase (no chroot)

Implementation in specialized package manager class

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

Queue a package collection

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package(name)[source]

Queue a package request

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package_exclusion(name)[source]

Queue a package exclusion(skip) request

Implementation in specialized package manager class

Parameters

name (str) – unused

request_package_lock(name)[source]

Queue a package exclusion(skip) request

OBSOLETE: Will be removed 2019-06-05

Kept for API compatbility Method calls: request_package_exclusion

request_product(name)[source]

Queue a product request

Implementation in specialized package manager class

Parameters

name (str) – unused

update()[source]

Process package update requests (chroot)

Implementation in specialized package manager class

kiwi.package_manager.dnf Module

class kiwi.package_manager.dnf.PackageManagerDnf(repository, custom_args=None)[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

match_package_deleted(package_name, dnf_output)[source]

Match expression to indicate a package has been deleted

Parameters
  • package_list (list) – list of all packages

  • log_line (str) – dnf status line

Returns

match or None if there isn’t any match

Return type

match object, None

match_package_installed(package_name, dnf_output)[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_list (list) – list of all packages

  • log_line (str) – dnf status line

Returns

match or None if there isn’t any match

Return type

match object, None

post_init(custom_args=None)[source]

Post initialization method

Parameters

custom_args (list) – custom dnf arguments

post_process_install_requests_bootstrap()[source]

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

process_delete_requests(force=False)[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()[source]

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

process_install_requests_bootstrap()[source]

Process package install requests for bootstrap phase (no chroot)

Returns

process results in command type

Return type

namedtuple

process_only_required()[source]

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

request_collection(name)[source]

Queue a collection request

Parameters

name (str) – dnf group name

request_package(name)[source]

Queue a package request

Parameters

name (str) – package name

request_package_exclusion(name)[source]

Queue a package exclusion(skip) request

Parameters

name (str) – package name

request_product(name)[source]

Queue a product request

There is no product definition in the fedora repo data

Parameters

name (str) – unused

update()[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, custom_args=None)[source]

Bases: kiwi.package_manager.base.PackageManagerBase

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

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

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

has_failed(returncode)[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, zypper_output)[source]

Match expression to indicate a package has been deleted

Parameters
  • package_list (list) – list of all packages

  • log_line (str) – zypper status line

Returns

match or None if there isn’t any match

Return type

match object, None

match_package_installed(package_name, zypper_output)[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_list (list) – list of all packages

  • log_line (str) – zypper status line

Returns

match or None if there isn’t any match

Return type

match object, None

post_init(custom_args=None)[source]

Post initialization method

Store custom zypper arguments

Parameters

custom_args (list) – custom zypper arguments

post_process_install_requests_bootstrap()[source]

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

process_delete_requests(force=False)[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()[source]

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

process_install_requests_bootstrap()[source]

Process package install requests for bootstrap phase (no chroot)

Returns

process results in command type

Return type

namedtuple

process_only_required()[source]

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

request_collection(name)[source]

Queue a collection request

Parameters

name (str) – zypper pattern name

request_package(name)[source]

Queue a package request

Parameters

name (str) – package name

request_package_exclusion(name)[source]

Queue a package exclusion(skip) request

Parameters

name (str) – package name

request_product(name)[source]

Queue a product request

Parameters

name (str) – zypper product name

update()[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