Update Manager API: Backend module

Base classes for backend implementations and helpers.

Interfaces

class UpdateManager.Backend.BackendBase(requires_root=True)

Base class for update-manager backends.

This class forms the public interface to Update Manager backends. All Backend implementations must subclass this class and implement all of its methods.

Note

The backend itself must ensure that two mutually exclusive operations are not happening at the same time.

abort_operation()

Aborts the current fetch operation.

acquire_lock()

Acquire the package manager lock.

commit(selected_updates, commit_progress_handler, fork_func=<built-in function fork>)

Downloads and installs the packages specified in selcted_updates (asynchronous).

Parameters:
download_package_lists(list_progress_handler)

Downloads the package lists (asynchronous).

Parameters:download_progress_handlerListProgressHandler implementation
get_available_updates(dist_upgrade=False)

Gets available updates (synchronous).

Parameters:dist_upgrade – Defines whether to do a dist upgrade or not.
Returns:PackageInfoStoreBase object

Changed in version 0.200.0~exp1: Added dist_upgrade parameter.

init_backend(application)

Early initialization code. This method must not be overridden, unless some early backend initialization has to be done.

Parameters:applicationUpdateManager.Application.Application object.
is_locked(by_us=False)

Indicates whether the package manager lock has been acquired.

Parameters:by_us – Defines whether to check if we hold the lock ourselves or for checking whether the lock is held by another process.
release_lock()

Release the package manager lock.

reload_cache(cache_progress_handler)

Reloads the package cache (asynchronous).

Parameters:cache_progress_handlerCacheProgressHandler implementation
requires_root()

Specifies whether the backend requires root privileges to operate or not.

Returns:True if root privileges are required, False otherwise.
class UpdateManager.Backend.PackageInfoBase

Package info base class.

All PackageInfo implementations must subclass this class and override all its methods.

candidate_origin_is_trusted()

Return boolean indicating whether the repository we found the candidate in is trusted.

get_candidate_archive_name()

The candidate’s repository archive name.

get_candidate_component_name()

The candidate’s repository component name.

get_candidate_origin_label()

The candidate’s repository origin label.

get_candidate_origin_name()

The candidate’s repository origin name.

get_candidate_uri()

Return the candidate uri.

get_candidate_version()

The candidate’s version as a string.

get_conflicts()

Returns a list of conflicting packages.

get_dependencies()

Returns the package’s upgradable dependencies as a list of PackageInfoBase objects.

get_description()

Return the package description.

get_download_size()

The download size in bytes as an integer.

get_installed_version()

The currently installed version as a string.

get_package_name()

Return the package name as a string.

get_reverse_dependencies()

Returns the packages that depend on this package as a list of PackageInfoBase objects.

get_source_package_name()

Return the package’s source package name.

get_strict_dependencies()

Returns the package’s upgradable strict dependencies as a list of PackageInfoBase objects.

get_strict_reverse_dependencies()

Returns the packages that depend strictly on this package as a list of PackageInfoBase objects.

get_summary()

The package summary (aka. short description) as a string.

get_uninstalled_dependencies()

Returns a list of dependencies that are not installed.

get_update_category()

The update’s category as an integer.

is_broken()

Returns whether the package is broken or not

is_installed()

Returns whether the package is already installed or not.

class UpdateManager.Backend.PackageInfoStoreBase(*args, **kwargs)

PackageInfo Store

Object to store PackageInfoBase objects.

add_package(pkg_info)

Adds a package to the store.

Parameters:pkg_infoPackageInfoBase object
add_removal(pkg_info)

Adds a package removal to the store.

Parameters:pkg_infoPackageInfoBase object

New in version 0.200.0~exp1.

get_install_count()

Returns the number of packages to be newly installed.

Returns:list of PackageInfoBase objects

New in version 0.200.0~exp1.

get_package(package_name)

Gets a package from the internal dictionary.

Returns:PackageInfoBase object
get_package_list()

Gets a list of packages.

Returns:A list of PackageInfoBase objects.
get_packages()

Gets a dict of packages.

Returns:A dict with category IDs as keys, containing a dict with package names as keys and PackageInfoBase objects as values.
get_removal_count()

Returns the number of packages marked for removal.

Returns:list of PackageInfoBase objects

New in version 0.200.0~exp1.

get_removals()

Gets the packages marked for removal.

Returns:list of PackageInfoBase objects

New in version 0.200.0~exp1.

has_package(package_name)

Checks if a given package exists in the store.

Parameters:package_name – The package’s name.
package_count()

Gets number of packages in the store.

Returns:Number of packages
resolve_dependencies()

Resolves dependencies of all packages.

class UpdateManager.Backend.PackageDependencyBase(name, relation, version)

Package dependency representation

fulfilled_by_candidate_version(pkg_info_store)

Check if the candidate version of the package fulfills the dependency.

Parameters:pkg_info_storePackageInfoStoreBase object
Returns:True if dependency is fulfilled, False otherwise
fulfilled_by_installed_version()

Check if the currently installed version of the package fulfills the dependency.

Returns:True if dependency is fulfilled, False otherwise
is_strict()

Returns whether the dependency is a strict one.

Strict dependencies depend on exactly one version of another package.

class UpdateManager.Backend.CacheProgressHandler

Cache (re-)opening progress handler

cache_begin()

Begin notification

cache_failed(failure_message)

Failure notification

Parameters:failure_message – Failure message
cache_finished()

Finished notification

cache_operation(operation)

Handle an operation update (current operation changed)

Parameters:operation – Current operation
cache_update(progress)

Handle a progress update

Parameters:progress – Either one of CACHE_PROGRESS (negative) or a percentage.
class UpdateManager.Backend.ListProgressHandler

Package list downloading handler

list_aborted()

List download operation was aborted

list_begin()

List download operation has started

list_failed(failure_message)

List download operation has failed

Parameters:failure_message – Failure message
list_finished()

List download operation has finished

list_item_begin(uri, item_size, downloaded_size)

Item download has started

Parameters:
  • uri – Item uri
  • item_size – Item size in bytes
  • downloaded_size – Number of bytes already downloaded
list_item_finished(item_uri)

Item download has finished

Parameters:item_uri – Item uri
list_item_update(item_uri, file_size, downloaded_size)

Item download progress update

Parameters:
  • item_uri – Item uri
  • file_size – File size in bytes
  • downloaded_size – Number of bytes already downloaded
list_update(download_speed, eta_seconds, percent_done)

List download operation progress update

Parameters:
  • download_speed – Current download speed in bytes per second
  • eta_seconds – ETA for all operations to finish in seconds
  • percent_done – Percentage done
class UpdateManager.Backend.CommitProgressHandler

Commit progress handler

download_aborted()

Download operation was aborted

download_begin(download_size, package_count, download_count)

Download operation has started

Parameters:
  • download_size – Overall number of bytes to be downloaded
  • package_count – Number of packages to be upgraded
  • download_count – Number of packages to be downloaded
download_failed(failure_message)

Download operation has failed

Parameters:failure_message – Failure message
download_finished()

Download operation has finished

download_item_begin(uri, item_size, downloaded_size)

Item download has started

Parameters:
  • uri – Item uri
  • item_size – Item size
  • downloaded_size – Number of bytes already downloaded
download_item_finished(uri)

Item download has finished

Parameters:uri – Item uri
download_item_update(uri, item_size, downloaded_size)

Item download update notification

Parameters:
  • uri – Item uri
  • item_size – File size in bytes
  • downloaded_size – Number of bytes already downloaded.
download_update(download_speed, eta_seconds, percent)

Download operation update

Parameters:
  • download_speed – Current download speed in bytes per second
  • eta_seconds – ETA for all operations to finish in seconds
  • percent_done – Percentage done
install_begin()

Install operation has started

install_failed(error_message)

Install operation has failed

Parameters:error_message – Error message
install_finished()

Install operation has finished

install_update(package, percent, status_message)

Install operation update

Parameters:
  • package – Package that is currently being processed
  • percent – Overall percentage done
  • status_message – Current status message
preparation_begin()

Commit preparation begins

New in version 0.200.0~exp1.

requires_removal_or_installation(removals, installs)

Commit operation requires removal or installation of packages.

Parameters:
Returns:

True if the operation should continue or False to abort.

New in version 0.200.0~exp1.

class UpdateManager.Backend.BackendProgressHandler

Combination of CacheProgressHandler, ListProgressHandler and CommitProgressHandler for frontends implementing all of these in a single class.

Constants

UpdateManager.Backend.DEP_RELATION = <UpdateManager.Util.enum.Enum object at 0xa86566c>

Enum:

EQ = 0

LT = 1

GT = 2

GTE = 3

LTE = 4

Table Of Contents

Previous topic

Update Manager API: Application module

Next topic

Update Manager API: python-apt Backend module

This Page