Bug 1022940

Summary: _bestPackageFromList doesn't work
Product: [Fedora] Fedora Reporter: Daniel Mach <dmach>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: akozumpl, packaging-team-maint, pnemade, rholy, zpavlas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-24 11:16:57 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:
Bug Depends On: 979353    
Bug Blocks:    

Description Daniel Mach 2013-10-24 10:06:28 UTC
Version:
dnf-0.4.5-1.fc21.noarch

Problem:
AttributeError: 'Base' object has no attribute '_compare_providers'

Reproducer:
import dnf.base
base = dnf.base.Base()
print base._bestPackageFromList([1, 2])


It's related to bug#979353 - we need this functionality, preferably in hawkey, but dnf would be also acceptable.

Comment 1 Zdeněk Pavlas 2013-10-24 10:28:51 UTC
I'm afraid this is going to be CANTFIX'd.  libsolv internally considers "all" providers, and this is burried very deep.  This functionality is not needed.

All you can do is searching for all packages providing "foo", and excluding all but the one you want to use.  But this has to run *before* depsolving, not in a callback.

Comment 2 Ales Kozumplik 2013-10-24 11:16:57 UTC
Hi Dan,

It has been explained many times now that the DNF API is not to be used until documentation to it is published. Therefore nothing is supported yet and it is possible things like _bestPackageFromLIst will be dropped entirely. I am afraid we can not help you here, for the reasons mentioned by Zdenek in comment 1. Also, as you mention we are already tracking this in bug 979353.

> print base._bestPackageFromList([1, 2])

And we certainly will not document and support methods starting with an underscore in the API, please see PEP 0008 [1]

[1] http://www.python.org/dev/peps/pep-0008/