libdnf5::repo
-
typedef WeakPtr<RepoSack, false> libdnf5::repo::RepoSackWeakPtr
-
using libdnf5::repo::RepoWeakPtr = WeakPtr<Repo, false>
-
class ConfigRepo : public libdnf5::Config
- #include <config_repo.hpp>
Holds repo configuration options. Default values of some options are inherited from ConfigMain.
Public Functions
-
ConfigRepo(ConfigMain &main_config, const std::string &id)
-
~ConfigRepo()
-
ConfigRepo(ConfigRepo &&src)
-
ConfigMain &get_main_config()
-
const ConfigMain &get_main_config() const
-
std::string get_id() const
-
OptionString &get_name_option()
-
const OptionString &get_name_option() const
-
OptionChild<OptionBool> &get_enabled_option()
-
const OptionChild<OptionBool> &get_enabled_option() const
-
OptionChild<OptionString> &get_basecachedir_option()
-
const OptionChild<OptionString> &get_basecachedir_option() const
-
OptionStringList &get_baseurl_option()
-
const OptionStringList &get_baseurl_option() const
-
OptionString &get_mirrorlist_option()
-
const OptionString &get_mirrorlist_option() const
-
OptionString &get_metalink_option()
-
const OptionString &get_metalink_option() const
-
OptionString &get_type_option()
-
const OptionString &get_type_option() const
-
OptionString &get_mediaid_option()
-
const OptionString &get_mediaid_option() const
-
OptionStringList &get_gpgkey_option()
-
const OptionStringList &get_gpgkey_option() const
-
OptionStringAppendList &get_excludepkgs_option()
-
const OptionStringAppendList &get_excludepkgs_option() const
-
OptionStringAppendList &get_includepkgs_option()
-
const OptionStringAppendList &get_includepkgs_option() const
-
OptionChild<OptionBool> &get_fastestmirror_option()
-
const OptionChild<OptionBool> &get_fastestmirror_option() const
-
OptionChild<OptionString> &get_proxy_option()
-
const OptionChild<OptionString> &get_proxy_option() const
-
OptionChild<OptionString> &get_proxy_username_option()
-
const OptionChild<OptionString> &get_proxy_username_option() const
-
OptionChild<OptionString> &get_proxy_password_option()
-
const OptionChild<OptionString> &get_proxy_password_option() const
-
OptionChild<OptionStringSet> &get_proxy_auth_method_option()
-
const OptionChild<OptionStringSet> &get_proxy_auth_method_option() const
-
OptionChild<OptionString> &get_username_option()
-
const OptionChild<OptionString> &get_username_option() const
-
OptionChild<OptionString> &get_password_option()
-
const OptionChild<OptionString> &get_password_option() const
-
OptionChild<OptionStringAppendList> &get_protected_packages_option()
-
const OptionChild<OptionStringAppendList> &get_protected_packages_option() const
-
OptionChild<OptionBool> &get_gpgcheck_option()
- Deprecated:
Use get_pkg_gpgcheck_option()
-
const OptionChild<OptionBool> &get_gpgcheck_option() const
- Deprecated:
Use get_pkg_gpgcheck_option() const
-
OptionChild<OptionBool> &get_pkg_gpgcheck_option()
-
const OptionChild<OptionBool> &get_pkg_gpgcheck_option() const
-
OptionChild<OptionBool> &get_repo_gpgcheck_option()
-
const OptionChild<OptionBool> &get_repo_gpgcheck_option() const
-
OptionChild<OptionBool> &get_enablegroups_option()
-
const OptionChild<OptionBool> &get_enablegroups_option() const
-
OptionChild<OptionNumber<std::uint32_t>> &get_retries_option()
-
const OptionChild<OptionNumber<std::uint32_t>> &get_retries_option() const
-
OptionChild<OptionNumber<std::uint32_t>> &get_bandwidth_option()
-
const OptionChild<OptionNumber<std::uint32_t>> &get_bandwidth_option() const
-
OptionChild<OptionNumber<std::uint32_t>> &get_minrate_option()
-
const OptionChild<OptionNumber<std::uint32_t>> &get_minrate_option() const
-
OptionChild<OptionEnum> &get_ip_resolve_option()
-
const OptionChild<OptionEnum> &get_ip_resolve_option() const
-
OptionChild<OptionNumber<float>> &get_throttle_option()
-
const OptionChild<OptionNumber<float>> &get_throttle_option() const
-
OptionChild<OptionSeconds> &get_timeout_option()
-
const OptionChild<OptionSeconds> &get_timeout_option() const
-
OptionChild<OptionNumber<std::uint32_t>> &get_max_parallel_downloads_option()
-
const OptionChild<OptionNumber<std::uint32_t>> &get_max_parallel_downloads_option() const
-
OptionChild<OptionSeconds> &get_metadata_expire_option()
-
const OptionChild<OptionSeconds> &get_metadata_expire_option() const
-
OptionNumber<std::int32_t> &get_cost_option()
-
const OptionNumber<std::int32_t> &get_cost_option() const
-
OptionNumber<std::int32_t> &get_priority_option()
-
const OptionNumber<std::int32_t> &get_priority_option() const
-
OptionBool &get_module_hotfixes_option()
-
const OptionBool &get_module_hotfixes_option() const
-
OptionChild<OptionString> &get_sslcacert_option()
-
const OptionChild<OptionString> &get_sslcacert_option() const
-
OptionChild<OptionBool> &get_sslverify_option()
-
const OptionChild<OptionBool> &get_sslverify_option() const
-
OptionChild<OptionString> &get_sslclientcert_option()
-
const OptionChild<OptionString> &get_sslclientcert_option() const
-
OptionChild<OptionString> &get_sslclientkey_option()
-
const OptionChild<OptionString> &get_sslclientkey_option() const
-
OptionChild<OptionString> &get_proxy_sslcacert_option()
-
const OptionChild<OptionString> &get_proxy_sslcacert_option() const
-
OptionChild<OptionBool> &get_proxy_sslverify_option()
-
const OptionChild<OptionBool> &get_proxy_sslverify_option() const
-
OptionChild<OptionString> &get_proxy_sslclientcert_option()
-
const OptionChild<OptionString> &get_proxy_sslclientcert_option() const
-
OptionChild<OptionString> &get_proxy_sslclientkey_option()
-
const OptionChild<OptionString> &get_proxy_sslclientkey_option() const
-
OptionChild<OptionBool> &get_deltarpm_option()
-
const OptionChild<OptionBool> &get_deltarpm_option() const
-
OptionChild<OptionNumber<std::uint32_t>> &get_deltarpm_percentage_option()
-
const OptionChild<OptionNumber<std::uint32_t>> &get_deltarpm_percentage_option() const
-
OptionChild<OptionBool> &get_build_cache_option()
If true it will create libsolv cache that will speed up the next loading process.
-
const OptionChild<OptionBool> &get_build_cache_option() const
-
OptionString &get_enabled_metadata_option()
-
const OptionString &get_enabled_metadata_option() const
-
OptionChild<OptionString> &get_user_agent_option()
-
const OptionChild<OptionString> &get_user_agent_option() const
-
OptionChild<OptionBool> &get_countme_option()
-
const OptionChild<OptionBool> &get_countme_option() const
-
OptionEnum &get_failovermethod_option()
-
const OptionEnum &get_failovermethod_option() const
-
std::string get_unique_id() const
- 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).
-
std::string get_cachedir() const
- 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()
-
std::string get_persistdir() const
- Returns:
The path to the repository’s persistent directory, where its persistent data are stored.
-
virtual void load_from_parser(const libdnf5::ConfigParser &parser, const std::string §ion, const libdnf5::Vars &vars, libdnf5::Logger &logger, Option::Priority priority = Option::Priority::REPOCONFIG) override
-
ConfigRepo(ConfigMain &main_config, const std::string &id)
-
class DownloadCallbacks
- #include <download_callbacks.hpp>
Base class for download callbacks. To implement a callback, inherit from this class and override the virtual methods.
Public Types
-
enum class FastestMirrorStage
Values:
-
enumerator INIT
Fastest mirror detection started. ptr is
nullptr
.
-
enumerator CACHELOADING
ptr
is a (char *
) pointer to a string with path to the cache file. Do not modify or free the string.
-
enumerator CACHELOADINGSTATUS
If cache was loaded successfully,
ptr
isnullptr
, otherwise it is a (char *
) string containing the error message. Do not modify or free the string.
-
enumerator DETECTION
Detection (pinging) in progress. If all data was loaded from cache, this stage is skipped.
ptr
is a pointer tolong
, the number of mirrors which will be tested.
-
enumerator FINISHING
Detection is done, sorting mirrors, updating cache, etc.
ptr
isnullptr
.
-
enumerator STATUS
The last invocation of the fastest mirror callback. If detection was successful,
ptr
isnullptr
. Otherwise it is a (char *
) / string containing the error message. Do not modify or free the string.
-
enumerator INIT
Public Functions
-
DownloadCallbacks() = default
-
DownloadCallbacks(const DownloadCallbacks&) = delete
-
DownloadCallbacks(DownloadCallbacks&&) = delete
-
DownloadCallbacks &operator=(const DownloadCallbacks&) = delete
-
DownloadCallbacks &operator=(DownloadCallbacks&&) = delete
-
virtual ~DownloadCallbacks() = default
-
virtual void *add_new_download(void *user_data, const char *description, double total_to_download)
Notify the client that a new download has been created.
- Parameters:
user_data – User data entered together with url/package to download.
description – The message describing new download (url/packagename).
total_to_download – Total number of bytes to download.
- Returns:
Associated user data for new download.
-
virtual int progress(void *user_cb_data, double total_to_download, double downloaded)
Download progress callback.
- Parameters:
user_cb_data – Associated user data obtained from add_new_download.
total_to_download – Total number of bytes to download.
downloaded – Number of bytes downloaded.
- Returns:
TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.
-
virtual int end(void *user_cb_data, TransferStatus status, const char *msg)
End of download callback.
- Parameters:
user_cb_data – Associated user data obtained from add_new_download.
status – The transfer status.
msg – The error message in case of error.
- Returns:
TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.
-
virtual int mirror_failure(void *user_cb_data, const char *msg, const char *url, const char *metadata)
Mirror failure callback.
- Parameters:
user_cb_data – Associated user data obtained from add_new_download.
msg – Error message.
url – Failed mirror URL.
metadata – the type of metadata that is being downloaded TODO(lukash) should this point to LoadFlags in some way?
- Returns:
TODO(lukash) uses the LrCbReturnCode enum from librepo, we should translate that.
-
virtual void fastest_mirror(void *user_cb_data, FastestMirrorStage stage, const char *ptr)
Callback for fastest mirror detection.
- Parameters:
user_cb_data – Associated user data obtained from new_download.
stage – the stage of the fastest mirror detection, refer to
FastestMirrorStage
ptr – pointer to additional data depending on the stage, refer to
FastestMirrorStage
-
enum class FastestMirrorStage
-
class FileDownloader
Public Functions
-
explicit FileDownloader(const libdnf5::BaseWeakPtr &base)
-
explicit FileDownloader(libdnf5::Base &base)
-
~FileDownloader()
-
void add(libdnf5::repo::RepoWeakPtr &repo, const std::string &url, const std::string &destination, void *user_data = nullptr)
Adds a file (URL) to download.
- Parameters:
repo – The repository whose settings are to be used.
url – The file (url) to download.
destination – The file path to which to download the file.
user_data – User data.
-
void add(const std::string &url, const std::string &destination, void *user_data = nullptr)
Adds a file (URL) to download. The settings from ConfigMain passed in the FileDownloader constructor are used.
- Parameters:
url – The file (url) to download.
destination – The file path to which to download the file.
user_data – User data.
-
void download()
Download the previously added files (URLs).
-
void set_fail_fast(bool value)
Configure whether to fail the whole download on a first error or keep downloading.
- Parameters:
value – If true, download will fail on the first error, otherwise it continues. This is set to true by default.
-
void set_resume(bool value)
Configure whether to try resuming the download if a destination package already exists.
- Parameters:
value – If true, download is tried to be resumed, otherwise it starts over. This is set to true by default.
-
explicit FileDownloader(const libdnf5::BaseWeakPtr &base)
-
class FileDownloadError : public libdnf5::Error
-
class PackageDownloader
Public Functions
-
explicit PackageDownloader(const libdnf5::BaseWeakPtr &base)
-
explicit PackageDownloader(libdnf5::Base &base)
-
~PackageDownloader()
-
void add(const libdnf5::rpm::Package &package, void *user_data = nullptr)
Adds a package to download to the standard location of repo cachedir/packages.
- Parameters:
package – The package to download.
user_data – User data.
-
void add(const libdnf5::rpm::Package &package, const std::string &destination, void *user_data = nullptr)
Adds a package to download to a specific destination directory.
- Parameters:
package – The package to download.
destination – The directory to which to download the package.
user_data – User data.
-
void download()
Download the previously added packages.
-
void set_fail_fast(bool value)
Configure whether to fail the whole download on a first error or keep downloading.
- Parameters:
value – If true, download will fail on the first error, otherwise it continues. This is set to true by default.
-
void set_resume(bool value)
Configure whether to try resuming the download if a destination package already exists.
- Parameters:
value – If true, download is tried to be resumed, otherwise it starts over. This is set to true by default.
-
void force_keep_packages(bool 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 – 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.
-
explicit PackageDownloader(const libdnf5::BaseWeakPtr &base)
-
class PackageDownloadError : public libdnf5::Error
-
class Repo
- #include <repo.hpp>
RPM repository Represents a repository used to download packages. Remote metadata is cached locally.
Public Types
Public Functions
-
Repo(const libdnf5::BaseWeakPtr &base, const std::string &id, Repo::Type type = Repo::Type::AVAILABLE)
Construct the Repo object
- Parameters:
base – weak pointer to the Base instance
id – repo ID to use
type – type of repo
-
Repo(libdnf5::Base &base, const std::string &id, Repo::Type type = Repo::Type::AVAILABLE)
Construct the Repo object
- Parameters:
base – a reference to the Base instance
id – repo ID to use
type – type of repo
-
~Repo()
-
void set_callbacks(std::unique_ptr<libdnf5::repo::RepoCallbacks> &&callbacks)
Registers a class that implements callback methods (fastest mirror detection, download state, key import).
-
std::unique_ptr<libdnf5::repo::RepoCallbacks> &get_callbacks()
Returns the currently registered callbacks for the repo.
-
void set_user_data(void *user_data) noexcept
Sets the associated user data. These are used in callbacks.
- Parameters:
user_data – Pointer to user data
-
void *get_user_data() const noexcept
Gets the associated user data.
- Returns:
Pointer to user data
-
void verify() const
Verify repo object configuration Will throw exception if Repo has no mirror or baseurl set or if Repo type is unsupported.
-
ConfigRepo &get_config() noexcept
Returns pointer to the repository configuration.
-
const ConfigRepo &get_config() const noexcept
Returns pointer to the repository configuration.
-
std::string get_id() const noexcept
Returns repository id.
-
void enable()
Enable the repository.
-
void disable()
Disable the repository.
-
bool is_enabled() const
Return whether the repository is enabled.
- Returns:
true if enabled
-
bool is_local() const
Return whether the repository is local.
- Returns:
true if local
-
void read_metadata_cache()
Reads metadata from local cache.
-
bool is_in_sync()
Checks whether the locally downloaded metadata are in sync with the origin.
- Returns:
true
if metadata are in sync with the origin,false
otherwise.
-
bool get_use_includes() const
Returns whether the using of “includes” is enabled If enabled, only packages listed in the “includepkgs” will be used from the repository.
-
void set_use_includes(bool enabled)
Enables/disables using of “includes” If enabled, only packages listed in the “includepkgs” will be used from the repository.
-
int get_cost() const
Returns repository cost.
TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()
-
void set_cost(int value, Option::Priority priority = Option::Priority::RUNTIME)
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
- Parameters:
value – Cost value
priority – Optional argument
-
int get_priority() const
Returns repository priority.
TODO(jrohel): Remove it? It is only shortcut for get_config()->cost()->get_value()
-
void set_priority(int value, Option::Priority priority = Option::Priority::RUNTIME)
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
- Parameters:
value – Priority value
priority – Optional argument
-
const std::string &get_revision() const
-
int64_t get_age() const
Gets age of the local cache.
-
std::string get_metadata_path(const std::string &metadata_type)
Return path to the particular downloaded repository metadata in cache
- Parameters:
metadata_type – metadata type (filelists, other, productid…)
- Returns:
file path or empty string in case the requested metadata does not exist
-
void 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.
-
bool is_expired() const
Return whether the cached metadata is expired.
- Returns:
bool
-
int get_expires_in() const
Get the number of seconds after which the cached metadata will expire. Negative number means the metadata has expired already.
- Returns:
Seconds to expiration
-
void set_max_mirror_tries(int max_mirror_tries)
-
int64_t get_timestamp() const
Gets timestamp of metadata “primary” file, if the file is not present returns -1.
-
int 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?
-
void set_preserve_remote_time(bool 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.
- Parameters:
preserve_remote_time – true - use remote file timestamp, false - use the current time
-
bool get_preserve_remote_time() const
-
const std::vector<std::string> &get_content_tags()
TODO(jrohel): Used by DNF repolist. Do we need it?
-
const std::vector<std::pair<std::string, std::string>> &get_distro_tags()
TODO(jrohel): Used by DNF repolist. Do we need it?
-
const std::vector<std::pair<std::string, std::string>> get_metadata_locations() const
Get list of relative locations of metadata files inside the repo e.g. [(‘primary’, ‘repodata/primary.xml.gz’), (‘filelists’, ‘repodata/filelists.xml.gz’)…]
- Returns:
vector of (metadata_type, location) string pairs
-
std::string get_cachedir() const
Gets path to the repository cache directory.
-
std::string get_persistdir() const
Gets path to the repository persistent directory.
-
inline std::string get_name()
Gets name of repository Alias
-
void set_repo_file_path(const std::string &path)
Sets repository configuration file path.
-
const std::string &get_repo_file_path() const noexcept
Gets repository configuration file path.
-
void set_sync_strategy(SyncStrategy strategy)
Sets repository synchronisation strategy.
-
SyncStrategy get_sync_strategy() const noexcept
Returns repository synchronisation strategy.
-
void set_http_headers(const std::vector<std::string> &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.
- Parameters:
headers – A vector of full headers (“header: value”)
-
std::vector<std::string> get_http_headers() const
Get http headers.
- Returns:
A vector of full headers (“header: value”)
-
std::vector<std::string> get_mirrors() const
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.
-
libdnf5::repo::RepoWeakPtr get_weak_ptr()
-
libdnf5::BaseWeakPtr get_base() const
- Since
5.0
- Returns:
The
Base
object to which this object belongs.
-
void download_metadata(const std::string &destdir)
Downloads repository metadata.
-
std::vector<std::pair<std::string, std::string>> get_appstream_metadata() const
Returns a list of pairs of the rpmmd type and filename of the Appstream data of the repo.
Public Static Functions
-
static std::string::size_type verify_id(const std::string &repo_id)
Verify repo ID
- Parameters:
repo_id – repo ID to verify
- Returns:
index of the first invalid character in the repo ID (if present) or std::string::npos
Friends
- friend class rpm::Package
- friend class rpm::PackageSack
- friend class solv::Pool
-
Repo(const libdnf5::BaseWeakPtr &base, const std::string &id, Repo::Type type = Repo::Type::AVAILABLE)
-
class RepoCache
- #include <repo_cache.hpp>
Repository cache management class.
Public Types
-
using RemoveStatistics = RepoCacheRemoveStatistics
Public Functions
-
RepoCache(const libdnf5::BaseWeakPtr &base, const std::filesystem::path &repo_cache_dir)
Construct a new repository cache management instance.
-
~RepoCache()
-
RepoCache(libdnf5::Base &base, const std::string &repo_cache_dir)
Construct a new repository cache management instance.
- Parameters:
base – Base instance reference.
repo_cache_dir – Path to repository cache directory.
-
RemoveStatistics remove_metadata()
Removes metadata from the cache.
- Returns:
Number of deleted files and directories. Number of errors.
-
RemoveStatistics remove_packages()
Removes packages from the cache.
- Returns:
Number of deleted files and directories. Number of errors.
-
RemoveStatistics remove_solv_files()
Removes solvable files from the cache.
- Returns:
Number of deleted files and directories. Number of errors.
-
RemoveStatistics remove_all()
Removes metadata, packages, solvable files, and attributes from the cache. If the repository cache directory becomes empty, it will also be deleted.
- Returns:
Number of deleted files and directories. Number of errors.
-
void write_attribute(const std::string &name, const std::string &value = "")
Writes
value
to thename
attribute. If the attribute does not exist, it is created. If it already existed, its value is overwritten.- Parameters:
name – Attribute name.
value – Attribute value.
- Throws:
std::runtime_exception – An error occurred while writing the attribute.
-
std::string read_attribute(const std::string &name)
Returns the value of the
name
attribute.- Parameters:
name – Attribute name.
- Throws:
std::runtime_exception – The `name` attribute does not exist or an error occurred while reading it.
- Returns:
The value of the
name
attribute.
-
bool is_attribute(const std::string &name)
Tests if the
name
attribute exists.- Parameters:
name – Attribute name.
- Returns:
If the
name
attribute exists, it returns true otherwise false.
-
bool remove_attribute(const std::string &name)
Removes the
name
attribute.- Parameters:
name – Attribute name.
- Throws:
std::runtime_exception – An error occurred while removing the attribute.
- Returns:
true if the attribute was deleted, false if the attribute did not exist.
-
std::string get_repoid()
Gets the id of the cached repository.
- Throws:
RepoCacheException – Throws an exception if the reposiitory id cannot be determined.
- Returns:
id of the cached repository.
Public Static Attributes
-
static constexpr const char *ATTRIBUTE_EXPIRED = "expired"
The name of the attribute used to mark the cache as expired.
-
using RemoveStatistics = RepoCacheRemoveStatistics
-
class RepoCacheError : public libdnf5::Error
- #include <repo_cache_errors.hpp>
RepoCache exception.
Public Functions
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_domain_name() const noexcept override
-
class RepoCacheonlyError : public libdnf5::repo::RepoError
Public Functions
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_name() const noexcept override
-
struct RepoCacheRemoveStatistics
Public Functions
-
RepoCacheRemoveStatistics()
-
~RepoCacheRemoveStatistics()
-
RepoCacheRemoveStatistics(const RepoCacheRemoveStatistics &src)
-
RepoCacheRemoveStatistics &operator=(const RepoCacheRemoveStatistics &src)
-
RepoCacheRemoveStatistics(RepoCacheRemoveStatistics &&src) noexcept
-
RepoCacheRemoveStatistics &operator=(RepoCacheRemoveStatistics &&src) noexcept
-
std::size_t get_files_removed()
-
std::size_t get_dirs_removed()
-
std::size_t get_errors()
-
RepoCacheRemoveStatistics &operator+=(const RepoCacheRemoveStatistics &rhs) noexcept
-
RepoCacheRemoveStatistics()
-
class RepoCallbacks
- #include <repo_callbacks.hpp>
Base class for repository callbacks. To implement callbacks, inherit from this class and override virtual methods.
Subclassed by libdnf5::repo::RepoCallbacks2_1
Public Functions
-
explicit RepoCallbacks()
-
RepoCallbacks(const RepoCallbacks&) = delete
-
RepoCallbacks(RepoCallbacks&&) = delete
-
virtual ~RepoCallbacks()
-
RepoCallbacks &operator=(const RepoCallbacks&) = delete
-
RepoCallbacks &operator=(RepoCallbacks&&) = delete
-
virtual bool repokey_import(const libdnf5::rpm::KeyInfo &key_info)
OpenPGP key import callback. Allows to confirm or deny the import.
- Parameters:
key_info – The key that is about to be imported
- Returns:
true
to import the key,false
to not import
-
virtual void repokey_imported(const libdnf5::rpm::KeyInfo &key_info)
Called on successful repo key import.
- Parameters:
key_info – The key that was successfully imported
-
explicit RepoCallbacks()
-
class RepoCallbacks2_1 : public libdnf5::repo::RepoCallbacks
- #include <repo_callbacks.hpp>
Extended repository callbacks with additional methods for support of key removal.
Public Functions
-
explicit RepoCallbacks2_1()
-
~RepoCallbacks2_1()
-
virtual bool repokey_remove(const libdnf5::rpm::KeyInfo &key_info, const libdnf5::Message &removal_info)
OpenPGP key remove callback. Allows to confirm or deny the removal.
- Parameters:
key_info – The key that is about to be removed
removal_info – Additional information about the key removal
- Returns:
true
to remove the key,false
to not remove
-
virtual void repokey_removed(const libdnf5::rpm::KeyInfo &key_info)
Called on successful repo key removal.
- Parameters:
key_info – The key that was successfully removed
-
explicit RepoCallbacks2_1()
-
class RepoDownloadError : public libdnf5::repo::RepoError
Public Functions
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_name() const noexcept override
-
class RepoError : public libdnf5::Error
Subclassed by libdnf5::repo::RepoCacheonlyError, libdnf5::repo::RepoCompsError, libdnf5::repo::RepoDownloadError, libdnf5::repo::RepoIdAlreadyExistsError, libdnf5::repo::RepoPgpError, libdnf5::repo::RepoRpmError
-
class RepoPgpError : public libdnf5::repo::RepoError
Public Functions
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
inline virtual const char *get_name() const noexcept override
-
class RepoQuery : public libdnf5::sack::Query<RepoWeakPtr>
Public Functions
-
explicit RepoQuery(const libdnf5::BaseWeakPtr &base)
Create a new RepoQuery instance.
- Parameters:
base – A weak pointer to Base
-
explicit RepoQuery(libdnf5::Base &base)
Create a new RepoQuery instance.
- Parameters:
base – Reference to Base
-
~RepoQuery()
-
void filter_enabled(bool enabled)
Filter repos by their
enabled
state.- Since
5.0
- Parameters:
enabled – A boolean value the filter is matched against.
-
void filter_expired(bool expired)
Filter repos by their
expired
state.- Since
5.0
- Parameters:
expired – A boolean value the filter is matched against.
-
void filter_id(const std::string &pattern, sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ)
Filter repos by their
id
.- Since
5.0
- Parameters:
pattern – A string the filter is matched against.
cmp – A comparison (match) operator, defaults to
QueryCmp::EQ
.
-
void filter_id(const std::vector<std::string> &patterns, sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ)
Filter repos by their
id
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp – A comparison (match) operator, defaults to
QueryCmp::EQ
.
-
void filter_local(bool local)
Filter repositories by whether they are local
- Since
5.0
- Parameters:
local –
true
returns local repos,false
remote repos.
-
void filter_name(const std::string &pattern, sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ)
Filter repos by their
name
.- Since
5.0
- Parameters:
pattern – A string the filter is matched against.
cmp – A comparison (match) operator, defaults to
QueryCmp::EQ
.
-
void filter_name(const std::vector<std::string> &patterns, sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ)
Filter repos by their
name
.- Since
5.0
- Parameters:
patterns – A vector of strings the filter is matched against.
cmp – A comparison (match) operator, defaults to
QueryCmp::EQ
.
-
explicit RepoQuery(const libdnf5::BaseWeakPtr &base)
-
class RepoSack : public libdnf5::sack::Sack<Repo>
Public Functions
-
libdnf5::repo::RepoWeakPtr create_repo(const std::string &id)
Creates a new clear repository with default configuration.
- Parameters:
id – The new repo id
- Returns:
A weak pointer to the new repo
-
void create_repos_from_file(const std::string &path)
Creates new repositories from the configuration file at
path
.- Parameters:
path – The path to the repository configuration file
-
void 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]”.
-
void create_repos_from_dir(const std::string &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.
- Parameters:
dir_path – The path to the directory with configuration files
-
void 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.
-
void create_repos_from_paths(const std::vector<std::pair<std::string, std::string>> &repos_paths, libdnf5::Option::Priority priority)
Create new repositories from ids and paths.
- Parameters:
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.
priority – Priority with which the name and baseurl attributes of the new repo are set.
-
void 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.
-
libdnf5::repo::RepoWeakPtr create_repo_from_libsolv_testcase(const std::string &id, const std::string &path)
Creates a new repository from a libsolv testcase file.
- Parameters:
id – The new repo id
path – The path to the libsolv testcase file
- Returns:
A weak pointer to the new repo
-
libdnf5::repo::RepoWeakPtr get_system_repo()
If not created yet, creates the system repository and returns it.
- Returns:
The system repository.
-
std::map<std::string, libdnf5::rpm::Package> add_cmdline_packages(const std::vector<std::string> &paths, bool calculate_checksum = false)
Add given paths to comdline repository.
- Parameters:
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.
calculate_checksum – Whether libsolv should calculate and store checksum of added packages. Setting to true significantly reduces performance.
- Returns:
Map path->rpm::Package which maps input path to newly created Package object in cmdline repo
-
bool has_system_repo() const noexcept
- Returns:
true
if the system repository has been initialized (viaget_system_repo()
).
-
bool has_cmdline_repo() const noexcept
- Returns:
true
if the command line repository has been initialized (viaget_cmdline_repo()
).
-
void dump_debugdata(const std::string &dir)
Dumps libsolv’s rpm debugdata of all loaded repositories.
- Parameters:
dir – The directory into which to dump the debugdata.
-
void dump_comps_debugdata(const std::string &dir)
Dumps libsolv’s comps debugdata of all loaded repositories.
- Parameters:
dir – The directory into which to dump the debugdata.
-
void update_and_load_enabled_repos(bool load_system)
Downloads (if necessary) all enabled repository metadata and loads them in parallel.
This is just a thin wrapper around load_repos.
- Deprecated:
Use load_repos() which allows specifying repo type.
- Parameters:
load_system – Whether to load the system repository
-
void load_repos(Repo::Type type)
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.
- Parameters:
type – What repositories to load (libdnf5::Repo::Type::SYSTEM or libdnf5::Repo::Type::AVAILABLE)
-
void load_repos()
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.
-
RepoSackWeakPtr get_weak_ptr()
-
libdnf5::BaseWeakPtr get_base() const
- Since
5.0
- Returns:
The
Base
object to which this object belongs.
-
void 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
-
void 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
-
~RepoSack()
Friends
- friend class libdnf5::Base
- friend class rpm::PackageSack
- friend class libdnf5::Goal
-
libdnf5::repo::RepoWeakPtr create_repo(const std::string &id)