Bug 1117789

Summary: [doc] [api] custom repos
Product: [Fedora] Fedora Reporter: Bohuslav "Slavek" Kabrda <bkabrda>
Component: dnfAssignee: Ales Kozumplik <akozumpl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: akozumpl, jzeleny, pnemade, rholy, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-0.5.5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-29 07:20:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bohuslav "Slavek" Kabrda 2014-07-09 11:55:53 UTC
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):
python3-dnf-0.5.3-1.fc20.noarch
python3-hawkey-0.4.17-1.fc20.x86_64


How reproducible:
a python3 snippet of code:

base = dnf.Base()
rawhide = dnf.repo.Repo('rawhide', basecachedir='/tmp')
rawhide.baseurl.append(
    'http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/')
base.repos.add(rawhide)
base.fill_sack(load_system_repo=False)


Actual results:
  File "./dnf-livecd.py", line 81, in resolve
    base.fill_sack(load_system_repo=False)
  File "/usr/lib/python3.3/site-packages/dnf/base.py", line 203, in fill_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python3.3/site-packages/dnf/base.py", line 119, in _add_repo_to_sack
    load_presto=repo.deltarpm)
OSError: Can not read repomd file.


Expected results:
This should pass silently and fill the sack from given repo.


Additional info:
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).

Comment 1 Ales Kozumplik 2014-07-09 11:59:12 UTC
Thanks Slavek, we'll take a look.

Comment 2 Radek Holy 2014-07-09 12:46:49 UTC
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.

Comment 3 Ales Kozumplik 2014-07-17 14:29:51 UTC
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.

Comment 4 Ales Kozumplik 2014-07-17 14:58:04 UTC
Commit c9452cc upstream improves the documentation ands adds an example for the describe scenario:

http://dnf.readthedocs.org/en/latest/api_base.html#dnf.Base.fill_sack

Note that I mystified you at one point: Repo() in fact already has a documented constructor in the API:

http://dnf.readthedocs.org/en/latest/api_repos.html#dnf.repo.Repo.__init__

Comment 5 Bohuslav "Slavek" Kabrda 2014-07-18 11:15:14 UTC
Thank you, works like a charm.