Quoting "Michael Andres"
On Wednesday 08 September 2010 16:01:36 Ricardo Cruz wrote:
What string should I pass to _zypp.initializeTarget() ?
The root of your system. Usually '/', unless you use --root.
That was one of my first tries, but it's of no use. pool.size() still returns 0, and I know I have packages installed in my system. :) Anyhow, digging up some of mountain zypp, it seems I may have to also issue a: zyppPtr->target()->load(); But I still have to give it a try.
I have tried to dig up yast2 code on this, but couldn't
Yast is too confuising ;). Try zypper or some of the tests/examples in the libzypp git.
I've looked at libzypp's test directory, and they seemed to make use of temporary databases.
Beware, the examples are pretty outdated but at least list_resolvables works.
There aren't many of them either. rick2@andor:~/Documentos/yast/libzypp/examples$ ls CMakeLists.txt COW_debug.cc EditionCompare.cc README whatprovides.cc
(patches/suggestions are wellcome ;) I added an onSystemByUser call as you asked for some 'p.installedBySolver' in the previous mail. Since libzypp-7.5.0: + /** Whether this is known to be installed on behalf of a user request. + * \note This is a hint guessed by evaluating an available install history. + * Returns \c false for non-system (uninstalled) solvables, or if no history + * is available. + */ + bool onSystemByUser() const;
Very nice, thanks. Please just add there a comment on the performance of the function, otherwise people may unnecessarily abuse it. I assume it's O(N): you iterate through the logs every time the function is called. Much appreciated, Ricardo ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org