Bug 1117789 - [doc] [api] custom repos
[doc] [api] custom repos
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-09 07:55 EDT by Bohuslav "Slavek" Kabrda
Modified: 2014-09-30 19:42 EDT (History)
5 users (show)

See Also:
Fixed In Version: dnf-0.5.5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-29 03:20:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bohuslav "Slavek" Kabrda 2014-07-09 07:55:53 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):
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 07:59:12 EDT
Thanks Slavek, we'll take a look.
Comment 2 Radek Holy 2014-07-09 08:46:49 EDT
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 10:29:51 EDT
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 10:58:04 EDT
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 07:15:14 EDT
Thank you, works like a charm.

Note You need to log in before you can comment on or make changes to this bug.