Repository Configuration

class dnf.repodict.RepoDict

Dictionary mapping repository IDs to the respective dnf.repo.Repo objects. Derived from the standard dict.

add(repo)

Add a Repo to the repodict.

all()

Return a list of all contained repositories.

See the note at get_matching() for special semantics of the returned object.

enable_debug_repos()

Enable debug repos corresponding to already enabled binary repos.

enable_source_repos()

Enable source repos corresponding to already enabled binary repos.

get_matching(key)

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:

repos = base.repos.get_matching('*-debuginfo')
repos.disable()
iter_enabled()

Return an iterator over all enabled repos from the dict.

add_new_repo(repoid, conf, baseurl=(), **kwargs)

Initialize new Repo object and add it to the repodict. It requires repoid (string), and dnf.conf.Conf object. Optionally it can be speciffied baseurl (list), and additionally key/value pairs from kwargs to set additional attribute of the Repo object. It returns the Repo object.

dnf.repo.repo_id_invalid(repo_id)

Return index of the first invalid character in the repo_id or None if all characters are valid. This function is used to validate the section names in .repo files.

class dnf.repo.Metadata

Represents the metadata files.

fresh

Boolean. True if the metadata was loaded from the origin, False if it was loaded from the cache.

class dnf.repo.Repo

Repository object used for metadata download. To configure it properly one has to give it either metalink, mirrorlist or baseurl parameter.

baseurl

List of URLs for this repository. Defaults to [].

cost

The relative cost of accessing this repository, defaulting to 1000. This value is compared when the priorities of two repositories are the same. The repository with the lowest cost is picked. It is useful to make the library prefer on-disk repositories to remote ones.

excludepkgs

List of packages specified by a name or a glob. DNF will exclude every package in the repository that does match this list from all operations. Defaults to [].

id

ID of this repo.

includepkgs

List of packages specified by a name or a glob. DNF will exclude any package in the repository that doesn’t match this list. This works in conjunction with exclude and doesn’t override it, so if you ‘excludepkgs=*.i386’ and ‘includepkgs=python*’ then only packages starting with python that do not have an i386 arch will be seen by DNF in this repo. Defaults to [].

metadata

If load() has been called and succeeded, this contains the relevant Metadata instance.

URL of a metalink for this repository. Defaults to None

mirrorlist

URL of a mirrorlist for this repository. Defaults to None

name

A string with the repo’s name. By default it has value of repo’s ID.

pkgdir

Directory where packages of a remote repo will be downloaded to. By default it is derived from cachedir in __init__() but can be overriden by assigning to this attribute.

proxy

URL of of a proxy server to use when connecting to this repo. Defaults to None, i.e. no proxy used. Also see Conf.proxy.

proxy_username

The username to use for connecting to the proxy server. Defaults to None.

proxy_password

The password to use for connecting to the proxy server. Defaults to None.

repofile

The path to configuration file of the class.

skip_if_unavailable

If enabled, DNF will continue running and disable the repository that couldn’t be contacted for any reason when downloading metadata. This option doesn’t affect skipping of unavailable packages after dependency resolution. The default is True.

sslcacert

Path to the directory or file containing the certificate authorities to verify SSL certificates. Defaults to None - uses system default.

sslverify

Whether SSL certificate checking should be performed at all. Defaults to True.

sslclientcert

Path to the SSL client certificate used to connect to remote sites. Defaults to None.

sslclientkey

Path to the SSL client key used to connect to remote sites. Defaults to None.

username

The username to use for connecting to repo with basic HTTP authentication. Defaults to None.

password

The password to use for connecting to repo with basic HTTP authentication. Defaults to None.

__init__(name, parent_conf)

Init repository with ID name and the parent_conf which an instance of dnf.conf.Conf holding main dnf configuration.

disable()

Disable the repository. Repositories are enabled by default.

dump()

Print repository configuration, including inherited values.

enable()

Enable the repository (the default).

load()

Load the metadata of this repository. Will try to use local cache if possible and initiate and finish download if not. Returns True if fresh metadata has been downloaded and False if cache was used. Raises dnf.exceptions.RepoError if the repo metadata could not be obtained.

set_progress_bar(progress)

Set the download progress reporting object for this repo during load(). progress must be an instance of dnf.callback.DownloadProgress.