Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to obtain solvable filelists #20

Closed
ghost opened this issue Nov 2, 2012 · 3 comments
Closed

Unable to obtain solvable filelists #20

ghost opened this issue Nov 2, 2012 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 2, 2012

How can one obtain the filelist of a solvable? Tried solvable.lookup_idarray(solv.SOLVABLE_FILELIST)

@mlschroe
Copy link
Member

mlschroe commented Nov 5, 2012

The filelist is not an idarray, but a list of (dirname id, basename) pairs, so lookup_idarray cannot work. You have to use a dataiterator to iterate over the filelist:

for dm in s.pool.Dataiterator(s.id, solv.SOLVABLE_FILELIST, "",
solv.Dataiterator.SEARCH_SUBSTRING|solv.Dataiterator.SEARCH_FILES):
print dm.str()

Sorry about that SEARCH_SUBSTRING, it's currently the only way to force stringification
of the (dirid, string) tuple. I'll fix that.
I'll also add a Solvable.Dataiterator constructor to simplify the code a bit.

@mlschroe
Copy link
Member

mlschroe commented Nov 5, 2012

(Oh, I forgot that you also need to add SEARCH_COMPLETE_FILELIST if you want to get all files, not just the filelist from the main primary file.)

@mlschroe
Copy link
Member

mlschroe commented Nov 5, 2012

Ok, with the latest commit it's a bit easier:

for dm in s.Dataiterator(solv.SOLVABLE_FILELIST, None, solv.Dataiterator.SEARCH_FILES):
print dm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant