Product SiteDocumentation Site

6.5. 前端:aptitudesynaptic

APT is a C++ program whose code mainly resides in the libapt-pkg shared library. Using a shared library facilitates the creation of user interfaces (frontends), since the code contained in the library can easily be reused. Historically, apt-get was only designed as a test frontend for libapt-pkg but its success tends to obscure this fact.

6.5.1. aptitude

aptitude 是交互程序,可用于终端机的半图形模式,可浏览已安装与可用软件包,搜索所有可用信息,并选择安装或移除的软件包。此程序专为管理者而设计,缺省的行为比 apt-get 的行为更智能,且其界面更容易理解。
aptitude 软件包管理器

图 6.1. aptitude 软件包管理器

开始的时候,aptitude 依状态显示所有的软件包 (已安装、未安装、或已安装但不在镜像站 — 其他的区块显示工作、虚拟软件包、与最近才出现在镜像站的新软件包)。还有其他的查看方法,提供主题式浏览。所有的情况下,aptitude 在屏幕显示各主题与软件包的清单。以树状组织主题,可以用 Enter[] 按键展开与收起分支。+ 标示可安装的软件包,- 标示可移除的软件包,_ 标示可清除的软件包 (这些按键也可用类别,对应的行为适用于类别内的所有软件包)。u 更新可用软件包清单,Shift+u 准备全系统的更新。g 切换摘要查看模式(再次键入 g 则应用更改),q 离开现在的视图。若您在初始的视图,将关闭 aptitude
键入 / 及搜索的关键词,就能搜索软件包。关键词对应软件包的名称,也可以是用于描述内容 (若前置 ~d、区域 (前置 ~s) 或文档内的其他字词。同样地关键词可以筛选显示软件包的清单:键入 l (如同在 limit 之内) 与其他关键词。
Managing the “automatic flag” of Debian packages (see 第 6.2.7 节 “自动追踪已安装的软件包”) is a breeze with aptitude. It is possible to browse the list of installed packages and mark packages as automatic with Shift+m or to remove the mark with the m key. “Automatic packages” are displayed with an “A” in the list of packages. This feature also offers a simple way to visualize the packages in use on a machine, without all the libraries and dependencies that you don't really care about. The related pattern that can be used with l (to activate the filter mode) is ~i!~M. It specifies that you only want to see installed packages (~i) not marked as automatic (!~M). 管理推荐、建议与工作

aptitude 另个有趣的功能是尊重软件包间的建议,但给使用以个案方式选择不安装的自由。例如,gnome 软件包建议 transmission-gtk (及其他选择)。选择前者安装时,后者也被选取 (若未安装在系统内则标记为自动)。键入 g 将使其更明显: transmission-gtk 显示在满足相依性的自动安装软件包清单里的待决摘要画面。然而,在确认前可以不选择,自行决定要不要安装。
注意,这个推荐的追踪功能不适用于更新。例如,若新版 gnome 推荐一个以前不推荐的软件包,那么就不会安装它。然而,还是列在屏幕,管理者仍可点击并安装它。
同时把软件包间的建议列入考量,但调整特别的情况。例如,自从 gnome 建议 empathy,后者显示在屏幕的待决区 (其他软件包的建议区)。这样子,就能看见且管理者可以决定是否把它们列入考量。毕竟只是建议而不是相依或提议,软件包仍不会被列入自动 — 需要读者的人工介入 (因此,软件包不会被标示为自动)。
在同样的精神下,记得 aptitude 以智能的手法使用工作的概念。在屏幕的软件包清单中显示工作,可以安装或移除选定的完整工作,或浏览包括选定较小工作的软件包清单。 更好的解决算法

To conclude this section, let's note that aptitude has more elaborate algorithms compared to apt-get when it comes to resolving difficult situations. When a set of actions is requested and when these combined actions would lead to an incoherent system, aptitude evaluates several possible scenarios and presents them in order of decreasing relevance. However, these algorithms are not fail-proof. Fortunately there is always the possibility to manually select the actions to perform. When the currently selected actions lead to contradictions, the upper part of the screen indicates a number of “broken” packages (and you can directly navigate to those packages by pressing b). It is then possible to manually build a solution for the problems found. In particular, you can get access to the different available versions by simply selecting the package with Enter. If the selection of one of these versions solves the problem, you should not hesitate to use the function. When the number of broken packages gets down to zero, you can safely go to the summary screen of pending actions for a last check before you apply them.

6.5.2. synaptic

synaptic 是 Debian 的软件包图形管理器,在 GTK+/GNOME 的基础上提供清楚有效的图形接口。它以很多的立即可用筛选器提供快速添加的软件包、安装软件包、可升级软件包、过时软件包等。经由这些清单浏览,选定对软件包的工作 (安装、升级、移除、清除);不会立即运行此等工作,但把它们放入工作清单。单键按下可运行的工作,接着就可运行。
synaptic 软件包管理器

图 6.2. synaptic 软件包管理器