Dictionary mapping repository IDs to the respective
dnf.repo.Repoobjects. Derived from the standard
add_new_repo(repoid, conf, baseurl=(), **kwargs)¶
Repoobject and add it to the repodict. It requires
dnf.conf.Confobject. Optionally it can be specified baseurl (list), and additionally key/value pairs from kwargs to set additional attribute of the
Repoobject. Variables in provided values (
kwargs) will be automatically substituted using conf.substitutions (like
$releasever, …). It returns the
Return a list of all contained repositories.
See the note at
get_matching()for special semantics of the returned object.
Enable debug repos corresponding to already enabled binary repos.
Enable source repos corresponding to already enabled binary repos.
Return a list of repositories which ID matches (possibly globbed) key or an empty list if no matching repository is found.
The returned list acts as a composite, transparently forwarding all method calls on itself to the contained repositories. The following thus disables all matching repos:
#!/usr/bin/python3 import dnf base = dnf.Base() base.read_all_repos() base.fill_sack() repos = base.repos.get_matching('*-debuginfo') repos.disable()
Return an iterator over all enabled repos from the dict.
Return index of the first invalid character in the repo_id or
Noneif all characters are valid. This function is used to validate the section names in
Represents the metadata files.
Trueif the metadata was loaded from the origin,
Falseif it was loaded from the cache.
Repository object used for metadata download. To configure it properly one has to give it either
baseurlparameter. This object has attributes corresponding to all configuration options from both “Repo Options” and “Options for both [main] and Repo” sections.
Repoattributes have non-native Python types. Duck typing works (objects have identical behavior), but
type()doesn’t work as expected because of different types. For example excludepkgs and includepkgs return a
VectorString, which is s SWIG wrapper on top of underlying libdnf C++ code.
ID of this repo. This attribute is read-only.
Directory where packages of a remote repo will be downloaded to. By default it is derived from cachedir in
__init__()but can be overridden by assigning to this attribute.
The path to configuration file of the class.
Init repository with ID name and the parent_conf which an instance of
dnf.conf.Confholding main dnf configuration. Repository ID must be a string that can contain ASCII letters, digits, and -_.: characters.
Ask for additional repository metadata type to download. Given metadata_type is appended to the default metadata set when repository is downloaded.
Disable the repository. Repositories are enabled by default.
Print repository configuration, including inherited values.
Enable the repository (the default).
Return user defined http headers. Return tuple of strings.
Return contents of the repository’s metadata file of the given metadata type. Contents of compressed files are returned uncompressed.
Return path to the file with downloaded repository metadata of given type.
Load the metadata of this repository. Will try to use local cache if possible and initiate and finish download if not. Returns
Trueif fresh metadata has been downloaded and
Falseif cache was used. Raises
dnf.exceptions.RepoErrorif the repo metadata could not be obtained.
Set new user headers and rewrite existing ones. headers must be an instance of tuple of strings or list of strings.
set_or_append_opt_value(name, value_string, priority=PRIO_RUNTIME).
For standard repository options, sets the value of the option if the priority is equal to or higher than the current priority. For “append” options, appends the values parsed from value_string to the current list of values. If the first parsed element of the list of values is empty and the priority is equal to or higher than the current priority, the current list is replaced with the new values. If the priority is higher than the current priority, the current priority is increased to the priority. Raises
dnf.exceptions.ConfigErrorif the option with the given name does not exist or value_string contains an invalid value or not allowed value.
Set the download progress reporting object for this repo during
load(). progress must be an instance of