-
Hello, I have the following Python script working with the legacy libdnf. I want to migrate it to use libdnf5 instead (Current attempt here) The objective is to list all installed repositories and then list all mirrors for these repositories. I find that there is a But, I don't find the way to get a list of installed Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This prints ids and mirrors for all installed and enabled repositories. import libdnf5
base = libdnf5.base.Base()
base.setup()
repo_sack = base.get_repo_sack()
repo_sack.create_repos_from_system_configuration()
repo_sack.load_repos(libdnf5.repo.Repo.Type_AVAILABLE)
query = libdnf5.repo.RepoQuery(base)
query.filter_enabled(True)
for repo in query:
print(repo.get_id())
print(repo.get_mirrors()) You can check out some details about the loading of configured repositories in https://dnf5.readthedocs.io/en/latest/tutorial/bindings/python3/repos.html. Note that the
Yea, the docs miss the |
Beta Was this translation helpful? Give feedback.
This prints ids and mirrors for all installed and enabled repositories.
You can check out some details about the loading of configured repositories in https://dnf5.readthedocs.io/en/latest/tutorial/bindings/python3/repos.html.
Note that the
libdnf5.repo.RepoQuery
is not connected to therepoquery
command on the CLI, it is a query on all known repositories (Repo
…