开发者

Debian packages: distinguish "requested install" from "installed to satisfy dependencies"

How can I determine which packages where installed because I requested the installation and which packages where automatically installed in order to satisfy dependencies?

In aptitude, this information is shown as "A":

i A fam         ...
i   grub        ...
i A grub-common ...

This shows that I requested the pa开发者_C百科ckage grub and that grub-common was installed as a result of this. However, aptitude is an interactive program, I cannot extract this information automatically to process it with a script.

With the debian package management tool 'dpkg -l' or 'dpkg --get-selections', I can get a list of installed package with additional information. E.g.

> dpkg -l
...
ii  grub                                 0.97-47lenny2              GRand Unified Bootloader (Legacy version)
ii  grub-common                          1.96+20080724-16           GRand Unified Bootloader, version 2 (common files)
ii  gs-common                            8.62.dfsg.1-3.2lenny1      Dummy package depending on ghostscript
...

This list can easily be processed with scripts, but it only shows that the packages are installed --- not whether by request or for dependencies.


indeed one can call aptitude search with the so-called search patterns; see reference at http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s03s05.html#tableSearchTermQuickGuide search ~i yields installed packages. Using grep to discard packages with A gives packages not automatically installed, so it almost answers the original question.

But it includes packages that belong to the original distribution, so its not completely sorted out. In my case, its still 1500 packages, a set I can deal with.

Its probably possible to do it by search combination, I didnt dig, here is my command:

aptitude search ~i|grep -v '^i A'|

the grep -v discards dependent packages


Aptitude runs as a commandline-only, gui-less program too. Try:

aptitude search grub

The information will be there.


Apt supports an 'auto' flag which describes precisely this.

Look at http://man.he.net/man8/apt-mark and dig deeper if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜