Trouble resolving dependencies/conflicts using YUM’s python API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings Yum folks!

Thanks in advance for any info, I really appreciate it!

We are trying to have yum resolve dependencies using the yum python API given the current state of the repo and a list of packages we want installed, updated, and removed.

I have been trying to use http://yum.baseurl.org/api/yum/yum/depsolve.html and while my simple test does return conflicts (in the form of error strings, ick) it is not finding dependencies:

import yum
import sys

yb = yum.YumBase()
yb.conf.cache = True

resolution_data = []

for package_name in sys.argv[1:]:
    yb.install(name=package_name)

res = yb.resolveDeps()
(result, resultmsgs) = yb.buildTransaction()
print "Result:"
print result

print "Result MSGs:"
print resultmsgs

if (res[0] == 1):
    for item in res[1]:
        if item not in resolution_data:
            resolution_data.append(item)

print "Res Data:"
print resolution_data

example output:

Loaded plugins: fastestmirror, post-transaction-actions, presto, refresh-
              : packagekit
Result:
1
Result MSGs:
['XYZ conflicts with ABC', 'ABC conflicts with XYZ']
Res Data:
['XYZ conflicts with ABC', 'ABC conflicts with XYZ']

So my questions are:
  1. Is http://yum.baseurl.org/api/yum/yum/depsolve.html the right thing to use for this?
  2. Is there a way to have it return conflicts as a data structure instead of a string?
  3. Is there a way to have it also do dependencies that would need installed and updated?
  4. Will it calculate the dependencies when I add in some yb.remove() and yb.upgrade() calls before the yb.resolveDeps() call?
  5. The examples I can find all call yb.buildTransaction() which would actually do the install/etc correct? If so is there a way to make it a dry run (i.e. on;y do the derp resolution)?
This Given/When/Then may illustrate the goal also.

GIVEN the current state of my RPMs

foo : installed
bar : not_installed
baz : updatable

WHEN I want to explicitly install, update, or uninstall packages

install : [bar,ler]
uninstall : [foo]
upgrade : [baz]

THEN I want to be able know [what would need/will be] implicitly installed, updated, or uninstalled (recursively)

resolved : {
    install : [baz] # because bar depends on it
    uninstall : [wop,jib] # because wop conflicts with bar && jib conflicts with ler
    upgrade : [zig] # because newer baz requires a newer version of zig
}


Then we can highlight/deal with the case where a package exists in more than one install/uninstall/upgrade slot :)

Thanks in advance!

--
Dan Muey - cPanel Developer
dan@xxxxxxxxxx

_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux