libdnf5.repo

class libdnf5.repo.ConfigRepo(*args)

Holds repo configuration options. Default values of some options are inherited from ConfigMain.

get_bandwidth_option(*args)
get_basecachedir_option(*args)
get_baseurl_option(*args)
get_build_cache_option(*args)
get_cachedir()
Return type:

string

Returns:

The path to the repository’s cache directory, where its cached metadata are stored. The path contains unique ID generated by get_unique_id()

get_cost_option(*args)
get_countme_option(*args)
get_deltarpm_option(*args)
get_deltarpm_percentage_option(*args)
get_enabled_metadata_option(*args)
get_enabled_option(*args)
get_enablegroups_option(*args)
get_excludepkgs_option(*args)
get_failovermethod_option(*args)
get_fastestmirror_option(*args)
get_gpgcheck_option(*args)

Overload 1: Deprecated: Use get_pkg_gpgcheck_option()


Overload 2: Deprecated: Use get_pkg_gpgcheck_option() const

get_gpgkey_option(*args)
get_id()
get_includepkgs_option(*args)
get_ip_resolve_option(*args)
get_main_config(*args)
get_max_parallel_downloads_option(*args)
get_mediaid_option(*args)
get_metadata_expire_option(*args)
get_minrate_option(*args)
get_mirrorlist_option(*args)
get_module_hotfixes_option(*args)
get_name_option(*args)
get_password_option(*args)
get_persistdir()
Return type:

string

Returns:

The path to the repository’s persistent directory, where its persistent data are stored.

get_pkg_gpgcheck_option(*args)
get_priority_option(*args)
get_protected_packages_option(*args)
get_proxy_auth_method_option(*args)
get_proxy_option(*args)
get_proxy_password_option(*args)
get_proxy_sslcacert_option(*args)
get_proxy_sslclientcert_option(*args)
get_proxy_sslclientkey_option(*args)
get_proxy_sslverify_option(*args)
get_proxy_username_option(*args)
get_repo_gpgcheck_option(*args)
get_retries_option(*args)
get_skip_if_unavailable_option(*args)
get_sslcacert_option(*args)
get_sslclientcert_option(*args)
get_sslclientkey_option(*args)
get_sslverify_option(*args)
get_throttle_option(*args)
get_timeout_option(*args)
get_type_option(*args)
get_unique_id()
Return type:

string

Returns:

A unique ID of the repository, consisting of its id and a hash computed from its source URLs (metalink, mirrorlist or baseurl, first one set is used in the order listed).

get_user_agent_option(*args)
get_username_option(*args)
load_from_parser(*args)
thisown
class libdnf5.repo.DownloadCallbacks

Base class for download callbacks. To implement a callback, inherit from this class and override the virtual methods.

ABORT
ERROR
FastestMirrorStage_CACHELOADING

ptr is a (char *) pointer to a string with path to the cache file. Do not modify or free the string.

FastestMirrorStage_CACHELOADINGSTATUS

If cache was loaded successfully, ptr is nullptr, otherwise it is a (char *) string containing the error message. Do not modify or free the string.

FastestMirrorStage_DETECTION

Detection (pinging) in progress. If all data was loaded from cache, this stage is skipped. ptr is a pointer to long, the number of mirrors which will be tested.

FastestMirrorStage_FINISHING

Detection is done, sorting mirrors, updating cache, etc. ptr is nullptr.

FastestMirrorStage_INIT

Fastest mirror detection started. ptr is nullptr.

FastestMirrorStage_STATUS

The last invocation of the fastest mirror callback. If detection was successful, ptr is nullptr. Otherwise it is a (char *) / string containing the error message. Do not modify or free the string.

OK
TransferStatus_ALREADYEXISTS
TransferStatus_ERROR
TransferStatus_SUCCESSFUL
add_new_download(user_data, description, total_to_download)

Notify the client that a new download has been created. :type user_data: void :param user_data: User data entered together with url/package to download. :type description: string :param description: The message describing new download (url/packagename). :type total_to_download: float :param total_to_download: Total number of bytes to download. :rtype: void :return: Associated user data for new download.

end(user_cb_data, status, msg)

End of download callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type status: int :param status: The transfer status. :type msg: string :param msg: The error message in case of error. :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

fastest_mirror(user_cb_data, stage, ptr)

Callback for fastest mirror detection. :type user_cb_data: void :param user_cb_data: Associated user data obtained from new_download. :type stage: int :param stage: the stage of the fastest mirror detection, refer to FastestMirrorStage :type ptr: string :param ptr: pointer to additional data depending on the stage, refer to FastestMirrorStage

mirror_failure(user_cb_data, msg, url, metadata)

Mirror failure callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type msg: string :param msg: Error message. :type url: string :param url: Failed mirror URL. :type metadata: string :param metadata: the type of metadata that is being downloaded TODO(lukash) should this point to LoadFlags in some way? :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

progress(user_cb_data, total_to_download, downloaded)

Download progress callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type total_to_download: float :param total_to_download: Total number of bytes to download. :type downloaded: float :param downloaded: Number of bytes downloaded. :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

thisown
class libdnf5.repo.DownloadCallbacksUniquePtr(*args)
add_new_download(user_data, description, total_to_download)

Notify the client that a new download has been created. :type user_data: void :param user_data: User data entered together with url/package to download. :type description: string :param description: The message describing new download (url/packagename). :type total_to_download: float :param total_to_download: Total number of bytes to download. :rtype: void :return: Associated user data for new download.

end(user_cb_data, status, msg)

End of download callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type status: int :param status: The transfer status. :type msg: string :param msg: The error message in case of error. :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

fastest_mirror(user_cb_data, stage, ptr)

Callback for fastest mirror detection. :type user_cb_data: void :param user_cb_data: Associated user data obtained from new_download. :type stage: int :param stage: the stage of the fastest mirror detection, refer to FastestMirrorStage :type ptr: string :param ptr: pointer to additional data depending on the stage, refer to FastestMirrorStage

get()
mirror_failure(user_cb_data, msg, url, metadata)

Mirror failure callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type msg: string :param msg: Error message. :type url: string :param url: Failed mirror URL. :type metadata: string :param metadata: the type of metadata that is being downloaded TODO(lukash) should this point to LoadFlags in some way? :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

progress(user_cb_data, total_to_download, downloaded)

Download progress callback. :type user_cb_data: void :param user_cb_data: Associated user data obtained from add_new_download. :type total_to_download: float :param total_to_download: Total number of bytes to download. :type downloaded: float :param downloaded: Number of bytes downloaded. :rtype: int :return: TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.

release()
reset(__p=None)
swap(__u)
thisown
class libdnf5.repo.FileDownloader(*args)
add(*args)
download()

Download the previously added files (URLs).

set_fail_fast(value)

Configure whether to fail the whole download on a first error or keep downloading. :type value: boolean :param value: If true, download will fail on the first error, otherwise it continues.

This is set to true by default.

set_resume(value)

Configure whether to try resuming the download if a destination package already exists. :type value: boolean :param value: If true, download is tried to be resumed, otherwise it starts over.

This is set to true by default.

thisown
class libdnf5.repo.PackageDownloader(*args)
add(*args)
download()

Download the previously added packages.

force_keep_packages(value)

Explicitly setup the behavior related to packages caching. By default, the keepcache configuration option is used to determine whether to keep downloaded packages even after following successful transaction.

Parameters:

value (boolean) – If true, packages will be kept on the disk after downloading regardless the keepcache option value, if false, it enforces packages removal after the next successful transaction.

set_fail_fast(value)

Configure whether to fail the whole download on a first error or keep downloading. :type value: boolean :param value: If true, download will fail on the first error, otherwise it continues.

This is set to true by default.

set_resume(value)

Configure whether to try resuming the download if a destination package already exists. :type value: boolean :param value: If true, download is tried to be resumed, otherwise it starts over.

This is set to true by default.

thisown
class libdnf5.repo.Repo(*args)

RPM repository Represents a repository used to download packages. Remote metadata is cached locally.

SyncStrategy_LAZY
SyncStrategy_ONLY_CACHE
SyncStrategy_TRY_CACHE
Type_AVAILABLE
Type_COMMANDLINE
Type_SYSTEM
disable()

Disable the repository

download_metadata(destdir)

Downloads repository metadata.

enable()

Enable the repository

expire()

Mark whatever is in the current cache expired. This repo instance will always try to fetch a fresh metadata after this method is called.

get_age()

Gets age of the local cache

get_appstream_metadata()

Returns a list of pairs of the rpmmd type and filename of the Appstream data of the repo

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_cachedir()

Gets path to the repository cache directory

get_callbacks()

Returns the currently registered callbacks for the repo.

get_config(*args)

Overload 1: Returns pointer to the repository configuration


Overload 2: Returns pointer to the repository configuration

get_content_tags()

TODO(jrohel): Used by DNF repolist. Do we need it?

get_cost()

Returns repository cost TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()

get_distro_tags()

TODO(jrohel): Used by DNF repolist. Do we need it?

get_expires_in()

Get the number of seconds after which the cached metadata will expire. Negative number means the metadata has expired already. :rtype: int :return: Seconds to expiration

get_http_headers()

Get http headers. :rtype: std::vector< std::string,std::allocator< std::string > > :return: A vector of full headers (“header: value”)

get_id()

Returns repository id

get_max_timestamp()

Gets the highest timestamp from repomd records TODO(jrohel): Used in DNF repolist: displayed as “Repo-updated time” base.py: “using metadata from” in debug messages Is it correct?

get_metadata_locations()

Get list of relative locations of metadata files inside the repo e.g. [(‘primary’, ‘repodata/primary.xml.gz’), (‘filelists’, ‘repodata/filelists.xml.gz’)…] :rtype: std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > :return: vector of (metadata_type, location) string pairs

get_metadata_path(metadata_type)

Return path to the particular downloaded repository metadata in cache :type metadata_type: string :param metadata_type: metadata type (filelists, other, productid…) :rtype: string :return: file path or empty string in case the requested metadata does not exist

get_mirrors()

Returns mirrorlist associated with the repository. Mirrors on this list are mirrors parsed from mirrorlist/metalink specified by LRO_MIRRORLIST or from mirrorlist specified by LRO_MIRROSLISTURL and metalink specified by LRO_METALINKURL. No URLs specified by LRO_URLS are included in this list.

get_name()

Gets name of repository Alias

get_persistdir()

Gets path to the repository persistent directory

get_preserve_remote_time()
get_priority()

Returns repository priority TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()

get_repo_file_path()

Gets repository configuration file path

get_revision()
get_sync_strategy()

Returns repository synchronisation strategy

get_timestamp()

Gets timestamp of metadata “primary” file, if the file is not present returns -1

get_type()

Returns the repository type

get_use_includes()

Returns whether the using of “includes” is enabled If enabled, only packages listed in the “includepkgs” will be used from the repository.

get_user_data()
get_weak_ptr()
is_enabled()

Return whether the repository is enabled. :rtype: boolean :return: true if enabled

is_expired()

Return whether the cached metadata is expired. :rtype: boolean :return: bool

is_in_sync()

Checks whether the locally downloaded metadata are in sync with the origin. :rtype: boolean :return: true if metadata are in sync with the origin, false otherwise.

is_local()

Return whether the repository is local. :rtype: boolean :return: true if local

read_metadata_cache()

Reads metadata from local cache.

set_callbacks(callbacks)

Registers a class that implements callback methods (fastest mirror detection, download state, key import).

set_cost(*args)

Set repo cost in RepoConf and in Libsolv repo if attached. Values are only updated when Option::Priority of stored value is equal or lower.

Version: 1.0.0 :type value: int :param value: Cost value :type priority: int, optional :param priority: Optional argument

set_http_headers(headers)

Downloads file from URL into given opened file descriptor. TODO(lukash) fd seems like an inconvenient API for this function, use target path instead?

It also needs defining what it means downloading an URL through a particular repo

Set http headers. :type headers: std::vector< std::string,std::allocator< std::string > > :param headers: A vector of full headers (“header: value”)

set_max_mirror_tries(max_mirror_tries)
set_preserve_remote_time(preserve_remote_time)

Try to preserve remote side timestamps When set to true the underlying librepo is asked to make an attempt to set the timestamps of the local downloaded files (repository metadata and packages) to match those from the remote files. This feature is by default switched off. :type preserve_remote_time: boolean :param preserve_remote_time: true - use remote file timestamp, false - use the current time

set_priority(*args)

Set repo priority in RepoConf and in Libsolv repo if attached. Values are only updated when Option::Priority of stored value is equal or lower.

Version: 1.0.0 :type value: int :param value: Priority value :type priority: int, optional :param priority: Optional argument

set_repo_file_path(path)

Sets repository configuration file path

set_sync_strategy(strategy)

Sets repository synchronisation strategy

set_use_includes(enabled)

Enables/disables using of “includes” If enabled, only packages listed in the “includepkgs” will be used from the repository.

set_user_data(user_data)
thisown
static type_to_string(type)

Return string representation of the Type enum

verify()

Verify repo object configuration Will throw exception if Repo has no mirror or baseurl set or if Repo type is unsupported.

static verify_id(repo_id)

Verify repo ID :type repo_id: string :param repo_id: repo ID to verify :rtype: std::string::size_type :return: index of the first invalid character in the repo ID (if present) or std::string::npos

class libdnf5.repo.RepoCache(*args)

Repository cache management class.

ATTRIBUTE_EXPIRED

The name of the attribute used to mark the cache as expired.

get_repoid()

Gets the id of the cached repository.

Return type:

string

Returns:

id of the cached repository.

Raises:

RepoCacheException Throws an exception if the reposiitory id cannot be determined.

is_attribute(name)

Tests if the name attribute exists.

Parameters:

name (string) – Attribute name.

Return type:

boolean

Returns:

If the name attribute exists, it returns true otherwise false.

read_attribute(name)

Returns the value of the name attribute.

Parameters:

name (string) – Attribute name.

Return type:

string

Returns:

The value of the name attribute.

Raises:

std::runtime_exception The name attribute does not exist or an error occurred while reading it.

remove_all()

Removes metadata, packages, solvable files, and attributes from the cache. If the repository cache directory becomes empty, it will also be deleted.

Return type:

RemoveStatistics

Returns:

Number of deleted files and directories. Number of errors.

remove_attribute(name)

Removes the name attribute.

Parameters:

name (string) – Attribute name.

Return type:

boolean

Returns:

true if the attribute was deleted, false if the attribute did not exist.

Raises:

std::runtime_exception An error occurred while removing the attribute.

remove_metadata()

Removes metadata from the cache.

Return type:

RemoveStatistics

Returns:

Number of deleted files and directories. Number of errors.

remove_packages()

Removes packages from the cache.

Return type:

RemoveStatistics

Returns:

Number of deleted files and directories. Number of errors.

remove_solv_files()

Removes solvable files from the cache.

Return type:

RemoveStatistics

Returns:

Number of deleted files and directories. Number of errors.

thisown
write_attribute(*args)

Writes value to the` name` attribute. If the attribute does not exist, it is created. If it already existed, its value is overwritten.

Parameters:
  • name (string) – Attribute name.

  • value (string, optional) – Attribute value.

Raises:

std::runtime_exception An error occurred while writing the attribute.

class libdnf5.repo.RepoCacheRemoveStatistics(*args)
get_dirs_removed()
get_errors()
get_files_removed()
thisown
class libdnf5.repo.RepoCallbacks

Base class for repository callbacks. To implement callbacks, inherit from this class and override virtual methods.

repokey_import(key_info)

OpenPGP key import callback. Allows to confirm or deny the import. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that is about to be imported :rtype: boolean :return: true to import the key, false to not import

repokey_imported(key_info)

Called on successful repo key import. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that was successfully imported

thisown
class libdnf5.repo.RepoCallbacks2_1

Extended repository callbacks with additional methods for support of key removal.

repokey_remove(key_info, removal_info)

OpenPGP key remove callback. Allows to confirm or deny the removal. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that is about to be removed :type removal_info: Message :param removal_info: Additional information about the key removal :rtype: boolean :return: true to remove the key, false to not remove

repokey_removed(key_info)

Called on successful repo key removal. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that was successfully removed

thisown
class libdnf5.repo.RepoCallbacksUniquePtr(*args)
get()
release()
repokey_import(key_info)

OpenPGP key import callback. Allows to confirm or deny the import. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that is about to be imported :rtype: boolean :return: true to import the key, false to not import

repokey_imported(key_info)

Called on successful repo key import. :type key_info: libdnf5::rpm::KeyInfo :param key_info: The key that was successfully imported

reset(__p=None)
swap(__u)
thisown
class libdnf5.repo.RepoQuery(*args)

Query is a Set with filtering capabilities.

filter_enabled(enabled)

Filter repos by their enabled state.

Parameters:

enabled (boolean) – A boolean value the filter is matched against.

Since: 5.0

filter_expired(expired)

Filter repos by their expired state.

Parameters:

expired (boolean) – A boolean value the filter is matched against.

Since: 5.0

filter_id(*args)

Overload 1: Filter repos by their id.

Parameters:
  • pattern (string) – A string the filter is matched against.

  • cmp (int, optional) – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0


Overload 2: Filter repos by their id.

Parameters:
  • patterns (std::vector< std::string,std::allocator< std::string > >) – A vector of strings the filter is matched against.

  • cmp (int, optional) – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0


Overload 3: Filter repos by their id.

Parameters:
  • patterns (std::vector< std::string,std::allocator< std::string > >) – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0

filter_local(local)

Filter repositories by whether they are local

Parameters:

local (boolean) – true returns local repos, false remote repos.

Since: 5.0

filter_name(*args)

Overload 1: Filter repos by their name.

Parameters:
  • pattern (string) – A string the filter is matched against.

  • cmp (int, optional) – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0


Overload 2: Filter repos by their name.

Parameters:
  • patterns (std::vector< std::string,std::allocator< std::string > >) – A vector of strings the filter is matched against.

  • cmp (int, optional) – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0


Overload 3: Filter repos by their name.

Parameters:
  • patterns (std::vector< std::string,std::allocator< std::string > >) – A vector of strings the filter is matched against.

  • cmp – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0

filter_type(*args)

Filter repos by their type.

Parameters:
  • type (int) – A type the filter is matched against.

  • cmp (int, optional) – A comparison (match) operator, defaults to QueryCmp::EQ.

Since: 5.0

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

Weak pointer to the Base object.

Since: 5.0

thisown
class libdnf5.repo.RepoSack(*args, **kwargs)
add_cmdline_packages(paths, calculate_checksum=False)

Add given paths to comdline repository. :type paths: std::vector< std::string,std::allocator< std::string > > :param paths: Vector of paths to rpm files to be inserted to cmdline repo. Can contain paths to local files or URLs of remote rpm files. Specifications that are neither file paths, nor URLs are ignored. :type calculate_checksum: boolean, optional :param calculate_checksum: Whether libsolv should calculate and store checksum of added packages. Setting to true significantly reduces performance. :rtype: std::map< std::string,libdnf5::rpm::Package,std::less< std::string >,std::allocator< std::pair< std::string const,libdnf5::rpm::Package > > > :return: Map path->rpm::Package which maps input path to newly created Package object in cmdline repo

create_repo(id)

Creates a new clear repository with default configuration. :type id: string :param id: The new repo id :rtype: RepoWeakPtr :return: A weak pointer to the new repo

create_repo_from_libsolv_testcase(id, path)

Creates a new repository from a libsolv testcase file. :type id: string :param id: The new repo id :type path: string :param path: The path to the libsolv testcase file :rtype: RepoWeakPtr :return: A weak pointer to the new repo

create_repos_from_config_file()

Creates new repositories from the Base’s configuration file (the “config_file_path” configuration option).

Repositories can be configured in dnf’s main configuration file in sections other than “[main]”.

create_repos_from_dir(dir_path)

Creates new repositories from all configuration files with the “.repo” extension in the dir_path directory.

The files in the directory are read in alphabetical order. :type dir_path: string :param dir_path: The path to the directory with configuration files

create_repos_from_file(path)

Creates new repositories from the configuration file at path. :type path: string :param path: The path to the repository configuration file

create_repos_from_paths(repos_paths, priority)

Create new repositories from ids and paths. :type repos_paths: std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > :param repos_paths: Vector of <ID,PATH> pairs. The “baseurl” parameter of the new repo is set to the PATH, “name” and “id” to the ID. Both values can be enriched by the repository variables which are substituted before creating the repo. :type priority: int :param priority: Priority with which the name and baseurl attributes of the new repo are set.

create_repos_from_reposdir()

Creates new repositories from all configuration files with “.repo” extension in the directories defined by the “reposdir” configuration option.

The files in the directories are read in alphabetical order.

create_repos_from_system_configuration()

Creates new repositories from the Base’s configuration file (the / “config_file_path” configuration option) and from directories defined by the “reposdir” configuration option. Repository overrides are then applied.

Calls create_repos_from_config_file(), create_repos_from_reposdir(), and loads repository configuration overrides.

dump_comps_debugdata(dir)

Dumps libsolv’s comps debugdata of all loaded repositories. :type dir: string :param dir: The directory into which to dump the debugdata.

dump_debugdata(dir)

Dumps libsolv’s rpm debugdata of all loaded repositories. :type dir: string :param dir: The directory into which to dump the debugdata.

enable_debug_repos()

For each enabled repository enable corresponding debug repository. When repo ID has suffix -rpm then it enables <ID>-debug-rpms otherwise it enables <ID>-debuginfo Since: 5.2.4

enable_source_repos()

For each enabled repository enable corresponding source repository. When repo ID has suffix -rpm then it enables <ID>-source-rpms otherwise it enables <ID>-source Since: 5.0

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_system_repo()

If not created yet, creates the system repository and returns it. :rtype: RepoWeakPtr :return: The system repository.

get_weak_ptr()
has_cmdline_repo()
Return type:

boolean

Returns:

true if the command line repository has been initialized (via get_cmdline_repo()).

has_system_repo()
Return type:

boolean

Returns:

true if the system repository has been initialized (via get_system_repo()).

load_repos(*args)

Overload 1: Downloads (if necessary) repositories of selected type and loads them in parallel. load_repos() can be called only once per each RepoSack. It also sets up modular filtering. :type type: int :param type: What repositories to load (libdnf5::Repo::Type::SYSTEM or libdnf5::Repo::Type::AVAILABLE)


Overload 2: Downloads (if necessary) both available and system repositories and loads them in parallel. load_repos() can be called only once per each RepoSack. It also sets up modular filtering.

thisown
update_and_load_enabled_repos(load_system)

Downloads (if necessary) all enabled repository metadata and loads them in parallel.

This is just a thin wrapper around load_repos.

Parameters:

load_system (boolean) – Whether to load the system repository

Deprecated: Use load_repos() which allows specifying repo type.

class libdnf5.repo.RepoSackWeakPtr(*args)

WeakPtr is a “smart” pointer. It contains a pointer to resource and to guard of resource. WeakPtr pointer can be owner of the resource. However, the resource itself may depend on another resource. WeakPtr registers/unregisters itself at the guard of resource. And the resource guard invalidates the registered WeakPtrs when the resource is unusable (eg. its dependecny was released). Note on thread safety: It is safe to create, access and destroy WeakPtrs in multiple threads simultaneously.

add_cmdline_packages(paths, calculate_checksum=False)

Add given paths to comdline repository. :type paths: std::vector< std::string,std::allocator< std::string > > :param paths: Vector of paths to rpm files to be inserted to cmdline repo. Can contain paths to local files or URLs of remote rpm files. Specifications that are neither file paths, nor URLs are ignored. :type calculate_checksum: boolean, optional :param calculate_checksum: Whether libsolv should calculate and store checksum of added packages. Setting to true significantly reduces performance. :rtype: std::map< std::string,libdnf5::rpm::Package,std::less< std::string >,std::allocator< std::pair< std::string const,libdnf5::rpm::Package > > > :return: Map path->rpm::Package which maps input path to newly created Package object in cmdline repo

add_excludes(value)
add_includes(value)
create_repo(id)

Creates a new clear repository with default configuration. :type id: string :param id: The new repo id :rtype: RepoWeakPtr :return: A weak pointer to the new repo

create_repo_from_libsolv_testcase(id, path)

Creates a new repository from a libsolv testcase file. :type id: string :param id: The new repo id :type path: string :param path: The path to the libsolv testcase file :rtype: RepoWeakPtr :return: A weak pointer to the new repo

create_repos_from_config_file()

Creates new repositories from the Base’s configuration file (the “config_file_path” configuration option).

Repositories can be configured in dnf’s main configuration file in sections other than “[main]”.

create_repos_from_dir(dir_path)

Creates new repositories from all configuration files with the “.repo” extension in the dir_path directory.

The files in the directory are read in alphabetical order. :type dir_path: string :param dir_path: The path to the directory with configuration files

create_repos_from_file(path)

Creates new repositories from the configuration file at path. :type path: string :param path: The path to the repository configuration file

create_repos_from_paths(repos_paths, priority)

Create new repositories from ids and paths. :type repos_paths: std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > :param repos_paths: Vector of <ID,PATH> pairs. The “baseurl” parameter of the new repo is set to the PATH, “name” and “id” to the ID. Both values can be enriched by the repository variables which are substituted before creating the repo. :type priority: int :param priority: Priority with which the name and baseurl attributes of the new repo are set.

create_repos_from_reposdir()

Creates new repositories from all configuration files with “.repo” extension in the directories defined by the “reposdir” configuration option.

The files in the directories are read in alphabetical order.

create_repos_from_system_configuration()

Creates new repositories from the Base’s configuration file (the / “config_file_path” configuration option) and from directories defined by the “reposdir” configuration option. Repository overrides are then applied.

Calls create_repos_from_config_file(), create_repos_from_reposdir(), and loads repository configuration overrides.

dump_comps_debugdata(dir)

Dumps libsolv’s comps debugdata of all loaded repositories. :type dir: string :param dir: The directory into which to dump the debugdata.

dump_debugdata(dir)

Dumps libsolv’s rpm debugdata of all loaded repositories. :type dir: string :param dir: The directory into which to dump the debugdata.

enable_debug_repos()

For each enabled repository enable corresponding debug repository. When repo ID has suffix -rpm then it enables <ID>-debug-rpms otherwise it enables <ID>-debuginfo Since: 5.2.4

enable_source_repos()

For each enabled repository enable corresponding source repository. When repo ID has suffix -rpm then it enables <ID>-source-rpms otherwise it enables <ID>-source Since: 5.0

get()

Returns a pointer to the managed object. Generates exception if object is not valid.

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_excludes()
get_includes()
get_system_repo()

If not created yet, creates the system repository and returns it. :rtype: RepoWeakPtr :return: The system repository.

get_use_includes()
get_weak_ptr()
has_cmdline_repo()
Return type:

boolean

Returns:

true if the command line repository has been initialized (via get_cmdline_repo()).

has_same_guard(other)

Checks if the other WeakPtr instance has the same WeakPtrGuard.

has_system_repo()
Return type:

boolean

Returns:

true if the system repository has been initialized (via get_system_repo()).

is_valid()

Checks if managed object is valid.

load_repos(*args)

Overload 1: Downloads (if necessary) repositories of selected type and loads them in parallel. load_repos() can be called only once per each RepoSack. It also sets up modular filtering. :type type: int :param type: What repositories to load (libdnf5::Repo::Type::SYSTEM or libdnf5::Repo::Type::AVAILABLE)


Overload 2: Downloads (if necessary) both available and system repositories and loads them in parallel. load_repos() can be called only once per each RepoSack. It also sets up modular filtering.

remove_excludes(value)
remove_includes(value)
set_excludes(value)
set_includes(value)
set_use_includes(value)
size()
thisown
update_and_load_enabled_repos(load_system)

Downloads (if necessary) all enabled repository metadata and loads them in parallel.

This is just a thin wrapper around load_repos.

Parameters:

load_system (boolean) – Whether to load the system repository

Deprecated: Use load_repos() which allows specifying repo type.

class libdnf5.repo.RepoWeakPtr(*args)

WeakPtr is a “smart” pointer. It contains a pointer to resource and to guard of resource. WeakPtr pointer can be owner of the resource. However, the resource itself may depend on another resource. WeakPtr registers/unregisters itself at the guard of resource. And the resource guard invalidates the registered WeakPtrs when the resource is unusable (eg. its dependecny was released). Note on thread safety: It is safe to create, access and destroy WeakPtrs in multiple threads simultaneously.

disable()

Disable the repository

download_metadata(destdir)

Downloads repository metadata.

enable()

Enable the repository

expire()

Mark whatever is in the current cache expired. This repo instance will always try to fetch a fresh metadata after this method is called.

get()

Returns a pointer to the managed object. Generates exception if object is not valid.

get_age()

Gets age of the local cache

get_appstream_metadata()

Returns a list of pairs of the rpmmd type and filename of the Appstream data of the repo

get_base()
Return type:

libdnf5::BaseWeakPtr

Returns:

The Base object to which this object belongs.

Since: 5.0

get_cachedir()

Gets path to the repository cache directory

get_callbacks()

Returns the currently registered callbacks for the repo.

get_config(*args)

Overload 1: Returns pointer to the repository configuration


Overload 2: Returns pointer to the repository configuration

get_content_tags()

TODO(jrohel): Used by DNF repolist. Do we need it?

get_cost()

Returns repository cost TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()

get_distro_tags()

TODO(jrohel): Used by DNF repolist. Do we need it?

get_expires_in()

Get the number of seconds after which the cached metadata will expire. Negative number means the metadata has expired already. :rtype: int :return: Seconds to expiration

get_http_headers()

Get http headers. :rtype: std::vector< std::string,std::allocator< std::string > > :return: A vector of full headers (“header: value”)

get_id()

Returns repository id

get_max_timestamp()

Gets the highest timestamp from repomd records TODO(jrohel): Used in DNF repolist: displayed as “Repo-updated time” base.py: “using metadata from” in debug messages Is it correct?

get_metadata_locations()

Get list of relative locations of metadata files inside the repo e.g. [(‘primary’, ‘repodata/primary.xml.gz’), (‘filelists’, ‘repodata/filelists.xml.gz’)…] :rtype: std::vector< std::pair< std::string,std::string >,std::allocator< std::pair< std::string,std::string > > > :return: vector of (metadata_type, location) string pairs

get_metadata_path(metadata_type)

Return path to the particular downloaded repository metadata in cache :type metadata_type: string :param metadata_type: metadata type (filelists, other, productid…) :rtype: string :return: file path or empty string in case the requested metadata does not exist

get_mirrors()

Returns mirrorlist associated with the repository. Mirrors on this list are mirrors parsed from mirrorlist/metalink specified by LRO_MIRRORLIST or from mirrorlist specified by LRO_MIRROSLISTURL and metalink specified by LRO_METALINKURL. No URLs specified by LRO_URLS are included in this list.

get_name()

Gets name of repository Alias

get_persistdir()

Gets path to the repository persistent directory

get_preserve_remote_time()
get_priority()

Returns repository priority TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()

get_repo_file_path()

Gets repository configuration file path

get_revision()
get_sync_strategy()

Returns repository synchronisation strategy

get_timestamp()

Gets timestamp of metadata “primary” file, if the file is not present returns -1

get_type()

Returns the repository type

get_use_includes()

Returns whether the using of “includes” is enabled If enabled, only packages listed in the “includepkgs” will be used from the repository.

get_user_data()
get_weak_ptr()
has_same_guard(other)

Checks if the other WeakPtr instance has the same WeakPtrGuard.

is_enabled()

Return whether the repository is enabled. :rtype: boolean :return: true if enabled

is_expired()

Return whether the cached metadata is expired. :rtype: boolean :return: bool

is_in_sync()

Checks whether the locally downloaded metadata are in sync with the origin. :rtype: boolean :return: true if metadata are in sync with the origin, false otherwise.

is_local()

Return whether the repository is local. :rtype: boolean :return: true if local

is_valid()

Checks if managed object is valid.

read_metadata_cache()

Reads metadata from local cache.

set_callbacks(callbacks)

Registers a class that implements callback methods (fastest mirror detection, download state, key import).

set_cost(*args)

Set repo cost in RepoConf and in Libsolv repo if attached. Values are only updated when Option::Priority of stored value is equal or lower.

Version: 1.0.0 :type value: int :param value: Cost value :type priority: int, optional :param priority: Optional argument

set_http_headers(headers)

Downloads file from URL into given opened file descriptor. TODO(lukash) fd seems like an inconvenient API for this function, use target path instead?

It also needs defining what it means downloading an URL through a particular repo

Set http headers. :type headers: std::vector< std::string,std::allocator< std::string > > :param headers: A vector of full headers (“header: value”)

set_max_mirror_tries(max_mirror_tries)
set_preserve_remote_time(preserve_remote_time)

Try to preserve remote side timestamps When set to true the underlying librepo is asked to make an attempt to set the timestamps of the local downloaded files (repository metadata and packages) to match those from the remote files. This feature is by default switched off. :type preserve_remote_time: boolean :param preserve_remote_time: true - use remote file timestamp, false - use the current time

set_priority(*args)

Set repo priority in RepoConf and in Libsolv repo if attached. Values are only updated when Option::Priority of stored value is equal or lower.

Version: 1.0.0 :type value: int :param value: Priority value :type priority: int, optional :param priority: Optional argument

set_repo_file_path(path)

Sets repository configuration file path

set_sync_strategy(strategy)

Sets repository synchronisation strategy

set_use_includes(enabled)

Enables/disables using of “includes” If enabled, only packages listed in the “includepkgs” will be used from the repository.

set_user_data(user_data)
thisown
type_to_string(type)

Return string representation of the Type enum

verify()

Verify repo object configuration Will throw exception if Repo has no mirror or baseurl set or if Repo type is unsupported.

verify_id(repo_id)

Verify repo ID :type repo_id: string :param repo_id: repo ID to verify :rtype: std::string::size_type :return: index of the first invalid character in the repo ID (if present) or std::string::npos

class libdnf5.repo.SackQueryRepoWeakPtr(*args)

Query is a Set with filtering capabilities.

filter(*args)
get()

Get a single object. Raise an exception if none or multiple objects match the query.

list()

List all objects matching the query.

thisown
class libdnf5.repo.SackRepoRepoQuery(*args, **kwargs)
add_excludes(value)
add_includes(value)
get_excludes()
get_includes()
get_use_includes()
remove_excludes(value)
remove_includes(value)
set_excludes(value)
set_includes(value)
set_use_includes(value)
size()
thisown
class libdnf5.repo.SetConstIteratorRepoWeakPtr(*args, **kwargs)
next()
prev()
thisown
value()
class libdnf5.repo.SetRepoWeakPtr(*args, **kwargs)

Set represents set of objects (e.g. repositories, or groups) and implements set operations such as unions or differences.

add(*args)
begin()
clear()
contains(obj)
difference(other)
empty()
end()
find(obj)
get_data(*args)
intersection(other)
is_subset(other)
is_superset(other)
remove(obj)
size()
swap(other)
symmetric_difference(other)
thisown
update(other)
libdnf5.repo.SetRepoWeakPtr__iter__(self)
class libdnf5.repo.SwigPyIterator(*args, **kwargs)
advance(n)
copy()
decr(n=1)
distance(x)
equal(x)
incr(n=1)
next()
previous()
thisown
value()