Red Hat Bugzilla – Bug 1117789
[doc] [api] custom repos
Last modified: 2014-09-30 19:42:27 EDT
Description of problem:
I'm trying to use dnf to resolve dependencies from a custom repo created in my code, but I keep getting OSError (see below).
Version-Release number of selected component (if applicable):
a python3 snippet of code:
base = dnf.Base()
rawhide = dnf.repo.Repo('rawhide', basecachedir='/tmp')
File "./dnf-livecd.py", line 81, in resolve
File "/usr/lib/python3.3/site-packages/dnf/base.py", line 203, in fill_sack
File "/usr/lib/python3.3/site-packages/dnf/base.py", line 119, in _add_repo_to_sack
OSError: Can not read repomd file.
This should pass silently and fill the sack from given repo.
Currently this is probably not even supposed to work right now, but I think this use case should be covered (in both docs and code).
Thanks Slavek, we'll take a look.
By coincidence, I'm playing with the same code in unit tests now. I'm pretty sure that the problem is in the permissions to the cache directory. I guess that the same code run under the root privileges will run OK.
To aid in debugging similar problems for the client code hawkey commit ef2ca49 improves error reporting, in the comment 0 case the correct exception message will be:
OSError: Can not create temporary file: /var/cache/dnf/rawhide.solv.3Ro6Ur.
Commit c9452cc upstream improves the documentation ands adds an example for the describe scenario:
Note that I mystified you at one point: Repo() in fact already has a documented constructor in the API:
Thank you, works like a charm.