[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to access package information from python

On Wed, Apr 09, 2003 at 12:13:05AM +0200, Jochen Voss wrote:
> (1) the dependencies, predependencies, and build-dependencies of a
> specific Debian package,

Depends, and Pre-Depends fields may be obtained from binary package control
file with:

1) dpkg -I <file>
1.1) apt-cache show <package>

While Build-Depends and Build-Depends-Indep may be obtained by the .dsc file
which is not in the binary package: i don't know if you can get it from any
file on the system.

> (2) a list of all essential packages, and
> (3) a list of all required packages

This two can be extracted from the /var/lib/dpkg/available file. 
Even Depends and Pre-Depends may be extracted from available file (while
Build-Depends and Build-Depends-Indep still not).

Perheps, you may be faster reading from grep-available (grep-dctrl package)
output, instead of parsing the entire file:

1.2) grep-available -s Package,Depends,Pre-Depends -P <pacakge>
2) grep-available -n -s Package -F Essential yes
3) grep-available -n -s Package -F Priority required

(These are all single line fields of the type "Key: value")

Or, you may consider to use python-apt api to read the apt packages.bin and
srcpackages.bin files: Personally, I found the documentation still messy and I
lose the will to use them very quickly.

Luca - De Whiskey's - De Vitis              | Elegant or ugly code as well
aliases: Luca ^De [A-Z][-A-Za-z]*[iy]'?s$   | as fine or rude sentences have
Infinite loop: see `Loop, infinite'.        | something in common: they
Loop, infinite: see `Infinite loop'.        | don't depend on the language.

Attachment: pgpslogbHB6OK.pgp
Description: PGP signature

Reply to: