Am Donnerstag 04 September 2008 16:24:17 schrieb Jano Kupec:
Jan-Simon Möller wrote:
Moin moin!
for item in pool: ... print item.string() ... U__s_(2)ConsoleKit-x11-0.2.10-12.3.i586(software) [...] U__s_(546)hicolor-icon-theme-0.10-63.5.noarch(software)
Jippie - it works with zypp from svn. So just one more question: can i somehow only query
* packagename * version * repoalias
or do i need to extract this.
nope.. that would be shame for libzypp :O)
This 'item' is probably a zypp::ui::Selectable (don't know what's the Python way of saying this), right? then 'item.name()' should work.
> item.name() doesn't work.
[...]
I couldn't sleep, so i looked at some snippets in satsolver-bindings.
What works now is this (don't blame me, I'm learning ;) ): (all in python-bindings)
Import the remote repo with libzypp. Load the solv file with satsolver. Get the values i want.
It looks like this:
import zypp
import satsolver
zy = zypp.ZYppFactory_instance().getZYpp()
mytemppath = zypp.Pathname( "/tmp/a" )
zy.initializeTarget( mytemppath )
myrepoinfo = zypp.RepoInfo()
myrepoinfo.addBaseUrl( zypp.Url( "http://localhost/software/base_factory" )) # local obs instance output
myrepoinfo.setAlias( "software" )
myrepoinfo.setEnabled( True )
myrepoinfo.setType( zypp.RepoType.RPMMD )
myrepoinfo.setGpgCheck( False ) # not yet implemented . i would need this atm : ZYPP_KEYRING_DEFAULT_ACCEPT_ALL=1
myrepomanageroptions = zypp.RepoManagerOptions( mytemppath )
myrepomanager = zypp.RepoManager( myrepomanageroptions )
myrepomanager.addRepository( myrepoinfo )
myrepomanager.refreshMetadata( myrepoinfo )
myrepomanager.buildCache( myrepoinfo )
myrepomanager.loadFromCache( myrepoinfo )
for item in pool:
print item.string() # e.g. U__s_(213)cairo-doc-1.4.14-20.2.i586(software)
print item # e.g.