Mailinglist Archive: opensuse-softwaremgmt (36 mails)

< Previous Next >
Re: [softwaremgmt] python/libzypp: query source repo of installed packages
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Tue, 5 May 2009 14:51:38 +0200
  • Message-id: <20090505125138.GC11798@xxxxxxxxxxxxx>
* Michael Andres <ma@xxxxxxx> [May 05. 2009 12:24]:
On Monday 04 May 2009 02:28:02 Elmar Stellnberger wrote:
wanna make a package stat - how many packages are currently installed
from a given source:
how can I
* query for all installed packages

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

The satsolver provide an alternative for simple package operations.
A simple example would be

import satsolver

pool = satsolver.Pool()
pool.set_arch("i686")
repo = pool.add_rpmdb( "/" )
print repo.size(), " installed packages"
for s in pool:
print s, s.vendor()

(see sat-solver/bindings/python/tests/rpmdb.py
http://git.opensuse.org/?p=projects/zypp/sat-solver.git;a=blob_plain;f=bindings/python/tests/rpmdb.py;hb=master)


The code won't help you. Look at the 'item.repoInfo().alias()' output in the
above example. An installed packages repository is the '@system' repository,
aka the rpm database, an not the repository package was installed from.


Actually, I question the value of this information because of mirrors.
The package origin, usually covered in the package vendor and its signing
key, is more valuable.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

--
To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-softwaremgmt+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups