Product SiteDocumentation Site

6.4. 前置:aptitudesynaptic

APT 是 C++ 寫成程式,甚原始碼在 libapt-pkg 共享程式庫內。以此共享程式庫建立讀者介面 (前置),因為很容易再利用在程式庫內的原始碼。過去 apt-get 祗當做 libapt-pkg 的測試前置,但此事實也漸趨模糊。

6.4.1. aptitude

aptitude 是互動程式,可用於終端機的半圖形模式可瀏覽已安裝與可得套件,搜尋所有可用資訊,並選擇安裝或移除的套件。此程式專為管理者而設計,預設的對象比 apt-get 的對象更聰慧,且其介面更容易理解。
The aptitude 套件管理者

圖形 6.1. The aptitude 套件管理者

When it starts, aptitude shows a list of packages sorted by state (installed, non-installed, or installed but not available on the mirrors — other sections display tasks, virtual packages, and new packages that appeared recently on mirrors). To facilitate thematic browsing, other views are available. In all cases, aptitude displays a list combining categories and packages on the screen. Categories are organized through a tree structure, whose branches can respectively be unfolded or closed with the Enter, [ and ] keys. + should be used to mark a package for installation, - to mark it for removal and _ to purge it (note that these keys can also be used for categories, in which case the corresponding actions will be applied to all the packages of the category). u updates the lists of available packages and Shift+u prepares a global system upgrade. g switches to a summary view of the requested changes (and typing g again will apply the changes), and q quits the current view. If you are in the initial view, this will effectively close aptitude.
鍵入 / 及搜尋的鍵詞,就能搜尋套件。鍵詞對應至套件的名稱,也可應用於描述內容 (若前置 ~d、區塊 (前置 ~s) 或文件內的其他字詞。同樣的鍵詞可以篩選顯示套件的清單:鍵入 l 鍵 (如同在 limit 之內) 與其他鍵詞。
管理 Debian 套件的 “自動旗標” (見 節 6.2.7, “自動追蹤已安裝的套件”),對 aptitude 而言是小事一椿。可以用 Shift+m 瀏覽已安裝並標示為自動的套件或以 m 鍵移除標示。在套件清單內,“自動套件” 標示為 “A”。此功能也可簡單看到機器內正在使用的套件,不必看那些程式庫與相依性繁瑣的細節。相關的鍵詞可以與 l (啟動篩選模式) 一起使用的是 ~i!~M。它的作用是祗看已安裝的套件 (~i) 不是被標示為自動(!~M) 的套件。

6.4.1.1. 管理推薦、建議與工作

Another interesting feature of aptitude is the fact that it respects recommendations between packages while still giving users the choice not to install them on a case by case basis. For example, the gnome package recommends brasero (among others). When you select the former for installation, the latter will also be selected (and marked as automatic if not already installed on the system). Typing g will make it obvious: brasero appears on the summary screen of pending actions in the list of packages installed automatically to satisfy dependencies. However, you can decide not to install it by deselecting it before confirming the operations.
此推薦追蹤功能不適用於更新。例如,若 gnome 新版建議一個不包括稍前版本的套件,就不會安裝它。然而,還是列在螢幕,管理者仍可點選並安裝它。
Suggestions between packages are also taken into account, but in a manner adapted to their specific status. For example, since gnome suggests empathy, the latter will be displayed on the summary screen of pending actions (in the section of packages suggested by other packages). This way, it is visible and the administrator can decide whether to take the suggestion into account or not. Since it is only a suggestion and not a dependency or a recommendation, the package will not be selected automatically — its selection requires a manual intervention from the user (thus, the package will not be marked as automatic).
在同樣的精神下,記得 aptitude 以智慧的手法使用工作的概念。在螢幕的套件清單中顯示工作,可以安裝或移除選定的完整工作,或瀏覽包括選定較小工作的套件清單。

6.4.1.2. 較佳的解決演算法

總結本段的內容,在解決困難情境時,aptitude 的演算較 apt-get 更為複雜。需要執行一組工作且可能帶領至另個支離的系統,aptitude 評估若干可能的狀況以遞減關聯的方式呈現。然而,這些演算法不是失敗的證明。幸運的是,總有手動選擇執行的可能。現在的選擇帶領至矛盾的地方時,螢幕的上方就指出若干 “破碎” 的套件 (and you can directly navigate to those packages by pressing b)。就可能以人工方式建立解決此問題的方案。尤其是,可以按 Enter 鍵選取近用多個可用的版本。選定的版本可以解決問題,就勇敢不遲疑地使用其功能。破碎套件漸趨於零後,您可安全地進入待決區的摘要畫面,於使用前再次確認。

6.4.2. synaptic

synaptic 是 Debian 的套件圖形管理器,在 GTK+/GNOME 的基礎上提供清楚有效的圖形介面。它以很多的立即可用篩選器提供快速近用新增的套件、安裝套件、可升級套件、過時套件等。經由這些清單瀏覽,選定對套件的工作 (安裝、升級、移除、清除);不會立即執行此等工作,但把它們放入工作清單。單鍵按下可執行的工作,接著就可執行。
synaptic 套件管理器

圖形 6.2. synaptic 套件管理器