views:

294

answers:

3

Somebody used libapt or libept to list packages and get informations about package in a debian-like system?

Libapt is not well-documented at all, and i've found few examples and tutorials about libept. Can someone explain me best methods to

  1. get a list of every packages in the apt-system
  2. get informations about single packages (like name, version, dependences, description, etc.
  3. get list of files installed by a single package

Work directly with apt internal files is quite simple, but i want to use a library to respect apt specifications. Thank you in advance.

+1  A: 

Take a look at how apt-cache(8) is implemented. Obtaining the source with apt is easy:

# apt-get source apt

In the source file cmdline/apt-cache.cc theres is a function called DumpPackage() which extracts information from a named file in the cache.

joveha
A: 

I've found in libept simple and easy solution. Thank you for the help

Emilio
A: 

There is also DPKG::Parse from CPAN if you are using perl.

jeremiah