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.
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: - Is http://yum.baseurl.org/api/yum/yum/depsolve.html the right thing to use for this?
- Is there a way to have it return conflicts as a data structure instead of a string?
- Is there a way to have it also do dependencies that would need installed and updated?
- Will it calculate the dependencies when I add in some yb.remove() and yb.upgrade() calls before the yb.resolveDeps() call?
- 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 :)
|
_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum