Mailinglist Archive: zypp-devel (149 mails)

< Previous Next >
Re: [zypp-devel] jippie - my pool gets listed! Q: nicer output ?
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Fri, 5 Sep 2008 19:29:27 +0200
  • Message-id: <20080905172927.GA3479@xxxxxxx>
On Fri, Sep 05, Jan-Simon M?ller wrote:

Am Freitag 05 September 2008 14:14:57 schrieb Michael Andres:
PoolItem combines Solvable and Status:
Right ... which is good ;)

item.resolvable() // Type zypp::ResObject_Ptr

item.resolvable().name()
item.resolvable().edition()
.arch()
.provides()
.summary()
.description()
.repoInfo()
...

But i need "Group" which is not available by this.

(see ResObject and Resolvable)

ResObject is the base class providing attributes
common to Package, Pattern, Patch and Product.

You can use e.g zypp.isKindPackage( item ) to test whether some item is
a Package. And zypp.asKindPackage( item ) to return the corresponding
Package that gives access to all Package attributes:

( This requires libzypp / libzypp-binding from SVN revision 10956 )

+------------------------------------------------------------------+
#! /usr/bin/python
import zypp

Z = zypp.ZYppFactory_instance().getZYpp()
Z.initializeTarget( zypp.Pathname("/") )
Z.target().load();

repoManager = zypp.RepoManager()
repos = repoManager.knownRepositories()

for repo in repos:
if not repo.enabled():
continue
if not repoManager.isCached( repo ):
repoManager.buildCache( repo )
repoManager.loadFromCache( repo );

print "Items: %d" % ( Z.pool().size() )

for item in Z.pool():
if item.status().isInstalled():
t = "i"
else:
t = "*"

print "%s %s:%s-%s.%s\t(%s)" % ( t,
item.kind(),
item.name(),
item.edition(),
item.arch(),
item.repoInfo().alias() )
if zypp.isKindPackage( item ):
print " Group: %s" %(zypp.asKindPackage( item ).group( ) )
+------------------------------------------------------------------+

--

cu,
Michael Andres

+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+

--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >