Skip to content
Discussion options

You must be logged in to vote

Hi, to download source rpm packages, you can do something like this:

import libdnf5

# Create dnf base
base = libdnf5.base.Base()
base.setup()

# Load repositories configured on the system
repo_sack = base.get_repo_sack()
repo_sack.create_repos_from_system_configuration()
repo_sack.enable_source_repos()
repo_sack.load_repos()

# Create a package query
query = libdnf5.rpm.PackageQuery(base)
# Filter only available source packages
query.filter_available()
query.filter_arch("src")
# Filter anything else, this is just an example
query.filter_nevra("htop*", libdnf5.common.QueryCmp_GLOB)

# Create a downloader, add all the packages from the query to given destination and download
downloader = l…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by nezen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants