Mailinglist Archive: zypp-devel (149 mails)
| < Previous | Next > |
Re: [zypp-devel] jippie - my pool gets listed! Q: nicer output ?
- From: "Jan-Simon Möller" <dl9pf@xxxxxx>
- Date: Fri, 5 Sep 2008 04:16:29 +0200
- Message-id: <200809050416.30029.dl9pf@xxxxxx>
Am Donnerstag 04 September 2008 16:24:17 schrieb Jano Kupec:
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. <zypp.PoolItem; proxy of <Swig Object of
type 'zypp::PoolItem *' at 0x708860> >
# i had no idea how to proceed from here /me blind watching doxygen pages
and stuff like ^^^^^
# then i looked at satsolver and discovered
/tmp/a/var/cache/zypp/solv/software/solv
# so if someone could show me how to do this with libzypp - he would be my hero
of the day ;)
mysatpool = satsolver.Pool()
tmprepo = mysatpool.add_solv("/tmp/a/var/cache/zypp/solv/software/solv")
tmprepo.set_name("myhackrepo")
mysatpool.prepare()
for solv in mysatpool:
print solv
print "Name : "+str(solv.name())
print "Version : "+str(solv.evr())
print "Group : "+str(solv.attr("solvable:group"))
print "Summary : "+str(solv.attr("solvable:summary"))
print "Description:"
print solv.attr("solvable:description")
# These are the values I wanna use atm.
Thanks!
Best regards
Jan-Simon
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
Jan-Simon Möller wrote:<zypp.PoolItem; proxy of <Swig Object of type 'zypp::PoolItem *' at 0x834cc0> >
Moin moin!
... print item.string()for item in pool:
...
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. <zypp.PoolItem; proxy of <Swig Object of
type 'zypp::PoolItem *' at 0x708860> >
# i had no idea how to proceed from here /me blind watching doxygen pages
and stuff like ^^^^^
# then i looked at satsolver and discovered
/tmp/a/var/cache/zypp/solv/software/solv
# so if someone could show me how to do this with libzypp - he would be my hero
of the day ;)
mysatpool = satsolver.Pool()
tmprepo = mysatpool.add_solv("/tmp/a/var/cache/zypp/solv/software/solv")
tmprepo.set_name("myhackrepo")
mysatpool.prepare()
for solv in mysatpool:
print solv
print "Name : "+str(solv.name())
print "Version : "+str(solv.evr())
print "Group : "+str(solv.attr("solvable:group"))
print "Summary : "+str(solv.attr("solvable:summary"))
print "Description:"
print solv.attr("solvable:description")
# These are the values I wanna use atm.
Thanks!
Best regards
Jan-Simon
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |