Skip to content

Instantly share code, notes, and snippets.

@encukou
Created November 27, 2019 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save encukou/34463f5360460ee0763b0f138b4609b4 to your computer and use it in GitHub Desktop.
Save encukou/34463f5360460ee0763b0f138b4609b4 to your computer and use it in GitHub Desktop.
import dnf
cachedir = '_dnf_cache_dir'
the_arch = 'x86_64'
base = dnf.Base()
conf = base.conf
conf.cachedir = cachedir
conf.substitutions['releasever'] = '32'
conf.substitutions['basearch'] = the_arch
base.repos.add_new_repo('rawhide', conf,
baseurl=["http://download.fedoraproject.org/pub/fedora/linux/development/rawhide//Everything/$basearch/os/"])
base.repos.add_new_repo('rawhide-source', conf,
baseurl=["http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/source/tree/"])
base.fill_sack(load_system_repo=False)
python27_src_packages = base.sack.query().filter(name='python27')
for pkg in python27_src_packages:
for provide in pkg.provides:
print('provide:', provide)
whatreqs = base.sack.query().filter(requires=provide)
for whatreq in whatreqs:
print('required by:', whatreq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment