0 - en to zh-CN translation catalogue (223 entries)

en: Binary package
zh-CN: 二进制包

en: Source package
zh-CN: 源码包

en: dependencies
zh-CN: 依赖

en: conflict
zh-CN: 冲突

en: Packaging System: Tools and Fundamental Principles
zh-CN: 包管理系统：工具和基本原则

en: As a Debian system administrator, you will routinely handle <filename>.deb</filename> packages, since they contain consistent functional units (applications, documentation, etc.), whose installation and maintenance they facilitate. It is therefore a good idea to know what they are and how to use them.
zh-CN: 作为 Debian 系统管理员，你经常地要处理 <filename>.deb</filename> 包，因为它们包含一致的功能单元（应用程序、文档等），使得安装和维护更容易。所以了解它们是什么及如何使用它们是个好主意。

en: This chapter describes the structure and contents of “binary” and “source” packages. The former are files directly usable by <command>dpkg</command>, while the latter contain the source code, as well as instructions for building binary packages.
zh-CN: 本章介绍了“二进制”和“源码”包的结构和内容。前者是文件，可以用 <command>dpkg</command> 命令直接处理；而后者则包含程序的源代码，以及创建二进制包的指令。

en: Structure of a Binary Package
zh-CN: 二进制包的结构

en: <primary>package</primary><secondary>binary package</secondary><seealso><filename>.deb</filename></seealso>
zh-CN: <primary>package</primary><secondary>二进制包</secondary><seealso><filename>.deb</filename></seealso>

en: The Debian package format is designed so that its content may be extracted on any Unix system that has the classic commands <command>ar</command>, <command>tar</command>, and <command>xz</command> or sometimes <command>gzip</command> or <command>bzip2</command>. This seemingly trivial property is important for portability and disaster recovery.
zh-CN: Debian 软件包格式被这样设计，在具有经典命令如 <command>ar</command>、<command>tar</command> 和 <command>xz</command> 或者有时候是 <command>gzip</command> 或 <command>bzip2</command>的 Unix 系统上，它的内容都可以被解压。这是个看起来琐碎的属性对移植和灾难恢复是非常重要的。

en: Imagine, for example, that you mistakenly deleted the <command>dpkg</command> program, and that you could thus no longer install Debian packages. <command>dpkg</command> being a Debian package itself, it would seem your system would be done for... Fortunately, you know the format of a package and can therefore <ulink url="https://www.debian.org/distrib/packages#search_packages">download</ulink> the <filename>.deb</filename> file of the <emphasis role="pkg">dpkg</emphasis> package and install it manually (see sidebar <xref linkend="sidebar.dpkg-apt-ar" />). If by some misfortune one or more of the programs <command>ar</command>, <command>tar</command> or <command>gzip</command>/<command>xz</command>/<command>bzip2</command> have disappeared, you will only need to copy the missing program from another system (since each of these operates in a completely autonomous manner, without dependencies, a simple copy will suffice). If your system suffered some even more outrageous fortune, and even these don't work (maybe the deepest system libraries are missing?), you should try the static version of <command>busybox</command> (provided in the <emphasis role="pkg">busybox-static</emphasis> package), which is even more self-contained, and provides subcommands such as <command>busybox ar</command>, <command>busybox tar</command> and <command>busybox xz</command>.
zh-CN: 想象一下，例如您误删了<command>dpkg</command> 程序，因此无法再安装 Debian 软件包了。 <command>dpkg</command> 本身作为一个 Debian 软件包，看起来系统似乎完蛋了... 幸运的是，您知道软件包的格式，这样可以<ulink url="https://www.debian.org/distrib/packages#search_packages">下载</ulink> <emphasis role="pkg">dpkg</emphasis> 软件包的 <filename>.deb</filename> 文件，并手动安装（请参见侧边栏 <xref linkend="sidebar.dpkg-apt-ar" />）。某些不幸的情况下，一个或多个 <command>ar</command>、 <command>tar</command> 或者 <command>gzip</command>/<command>xz</command>/<command>bzip2</command> 程序丢失了，您仅需从其它系统上直接复制缺失的程序（因为它们中的任一个都独立工作而没有依赖的问题，因此简单复制足矣）。如果您的系统出现了更加反常的问题，甚至以上手段无法奏效（可能是最深处的系统库文件丢失？），您应当尝试 <command>busybox</command>的静态版本 （在 <emphasis role="pkg">busybox-static</emphasis> 软件包中提供），它更加独立化，并能提供如下子命令：<command>busybox ar</command>、<command>busybox tar</command> 和 <command>busybox xz</command>。

en: <emphasis>In case of a misfortune you better also have a backup of your system (see <xref linkend="sect.backup" />).</emphasis>
zh-CN: <emphasis>为了避免运气不好的情况，最好备份系统（请参考<xref linkend="sect.backup" />）。</emphasis>

en: <emphasis>TOOLS</emphasis> <command>dpkg</command>, <command>APT</command> and <command>ar</command>
zh-CN: <emphasis>工具</emphasis> <command>dpkg</command>、<command>APT</command> 和 <command>ar</command>

en: <command>dpkg</command> is the program that handles <filename>.deb</filename> files (binary packages), notably extracting, analyzing, and unpacking them.
zh-CN: <command>dpkg</command> 是处理 <filename>.deb</filename> 文件（二进制包）的命令，包括提取、分析和解包。

en: <acronym>APT</acronym> (the abbreviation of "Advanced Packaging Tool") is a group of programs that allows the execution of higher-level modifications to the system: installing or removing a package (while keeping dependencies satisfied), updating and upgrading the system, listing the available packages, etc.
zh-CN: <acronym>APT</acronym> （“Advanced Packaging Tool”的缩写）是一组允许对系统进行高层定制的程序：安装或者删除一个软件包（并且保持依赖关系满足），更新系统，升级系统，列出可用的软件包等。

en: <primary>unpacking</primary><secondary>binary package</secondary>
zh-CN: <primary>解压</primary><secondary>运行软件包</secondary>

en: <emphasis>BACK TO BASICS</emphasis> Man page notation
zh-CN: <emphasis>基础知识</emphasis> Man 手册注记

en: It can be confusing for beginners to find references to “<citerefentry><refentrytitle>ar</refentrytitle><manvolnum>1</manvolnum></citerefentry>” in the literature. This is generally a convenient means of referring to the man page entitled <literal>ar</literal> in section 1.
zh-CN: 初学者可能会在看到“<citerefentry><refentrytitle>ar</refentrytitle><manvolnum>1</manvolnum></citerefentry>”这样的文字注记时感到疑惑。这通常是个简写，它表示指向 man 手册第一类中标题是 <literal>ar</literal> 的页面。

en: Sometimes this notation is also used to remove ambiguities, for example to distinguish between the <command>printf</command> command that can also be indicated by <citerefentry><refentrytitle>printf</refentrytitle><manvolnum>1</manvolnum></citerefentry> and the <function>printf</function> function in the C programming language, which can also be referred to as <citerefentry><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
zh-CN: 有时这种注记也用来避免歧义，比如要区分清楚是 <command>printf</command> 命令，可以用 <citerefentry><refentrytitle>printf</refentrytitle><manvolnum>1</manvolnum></citerefentry> 来指明，如果是 C 语言里的 <function>printf</function> 函数，就可以用 <citerefentry><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry> 来引用。

en: <xref linkend="solving-problems" /> discusses manual pages in further detail (see <xref linkend="sect.manual-pages" />).
zh-CN: <xref linkend="solving-problems" /> 更详细地讨论手册页 (参见 <xref linkend="sect.manual-pages" />)。

en: Have a look at the content of a <filename>.deb</filename> file:
zh-CN: 来看看 <filename>.deb</filename> 文件的内容：

en: As you can see, the <command>ar</command> archive of a Debian package is comprised of three files:
zh-CN: 如你所见， Debian 包的 <command>ar</command> 存档格式由三个文件组成：

en: <filename>debian-binary</filename>
zh-CN: <filename>Debian 二进制文件</filename>

en: This archive file contains all of the available meta-information, like the name and version of the package as well as some scripts to run before, during or after (un-)installation of it. Some of the meta-information allows package management tools to determine if it is possible to install or uninstall it, for example according to the list of packages already on the machine, and if files shipped have been modified locally.
zh-CN: 该档案文件包含所有可用的元信息，如软件包的名称和版本，以及在安装/卸载之前、之中或之后使用的脚本。一些元信息允许软件包管理工具根据例如机器上已有的软件包列表，来决定是否能够安装或卸载它，或者决定一起发布的文件是否已经在本地被修改。

en: This archive contains all of the files to be extracted from the package; this is where the executable files, libraries, documentation, etc., are all stored. Packages may use different compression formats, in which case the file will be named differently for <command>xz</command>, <command>bzip2</command> or <command>gzip</command>.
zh-CN: 这个归档文件包含软件包中所有要解压的文件，包括可执行文件、库和文档等。软件包可能使用不同的压缩格式，因此文件后缀会有所不同如<command>xz</command>、<command>bzip2</command> 或 <command>gzip</command>。

en: Package Meta-Information
zh-CN: 软件包元信息

en: <primary>package meta-information</primary><seealso>meta-information</seealso>
zh-CN: <primary>软件包元信息</primary><seealso>元信息</seealso>

en: <primary>package</primary><secondary>meta-information</secondary>
zh-CN: <primary>软件包</primary><secondary>元信息</secondary>

en: <primary>package</primary><secondary>maintainer scripts</secondary>
zh-CN: <primary>软件包</primary><secondary>维护者脚本</secondary>

en: <primary>package</primary><secondary>checksums</secondary>
zh-CN: <primary>软件包</primary><secondary>校验和</secondary>

en: Description: the <filename>control</filename> File
zh-CN: 描述：<filename>control</filename> 文件

en: <primary>package meta-information</primary>
zh-CN: <primary>软件包元信息</primary>

en: <primary>package</primary><secondary><filename>control</filename></secondary>
zh-CN: <primary>软件包</primary><secondary><filename>control</filename></secondary>

en: <primary><filename>control</filename></primary><seealso>package meta-information</seealso>
zh-CN: <primary><filename>control</filename></primary><seealso>软件包元信息</seealso>

en: This file uses a structure similar to email headers (as defined by <link linkend="sidebar.rfc">RFC 2822</link>) and is fully described in the Debian Policy and the manual pages <citerefentry><refentrytitle>deb-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> and <citerefentry><refentrytitle>deb822</refentrytitle><manvolnum>5</manvolnum></citerefentry>. <ulink type="block" url="https://www.debian.org/doc/debian-policy/ch-controlfields.html" />
zh-CN: 本文件使用的结构与email头相似（如由 <link linkend="sidebar.rfc">RFC 2822</link> 定义的），并且在 Debian 政策和手册页面<citerefentry><refentrytitle>deb-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> 和 <citerefentry><refentrytitle>deb822</refentrytitle><manvolnum>5</manvolnum></citerefentry> 中充分描述。<ulink type="block" url="https://www.debian.org/doc/debian-policy/ch-controlfields.html" />

en: For example, for <emphasis role="pkg">apt</emphasis>, the <filename>control</filename> file looks like the following:
zh-CN: 例如，对于 <emphasis role="pkg">apt</emphasis> 软件包，<filename>control</filename> 文件看起来像这样：

en: <emphasis>BACK TO BASICS</emphasis> RFC — Internet standards
zh-CN: <emphasis>基础知识</emphasis> RFC －－ 互联网标准

en: <acronym>RFC</acronym> is the abbreviation of “Request For Comments”. An RFC is generally a technical document that describes what will become an Internet standard. Before becoming standardized and frozen, these standards are submitted for public review (hence their name). The <acronym>IETF</acronym> (Internet Engineering Task Force) decides on the evolution of the status of these documents (proposed standard, draft standard, or standard).
zh-CN: <acronym>RFC</acronym> 是 “Request For Comments”（征求意见稿）的缩写。RFC通常是一份描述将要成为互联网标准的技术文档。在被冻结并标准化之前，这些标准被提交给公众评估（这就是名字的由来）。 <acronym>IETF</acronym> （互联网工程专家组）决定这些文档的演进状态（建议标准、草案或标准）。

en: RFC 2026 defines the process for standardization of Internet protocols. <ulink type="block" url="http://www.faqs.org/rfcs/rfc2026.html" />
zh-CN: RFC 2026 定义了互联网协议标准化的程序。<ulink type="block" url="http://www.faqs.org/rfcs/rfc2026.html" />

en: Dependencies: the <literal>Depends</literal> Field
zh-CN: 依赖：<literal>Depends</literal> 字段

en: <primary>dependency</primary>
zh-CN: <primary>依赖</primary>

en: <primary>package</primary><secondary>dependency</secondary>
zh-CN: <primary>软件包</primary><secondary>依赖</secondary>

en: <command>&lt;&lt;</command>: less than;
zh-CN: <command>&lt;&lt;</command>：小于;

en: <command>&lt;=</command>: less than or equal to;
zh-CN: <command>&lt;=</command>：小于或等于;

en: <command>=</command>: equal to (note that “<literal>2.6.1</literal>” is not equal to “<literal>2.6.1-1</literal>”);
zh-CN: <command>=</command>：等于（注意， “<literal>2.6.1</literal>” 不等于 “<literal>2.6.1-1</literal>”）;

en: <command>&gt;=</command>: greater than or equal to;
zh-CN: <command>&gt;=</command>：大于或等于;

en: <command>&gt;&gt;</command>: greater than.
zh-CN: <command>&gt;&gt;</command>：大于。

en: <primary>meta-package</primary>
zh-CN: <primary>meta-package 元软件包</primary>

en: <emphasis>DEBIAN POLICY</emphasis> <literal>Recommends</literal>, <literal>Suggests</literal>, and <literal>Enhances</literal> fields
zh-CN: <emphasis>DEBIAN 政策</emphasis> <literal>推荐</literal>，<literal>建议</literal>，<literal>增强</literal>

en: <primary>package</primary><secondary>recommendations</secondary>
zh-CN: <primary>软件包</primary><secondary>推荐</secondary>

en: <primary>package</primary><secondary>suggestions</secondary>
zh-CN: <primary>软件包</primary><secondary>建议</secondary>

en: The <literal>Recommends</literal> and <literal>Suggests</literal> fields describe dependencies that are not compulsory. The “recommended” dependencies, the most important, considerably improve the functionality offered by the package but are not indispensable to its operation. The “suggested” dependencies, of secondary importance, indicate that certain packages may complement and increase their respective utility, but it is perfectly reasonable to install one without the others.
zh-CN: <literal>推荐</literal>和<literal>建议</literal>字段描述的依赖关系不是强制性的。“推荐”的依赖，是最重要的，能显著改善由软件包提供的功能，但这并非是必不可少的操作。“建议”的依赖，是次要的，表明某些软件包可以补充或者增加其各自的效果，有充分的理由去单独安装它而不是其它的软件包。

en: <primary>package</primary><secondary>enhancements</secondary>
zh-CN: <primary>软件包</primary><secondary>增强</secondary>

en: The <literal>Enhances</literal> field also describes a suggestion, but in a different context. It is indeed located in the suggested package, and not in the package that benefits from the suggestion. Its interest lies in that it is possible to add a suggestion without having to modify the package that is concerned. Thus, all add-ons, plug-ins, and other extensions of a program can then appear in the list of suggestions related to the software. Although it has existed for several years, this last field is still largely ignored by programs such as <command>apt</command> or <command>synaptic</command>. Its purpose is for a suggestion made by the <literal>Enhances</literal> field to appear to the user in addition to the traditional suggestions — found in the <literal>Suggests</literal> field.
zh-CN: <literal>增强</literal> 字段也描述建议，但是位于不同的内文。实际上位于建议软件包内，而不是受益于建议的软件包内。有可能在不修改软件包的前提下添加建议。因此所有插件、插件与其他的程序延伸可以显示在与软件相关的建议清单内。虽然已存在多年，但是 <command>apt</command> 或 <command>synaptic</command> 等程序依然忽略此字段的存在。<literal>Enhances</literal> 字段提出的建议系在传统建议 — <literal>Suggests</literal> 字段供用户参考。.

en: <emphasis>DEBIAN POLICY</emphasis> <literal>Pre-Depends</literal>, a more demanding <literal>Depends</literal>
zh-CN: <emphasis>DEBIAN 政策</emphasis> <literal>预依赖</literal>, 一个更苛刻的 <literal>依赖</literal>

en: <primary>package</primary><secondary>pre-dependency</secondary>
zh-CN: <primary>软件包</primary><secondary>预依赖</secondary>

en: <primary>pre-dependency</primary>
zh-CN: <primary>预依赖</primary>

en: “Pre-dependencies”, which are listed in the “<literal>Pre-Depends</literal>” field in the package headers, complete the normal dependencies; their syntax is identical. A normal dependency indicates that the package in question must be unpacked and configured before configuration of the package declaring the dependency. A pre-dependency stipulates that the package in question must be unpacked and configured before execution of the pre-installation script of the package declaring the pre-dependency, that is before its installation.
zh-CN: “预依赖”，列在软件包标头的 “<literal>Pre-Depends</literal>” 字段，满足完整的正常依赖；它的语法是相同的。正常的依赖系指必须在声明依赖之前先解开并配置的问题软件包。预依赖规定在运行软件包的预安装脚本前，必须先解开并配置软件包，就是在安装之前。

en: Conflicts: the <literal>Conflicts</literal> field
zh-CN: 冲突：<literal>冲突</literal>字段

en: <primary>conflicts</primary>
zh-CN: <primary>冲突</primary>

en: <primary>package</primary><secondary>conflict</secondary>
zh-CN: <primary>软件包</primary><secondary>冲突</secondary>

en: The <literal>Conflicts</literal> field indicates when a package cannot be installed simultaneously with another. The most common reasons for this are that both packages include a file of the same name and path, or provide the same service on the same TCP port, or would hinder each other's operation.
zh-CN: <literal>Conflicts（冲突）</literal> 字段指示不能与其共存的其它软件包。最常见的理由是两个软件包使用具有相同的名称和路径的文件，或在相同的 TCP 端口提供相同的服务，或会阻碍彼此的操作。

en: <command>dpkg</command> will refuse to install a package if it triggers a conflict with an already installed package, except if the new package specifies that it will “replace” the installed package, in which case <command>dpkg</command> will choose to replace the old package with the new one. <command>apt</command> always follows your instructions: if you choose to install a new package, it will automatically offer to uninstall the package that poses a problem.
zh-CN: <command>dpkg</command> 不会安装冲突的软件包，除非新软件包指明 “取代” 被冲突的软件包，<command>dpkg</command> 才会以新的软件包取代旧的软件包。<command>apt</command> 总是遵循您的指示：若选择安装新软件包，则自动移除造成问题的旧软件包。

en: Incompatibilities: the <literal>Breaks</literal> Field
zh-CN: 不相容性:<literal>中断</literal>字段

en: <primary>incompatibilities</primary>
zh-CN: <primary>不相容性</primary>

en: <primary>package</primary><secondary>incompatibility</secondary>
zh-CN: <primary>包</primary><secondary>不相容性</secondary>

en: The <literal>Breaks</literal> field has an effect similar to that of the <literal>Conflicts</literal> field, but with a special meaning. It signals that the installation of a package will “break” another package (or particular versions of it). In general, this incompatibility between two packages is transitory, and the <literal>Breaks</literal> relationship specifically refers to the incompatible versions.
zh-CN: <literal>中断 Breaks </literal>字段有一个影响和<literal>冲突</literal>字段类似，但它具有特殊的意义。它标志着一个包的安装会将另外一个包（或者是特定版本）中断掉。通常而言，两个包之间的不兼容是短暂的，<literal>中断</literal>关系会特别指出那些不兼容的版本。

en: <command>dpkg</command> will refuse to install a package that breaks an already installed package, and <command>apt</command> will try to resolve the problem by updating the package that would be broken to a newer version (which is assumed to be fixed and, thus, compatible again).
zh-CN: 已经中断现有软件包时，<command>dpkg</command> 将拒绝安装并且 <command>apt</command> 将更新软件包至新的版本试图解决此问题 (通常可解决此问题，并再度兼容)。

en: This type of situation may occur in the case of updates without backwards compatibility: this is the case if the new version no longer functions with the older version, and causes a malfunction in another program without making special provisions. The <literal>Breaks</literal> field prevents the user from running into these problems.
zh-CN: 不向后兼容的更新可能会发生这种情况：如果新版本与旧版本的功能不在另一个程序中做特别规定，这将导致故障。<literal>中断</literal>字段会防止用户继续运行从而遇到这些问题。

en: Provided Items: the <literal>Provides</literal> Field
zh-CN: 提供项：<literal>Provides</literal> 字段

en: This field introduces the very interesting concept of a “virtual package”. It has many roles, but two are of particular importance. The first role consists in using a virtual package to associate a generic service with it (the package “provides” the service). The second indicates that a package completely replaces another, and that for this purpose it can also satisfy the dependencies that the other would satisfy. It is thus possible to create a substitution package without having to use the same package name.
zh-CN: 这个字段引入了一个很有意思的“虚拟包”的概念。它有很多的角色，但有两个特别重要。第一个是由使用虚拟包关联到的一个通用的服务（包“提供”了这些服务）。第二个表示一个包完全取代了另外一个，所以它也能满足依赖的要求。因此，可以创建一个替换而不必使用相同的包名称的包。

en: <emphasis>VOCABULARY</emphasis> Meta-package and virtual package
zh-CN: <emphasis>VOCABULARY</emphasis>元软件包和虚拟包

en: <primary>package</primary><secondary>virtual package</secondary>
zh-CN: <primary>软件包</primary><secondary>虚拟软件包</secondary>

en: <primary>virtual package</primary>
zh-CN: <primary>虚拟软件包</primary>

en: It is essential to clearly distinguish meta-packages from virtual packages. The former are real packages (including real <filename>.deb</filename> files), whose only purpose is to express dependencies.
zh-CN: 这里必须明确的从虚拟软件包里面区分出元软件包。元软件包是真实的元件包（包含真实的<filename>.deb</filename>文件），其唯一目的是用来表示依赖的关系。

en: Virtual packages, however, do not exist physically; they are only a means of identifying real packages based on common, logical criteria (service provided, compatibility with a standard program or a pre-existing package, etc.).
zh-CN: 然而，虚拟软件包并未真实的存在；只是依照通用、逻辑范围 (提供的服务、兼容于标准程序或已存在的软件包等) 辨认真实软件包的手段。

en: Providing a “Service”
zh-CN: 提供一个“服务”

en: Let us discuss the first case in greater detail with an example: all mail servers, such as <emphasis role="pkg">postfix</emphasis> or <emphasis role="pkg">sendmail</emphasis> are said to “provide” the <emphasis role="pkg">mail-transport-agent</emphasis> virtual package. Thus, any package that needs this service to be functional (e.g. a mailing list manager, such as <emphasis role="pkg">smartlist</emphasis> or <emphasis role="pkg">sympa</emphasis>) simply states in its dependencies that it requires a <emphasis role="pkg">mail-transport-agent</emphasis> instead of specifying a large yet incomplete list of possible solutions (e.g. <command>postfix | sendmail | exim4 | …</command>). Furthermore, it is useless to install two mail servers on the same machine, which is why each of these packages declares a conflict with the <emphasis role="pkg">mail-transport-agent</emphasis> virtual package. A conflict between a package and itself is ignored by the system, but this technique will prohibit the installation of two mail servers side by side.
zh-CN: 让我们以范例详述第一个案子：<emphasis role="pkg">postfix</emphasis> 或 <emphasis role="pkg">sendmail</emphasis> 之类的邮件服务器都 “提供” <emphasis role="pkg">mail-transport-agent</emphasis> 虚拟软件包。因此需要启用该等服务的软件包 (如：<emphasis role="pkg">smartlist</emphasis> 或 <emphasis role="pkg">sympa</emphasis> 之类的邮件列表管理器) 只要在其相依性里叙明需要 <emphasis role="pkg">mail-transport-agent</emphasis> 而不是指明还不兼容的可能解决方案清单 (如 <command>postfix | sendmail | exim4 | …</command>)。更进一步来说，在同个机器安装两个邮件服务器是没有用的，因此每个软件包都声明与 <emphasis role="pkg">mail-transport-agent</emphasis> 虚拟软件包冲突。系统忽略冲突的两个软件包，但技术上可以禁止同时安装两个邮件服务器。

en: <emphasis>DEBIAN POLICY</emphasis> List of virtual packages
zh-CN: <emphasis>DEBIAN 政策</emphasis> 虚拟软件包列表

en: For virtual packages to be useful, everyone must agree on their name. This is why they are standardized in the Debian Policy. The list includes among others <emphasis role="pkg">mail-transport-agent</emphasis> for mail servers, <emphasis role="pkg">c-compiler</emphasis> for C programming language compilers, <emphasis role="pkg">www-browser</emphasis> for web browsers, <emphasis role="pkg">httpd</emphasis> for web servers, <emphasis role="pkg">ftp-server</emphasis> for FTP servers, <emphasis role="pkg">x-terminal-emulator</emphasis> for terminal emulators in graphical mode (<command>xterm</command>), and <emphasis role="pkg">x-window-manager</emphasis> for window managers.
zh-CN: 使用虚拟软件包时，每个人都必须同意其名称。这就是在 Debian 政策内把他们标准化的原因。此清单包括邮件服务器 <emphasis role="pkg">mail-transport-agent</emphasis>、C 语言编译器 <emphasis role="pkg">c-compiler</emphasis>、网页浏览器 <emphasis role="pkg">www-browser</emphasis>、网页服务器 <emphasis role="pkg">httpd</emphasis>、FTP 服务器 <emphasis role="pkg">ftp-server</emphasis>、图形模式终端机仿真器 <emphasis role="pkg">x-terminal-emulator</emphasis> (<command>xterm</command>)、以及窗口管理器 <emphasis role="pkg">x-window-manager</emphasis>。

en: Interchangeability with Another Package
zh-CN: 和另一个软件包的可交互性

en: Use of a <literal>Provides</literal> field in order to not break dependencies
zh-CN: 使用了<literal>Provides</literal>字段来避免破坏依赖

en: This feature is very useful, since it is never possible to anticipate the vagaries of development, and it is necessary to be able to adjust to renaming, and other automatic replacement, of obsolete software.
zh-CN: 这个功能非常有用，因为它是永远不可能预料到变化莫测的发展，它不能够调整重命名，或者其他自动替换过的软件，所以它是必要的。

en: <emphasis>BACK TO BASICS</emphasis> Perl, a programming language
zh-CN: <emphasis>回到基本</emphasis>Perl，一种编程语言

en: <primary>Comprehensive Perl Archive Network</primary>
zh-CN: <primary>Comprehensive Perl Archive Network（Perl 综合架构网络）</primary>

en: Perl (Practical Extraction and Report Language) is a very popular programming language. It has many ready-to-use modules that cover a vast spectrum of applications, and that are distributed by the <acronym>CPAN</acronym> (Comprehensive Perl Archive Network) servers, an exhaustive network of Perl packages. <ulink type="block" url="https://www.perl.org/" /> <ulink type="block" url="https://www.cpan.org/" />
zh-CN: Perl（实用报表提取语言）是非常受欢迎的编程语言。它有许多现成的模块，涵盖了广阔的应用，这些都是由 <acronym>CPAN</acronym>（Comprehensive Perl Archive Network，Perl 综合架构网络）的服务器发布务的，CPAN 服务器是 Perl 软件包的全面网络。<ulink type="block" url="https://www.perl.org/" /> <ulink type="block" url="https://www.cpan.org/" />

en: Since it is an interpreted language, a program written in Perl does not require compilation prior to execution. This is why they are called “Perl scripts”.
zh-CN: 由于它是一种解释型语言，Perl 语言编写的程序并不需要在执行之前进行编译。这就是大家称其为“Perl 脚本”的原因。

en: Past Limitations
zh-CN: 过去的限制

en: Replacing Files: The <literal>Replaces</literal> Field
zh-CN: 替换文件：<literal>替换</literal>字段

en: <primary>replacement</primary>
zh-CN: <primary>替换</primary>

en: <primary>package</primary><secondary>replacement</secondary>
zh-CN: <primary>软件包</primary><secondary>替换</secondary>

en: The use of this field is justified when package names change or when a package is included in another. This also happens when the maintainer decides to distribute files differently among various binary packages produced from the same source package: a replaced file no longer belongs to the old package, but only to the new one.
zh-CN: 当软件包名称变更时，或者当一个软件包包含在另外一个的时候，此字段的使用是合理的。这也发生在维护者决定从来自相同的源码包的大量二进制包里分发出文件：一个替换的文件不再属于旧的软件包，只有新的才属于。

en: If all of the files in an installed package have been replaced, the package is considered to be removed. Finally, this field also encourages <command>dpkg</command> to remove the replaced package where there is a conflict.
zh-CN: 如果已安装软件包的所有文件都被替换了，那么该软件包将认为将被删除掉。最后，这个字段会鼓励<command>dpkg</command>命令去删除替换掉有冲突的包。

en: <emphasis>GOING FURTHER</emphasis> The <literal>Tag</literal> field
zh-CN: <emphasis>更进一步</emphasis><literal>标签</literal>字段

en: Configuration Scripts
zh-CN: 配置脚本

en: <emphasis>GOING FURTHER</emphasis> <command>dpkg</command>'s database
zh-CN: <emphasis>进一步</emphasis> <command>dpkg</command> 的数据库

en: <primary>dpkg</primary><secondary>database</secondary>
zh-CN: <primary>dpkg</primary><secondary>数据库</secondary>

en: All of the configuration scripts for installed packages are stored in the <filename>/var/lib/dpkg/info/</filename> directory, in the form of a file prefixed with the package's name. This directory also includes a file with the <filename>.list</filename> extension for each package, containing the list of files that belong to that package.
zh-CN: 所有已安装的软件包的配置脚本都存在<filename>/var/lib/dpkg/info/</filename>目录，在软件包的名字前会有一个文件名的前缀。此目录的每个软件包还包括一个叫<filename>.list</filename>的文件扩展，包括列表的文件字段属于哪些包。

en: The <filename>/var/lib/dpkg/status</filename> file contains a series of data blocks (in the format of the famous mail headers, RFC 2822) describing the status of each package. The information from the <filename>control</filename> file of the installed packages is also replicated there.
zh-CN: <filename>/var/lib/dpkg/status</filename>文件包含了一些数据块（著名的邮件标题的格式，RFC2822）描述了每个软件包的状态。已经安装的软件包的 <filename>control</filename> 文件中的信息也会被复制到这里。

en: In general, the <filename>preinst</filename> script is executed prior to installation of the package, while <filename>postinst</filename> follows it. Likewise, <filename>prerm</filename> is invoked before removal of a package and <filename>postrm</filename> afterwards. An update of a package is equivalent to removal of the previous version and installation of the new one. It is not possible to describe in detail all the possible scenarios here, but we will discuss the most common two: an installation/update and a removal.
zh-CN: 在一般情况下，<filename>preinst</filename>脚本会在安装软件包前执行，而<filename>postinst</filename>会稍后执行。同样，<filename>prerm</filename>会在移除一个软件包的之前被调用，<filename>postrm</filename> 则随后执行。更新软件包相当于是清除掉以前的旧版本并且安装新的软件包。所以在这里我们不可能来详细描述所有的可能的方案，但我们将讨论最常见的两种：安装/更新和移除。

en: <emphasis>CAUTION</emphasis> Symbolic names of the scripts
zh-CN: <emphasis>小心</emphasis> 脚本的符号名称

en: The sequences described in this section call configuration scripts by specific names, such as <command>old-prerm</command> or <command>new-postinst</command>. They are, respectively, the <command>prerm</command> script contained in the old version of the package (installed before the update) and the <command>postinst</command> script contained in the new version (installed by the update).
zh-CN: 本节中使用特定的名称序列命名配置脚本，例如 <command>old-prerm</command> 或 <command>new-postinst</command>。它们分别是旧版本软件包（ 在更新前已安装）中包含的 <command>prerm</command>脚本和新版本软件包（由本次更新所安装）中包含的 <command>postinst</command> 脚本。

en: <emphasis>TIP</emphasis> State diagrams
zh-CN: <emphasis>提示</emphasis>状态图

en: Manoj Srivastava and Margarita Manterola made the following diagrams explaining how the configuration scripts are called by <command>dpkg</command>. <ulink type="block" url="https://people.debian.org/~srivasta/MaintainerScripts.html" /> <ulink type="block" url="https://www.debian.org/doc/debian-policy/ap-flowcharts.html" />
zh-CN: Manoj Srivastava 和 Margarita Manterola 制作了后面的图示，来解释这些配置脚本如何被 <command>dpkg</command> 调用的情况。<ulink type="block" url="https://people.debian.org/~srivasta/MaintainerScripts.html" /> <ulink type="block" url="https://www.debian.org/doc/debian-policy/ap-flowcharts.html" />

en: Installation and Upgrade
zh-CN: 安装和升级

en: <primary><command>dpkg</command></primary><secondary>internal operation</secondary>
zh-CN: <primary><command>dpkg</command></primary><secondary>内部运作</secondary>

en: <primary>package</primary><secondary>installation</secondary>
zh-CN: <primary>软件包</primary><secondary>安装</secondary>

en: The new package files are then unpacked. If a file already exists, it is replaced, but a backup copy is temporarily made.
zh-CN: 新的软件包文件被解压。如果文件已经存在，就被会替换，同时会产生一个临时的备份副本。

en: <command>dpkg</command> updates all of the internal data (file list, configuration scripts, etc.) and removes the backups of the replaced files. This is the point of no return: <command>dpkg</command> no longer has access to all of the elements necessary to return to the previous state.
zh-CN: <command>dpkg</command>更新所有的内部数据（文件列表，配置脚本等），并删除被替换文件的备份。这是一条不归路： ） <command>dpkg</command>将不能够再访问回退到之前状态所需要的所有元素。

en: <command>dpkg</command> will update the configuration files, asking the user to decide if it is unable to automatically manage this task. The details of this procedure are discussed in <xref linkend="sect.conffiles" />.
zh-CN: <command>dpkg</command> 将更新配置文件，无法自动管理此工作时，要求用户做决定。详情在此 <xref linkend="sect.conffiles" />。

en: Package Removal
zh-CN: 软件包移除

en: <primary>package</primary><secondary>removal</secondary>
zh-CN: <primary>软件包</primary><secondary>卸载</secondary>

en: <emphasis>VOCABULARY</emphasis> Purge, a complete removal
zh-CN: <emphasis>术语</emphasis> Purge，完全移除

en: <primary>purging a package</primary>
zh-CN: <primary>清除软件包</primary>

en: <primary>package</primary><secondary>purge</secondary>
zh-CN: <primary>软件包</primary><secondary>清除</secondary>

en: When a Debian package is removed, the configuration files are retained in order to facilitate possible re-installation. Likewise, the data generated by a daemon (such as the content of an LDAP server directory, or the content of a database for an SQL server) are usually retained.
zh-CN: 当Debian的软件包被移除掉的时候，该软件包的配置文件会被保留下来以便重新安装。同样，守护程序产生的数据（比如LDAP的服务器目录内容，或者是SQL服务器的数据库内容）也常常会被保留。

en: To remove all data associated with a package, it is necessary to “purge” the package with the command, <command>dpkg -P <replaceable>package</replaceable></command>, <command>apt-get remove --purge <replaceable>package</replaceable></command> or <command>aptitude purge <replaceable>package</replaceable></command>.
zh-CN: 移除掉软件包所关联的所有数据，必须使用“purge”命令，<command>dpkg -P<replaceable>软件包</replaceable></command>，<command>apt-get remove --purge <replaceable>软件包</replaceable></command> 或者是<command>aptitude purge <replaceable>软件包</replaceable></command>。

en: Given the definitive nature of such data removals, a purge should not be taken lightly.
zh-CN: 移除该等数据，不能掉以轻心去清除。

en: <primary><filename>config</filename>, <command>debconf</command> script</primary>
zh-CN: <primary><filename>config</filename>、<command>debconf</command> 脚本</primary>

en: The four scripts detailed above are complemented by a <filename>config</filename> script, provided by packages using <command>debconf</command> to acquire information from the user for configuration. During installation, this script defines in detail the questions asked by <command>debconf</command>. The responses are recorded in the <command>debconf</command> database for future reference. The script is generally executed by <command>apt</command> prior to installing packages one by one in order to group all the questions and ask them all to the user at the beginning of the process. The pre- and post-installation scripts can then use this information to operate according to the user's wishes.
zh-CN: <filename>config</filename> 脚本补充前述的 4 个脚本，软件包以 <command>debconf</command> 取得配置用的信息。安装过程中，此脚本以 <command>debconf</command> 指令询问用户详细的问题。把回应记录在 <command>debconf</command> 数据库供未来的参考。在安装之前先由 <command>apt</command> 逐一运行该等脚本，归纳问题与回答。事前与事后安装脚本可使用该等信息回应用户的期望。

en: <emphasis>TOOL</emphasis> <command>debconf</command>
zh-CN: <emphasis>工具</emphasis> <command>debconf</command>

en: <command>debconf</command> was created to resolve a recurring problem in Debian. All Debian packages unable to function without a minimum of configuration used to ask questions with calls to the <command>echo</command> and <command>read</command> commands in <filename>postinst</filename> shell scripts (and other similar scripts). But this also means that during a large installation or update the user must stay with their computer to respond to various questions that may arise at any time. These manual interactions have now been almost entirely dispensed with, thanks to the <command>debconf</command> tool.
zh-CN: <command>debconf</command> 被创建来 Debian中不断出现的问题。如果没有一个最小的配置，用于在 <filename>postinst</filename> shell 脚本（和其它类似脚本）中，调用 <command>echo</command> 和 <command>read</command> 命令来询问问题，那么所有 Debian 软件包都不能工作。这也意味着在大型安装或升级过程里，用户必须在电脑旁回应这些会随时出现的任何问题。由于 <command>debconf</command> 工具，这些手动交互过程几乎全部摒弃了。

en: <command>debconf</command> has many interesting features: it requires the developer to specify user interaction; it allows localization of all the strings displayed to users (all translations are stored in the <filename>templates</filename> file describing the interactions); it has different frontends to display the questions to the user (text mode, graphical mode, non-interactive); and it allows creation of a central database of responses to share the same configuration with several computers... but the most important is that it is now possible to present all of the questions in a row to the user, prior to starting a long installation or update process. The user can go about their business while the system handles the installation on its own, without having to stay there staring at the screen waiting for questions.
zh-CN: <command>debconf</command> 包括很多有趣的功能：要求开发者指明用户的交互；允许本地化显示给用户的字符串 (描述交互的所有翻译保存在 <filename>templates</filename> 文件)；显示给用户的前端问题 (文本模式、图形模式、非交互式)；把回应集中在数据库供其他电脑使用 ... 但最重要的已可把所有问题，在安装或升级之前，以一列的模式显示给用户。用户可以放任系统自行安装，不必待在电脑旁，紧盯屏幕等待问题。

en: <primary><filename>conffiles</filename></primary>
zh-CN: <primary><filename>冲突文件</filename></primary>

en: <primary>checksums</primary>
zh-CN: <primary>校验</primary>

en: In effect, in this situation, <command>dpkg</command> behaves as intelligently as possible: if the standard configuration file has not changed between the two versions, it does nothing. If, however, the file has changed, it will try to update this file. Two cases are possible: either the administrator has not touched this configuration file, in which case <command>dpkg</command> automatically installs the new version; or the file has been modified, in which case <command>dpkg</command> asks the administrator which version they wish to use (the old one with modifications, or the new one provided with the package). To assist in making this decision, <command>dpkg</command> offers to display a “<command>diff</command>” that shows the difference between the two versions. If the user chooses to retain the old version, the new one will be stored in the same location in a file with the <filename>.dpkg-dist</filename> suffix. If the user chooses the new version, the old one is retained in a file with the <filename>.dpkg-old</filename> suffix. Another available action consists of momentarily interrupting <command>dpkg</command> to edit the file and attempt to re-instate the relevant modifications (previously identified with <command>diff</command>).
zh-CN: 实际上，在这种情况下，<command>dpkg</command> 的行为会尽可能地智能：如果两个版本之间并没有改变标准的配置文件，那么它就什么也不会做。但是如果文件已经被修改，它会尝试更新此文件。这会产生两种可能的情况：一是管理员没有碰配置文件，在这种情况下 <command>dpkg</command> 会自动安装新的版本；二是文件已经被修改了，在这种情况下 <command>dpkg</command> 会询问管理员希望使用哪个版本（有过修改的旧版本，或者软件包的新版本）。为了帮助用户作出决定，<command>dpkg</command> 会提供显示 “<command>diff</command>”，这会显示两个版本之间的差异。如果用户选择旧版本，那么新版本将被存储在文件夹的同一个位置并以 <filename>.dpkg-dist</filename> 为后缀名的文件中。如果用户选择新版本，那么旧版本将被保留在以 <filename>.dpkg-old</filename> 为后缀名的文件中。另外一个可能的操作是由暂时中断 <command>dpkg</command> 来编辑该文件，并试图重新恢复相关的修改（之前用 <command>diff</command> 来识别）。

en: <emphasis>GOING FURTHER</emphasis> Force dpkg to ask configuration file questions
zh-CN: <emphasis>更进一步</emphasis> 强制 dpkg 询问配置文件问题

en: The <command>--force-confask</command> option requires <command>dpkg</command> to display the questions about the configuration files, even in cases where they would not normally be necessary. Thus, when reinstalling a package with this option, <command>dpkg</command> will ask the questions again for all of the configuration files modified or deleted by the administrator. This is very convenient, especially for reinstalling the original configuration file if it has been deleted and no other copy is available: a normal re-installation won't work, because <command>dpkg</command> considers removal as a form of legitimate modification, and, thus, doesn't install the desired configuration file.
zh-CN: 即使通常并不必要，<command>--force-confask</command> 选项也要求 <command>dpkg</command> 显示关于配置文件的问题。这样，当以此选项重新安装软件包时，<command>dpkg</command> 将再次针对由管理员修改或删除的所有配置文件询问问题。这种方式极为便利，尤其是在重新安装已经被删除且无可用复本的原始配置文件时：普通重新安装无效，因为 <command>dpkg</command> 认为移除是合法的修改，因此不会安装所需的配置文件。

en: <emphasis>GOING FURTHER</emphasis> Avoiding the configuration file questions
zh-CN: <emphasis>更进一步</emphasis> 避免配置文件问题

en: <command>dpkg</command> handles configuration file updates, but, while doing so, regularly interrupts its work to ask for input from the administrator. This makes it less than enjoyable for those who wish to run updates in a non-interactive manner. This is why this program offers options that allow the system to respond automatically according to the same logic: <command>--force-confold</command> retains the old version of the file; <command>--force-confnew</command> will use the new version of the file (these choices are respected, even if the file has not been changed by the administrator, which only rarely has the desired effect). Adding the <command>--force-confdef</command> option tells <command>dpkg</command> to decide by itself when possible (in other words, when the original configuration file has not been touched), and only uses <command>--force-confnew</command> or <command>--force-confold</command> for other cases.
zh-CN: <command>dpkg</command> 处理配置文件升级，但经常中断作业，要求管理者键入数据。如此一来，就不能以无中断方式一气呵成升级作业。此指令提供选项让系统依同样的逻辑自动回应：<command>--force-confold</command> 保留该文件的旧版本；<command>--force-confnew</command> 使用该文件的新版本 (即使该文件未被管理者修改，仍使用指定的选择，极少发生问题)。加入 <command>--force-confdef</command> 选项告诉 <command>dpkg</command> 在可能情况下自行决定 (换句话说，不改变原配置文件)，只在其他的情况下，才使用 <command>--force-confnew</command> 或 <command>--force-confold</command>。

en: These options apply to <command>dpkg</command> and are explained in detail in <citerefentry><refentrytitle>dpkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> or <command>dpkg --force-help</command>, but most of the time the administrator will work directly with the <command>aptitude</command> or <command>apt</command> programs. It is, thus, necessary to know the syntax used to indicate the options to pass to the <command>dpkg</command> command (their command line interfaces are very similar).
zh-CN: 这些选项应用于 <command>dpkg</command>，并在<citerefentry><refentrytitle>dpkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> 或 <command>dpkg --force-help</command> 中具体解释，但是大多数时间管理员会直接用 <command>aptitude</command> 或 <command>apt</command> 程序来工作。这样，有必要知道用于指示选项的语法，来传递给 <command>dpkg</command>命令（它们的命令行的界面是非常相似的）。

en: Including this option in the configuration file means that it will also be used in a graphical interface such as <command>aptitude</command>.
zh-CN: 把此选项纳入配置文件，意味着 <command>aptitude</command> 之类的图形接口程序也会使用这些选项。

en: Structure of a Source Package
zh-CN: 源码包的结构

en: <primary>package</primary><secondary>source package</secondary>
zh-CN: <primary>软件包</primary><secondary>源码包</secondary>

en: Format
zh-CN: 格式

en: <primary>DSC file</primary>
zh-CN: <primary>DSC 文件</primary>

en: A source package is usually comprised of three files, a <filename>.dsc</filename>, a <filename>.orig.tar.gz</filename>, and a <filename>.debian.tar.xz</filename> (or <filename>.diff.gz</filename>). They allow creation of binary packages (<filename>.deb</filename> files described above) from the source code files of the program, which are written in a programming language.
zh-CN: 一个源码包通常包括三个文件，<filename>.dsc</filename>、<filename>.orig.tar.gz</filename> 与 <filename>.debian.tar.xz</filename>（或 <filename>.diff.gz</filename>）。它们允许从编程语言撰写的程序源代码文件中，创建二进制软件包（如前所述的 <filename>.deb</filename> 文件）。

en: The <filename>.dsc</filename> (Debian Source Control) file is a short text file containing an RFC 2822 header (just like the <filename>control</filename> file studied in <xref linkend="sect.control" />) which describes the source package and indicates which other files are part thereof. It is signed by its maintainer, which guarantees authenticity. See <xref linkend="sect.package-authentication" /> for further details on this subject.
zh-CN: <filename>.dsc</filename> (Debian Source Control) 文件是包括 RFC 2822 标头 (如同 <filename>control</filename> 文件于 <xref linkend="sect.control" />) 的简短文本档，描述原始软件包及包括的其他文件。由维护者签署，保证其真实性。详情见 <xref linkend="sect.package-authentication" />。

en: A <filename>.dsc</filename> file
zh-CN: 一个<filename>.dsc</filename> 文件

en: <primary>package</primary><secondary>build dependencies</secondary>
zh-CN: <primary>软件包</primary><secondary>构建依赖</secondary>

en: Note that the source package also has dependencies (<literal>Build-Depends</literal>) completely distinct from those of binary packages, since they indicate tools required to compile the software in question and construct its binary package.
zh-CN: 需要注意的是源码包也有依赖（<literal>Build-Depends</literal>），和那些二进制包依赖完全不同，因为它们需要设置编译软件所需工具的选项后，再来构建二进制包。

en: <emphasis>CAUTION</emphasis> Distinct namespaces
zh-CN: <emphasis>当心</emphasis> 不同的命名空间

en: It is important to note here that there is no required correspondence between the name of the source package and that of the binary package(s) that it generates. It is easy enough to understand if you know that each source package may generate several binary packages. This is why the <filename>.dsc</filename> file has the <literal>Source</literal> and <literal>Binary</literal> fields to explicitly name the source package and store the list of binary packages that it generates.
zh-CN: 需注意，原始软件包与其产生的可运行软件包间，不需使用对应的名称。每个原始软件包可能产生多个可运行软件包。所以 <filename>.dsc</filename> 文件有 <literal>Source</literal> 与 <literal>Binary</literal> 字段记录原始软件包的名称与其产生的可运行软件包清单。

en: <emphasis>CULTURE</emphasis> Why divide into several packages
zh-CN: <emphasis>文化</emphasis> 为什么要分成几个软件包

en: Quite frequently, a source package (for a given software) can generate several binary packages. The split is justified by the possibility to use (parts of) the software in different contexts. Consider a shared library, it may be installed to make an application work (for example, <emphasis role="pkg">libc6</emphasis>), or it can be installed to develop a new program (<emphasis role="pkg">libc6-dev</emphasis> will then be the correct package). We find the same logic for client/server services where we want to install the server part on one machine and the client part on others (this is the case, for example, of <emphasis role="pkg">openssh-server</emphasis> and <emphasis role="pkg">openssh-client</emphasis>).
zh-CN: 通常，一个源代码软件包 (对于一个指定软件来说) 可产生多个二进制软件包。分开多个二进制包，可以满足在不同的环境使用 (部分) 软件。对于一个共享库，安装它后，可以让一个于应用程序工作 (如，<emphasis role="pkg">libc6</emphasis>)；或者安装后，可以用来开发一个新的程序 (<emphasis role="pkg">libc6-dev</emphasis> 就是这样的软件包)。在客户端-服务端服务里发现同样的逻辑，在一部机器安装服务端的内容同时在另部机器安装客户端的内容 (例如： <emphasis role="pkg">openssh-server</emphasis> 与 <emphasis role="pkg">openssh-client</emphasis>)。

en: <emphasis>PERSPECTIVE</emphasis> Different source package formats
zh-CN: <emphasis>洞察</emphasis>不同格式的源码包

en: <primary>source package</primary><secondary>format</secondary>
zh-CN: <primary>源码包</primary><secondary>格式</secondary>

en: Originally there was only one source package format. This is the <literal>1.0</literal> format, which associates an <filename>.orig.tar.gz</filename> archive to a <filename>.diff.gz</filename> “debianization” patch (there is also a variant, consisting of a single <filename>.tar.gz</filename> archive, which is automatically used if no <filename>.orig.tar.gz</filename> is available).
zh-CN: 本来只有一个原始的软件包格式，像<literal>1.0</literal>这样的格式，它关联了<filename>.orig.tar.gz</filename>和<filename>.diff.gz</filename>“Debian化”的补丁（还有一个变种，由一个单一的<filename>.tar.gz</filename>归档，当<filename>.orig.tar.gz</filename>不可用时它会自动使用。）.

en: Since Debian 6 <emphasis role="distribution">Squeeze</emphasis>, Debian developers have the option to use new formats that correct many problems of the historical format. Format <literal>3.0 (quilt)</literal> can combine multiple upstream archives in the same source package: in addition to the usual <filename>.orig.tar.gz</filename>, supplementary <filename>.orig-<replaceable>component</replaceable>.tar.gz</filename> archives can be included. This is useful with software that is distributed in several upstream components but for which a single source package is desired. These archives can also be compressed with <command>xz</command> rather than <command>gzip</command>, which saves disk space and network resources. Finally, the monolithic patch, <filename>.diff.gz</filename> is replaced by a <filename>.debian.tar.xz</filename> archive containing the compiling instructions and a set of upstream patches contributed by the package maintainer. These last are recorded in a format compatible with <command>quilt</command> — a tool that facilitates the management of a series of patches.
zh-CN: 自从 Debian 6 <emphasis role="distribution">Squeeze</emphasis> 以来，Debian 开发者可以选择新的格式来校正历史上旧格式的问题。格式 <literal>3.0 (quilt)</literal> 可以将多个上游档案组合在相同的源码包中：除了通常的 <filename>.orig.tar.gz</filename>，还可纳入补充的 <filename>.orig-<replaceable>component</replaceable>.tar.gz</filename> 档案。这种做法对那些散布在多个上游组件，但只需要单一一个原码包的软件。这些文件还可以使用 <command>xz</command> 而不是 <command>gzip</command> 来压缩，这节省了磁盘空间与网络资源。最后，单一的补丁 <filename>.diff.gz</filename> 被 <filename>.debian.tar.gz</filename> 档案取代，它包括编译指示与软件包维护者贡献的一组上游补丁。最后的这些部分以兼容的 <command>quilt</command> 的格式记录，其中 quilt 是实现一系列补丁管理的工具。

en: The <filename>.orig.tar.gz</filename> file is an archive containing the source code as provided by the original developer. Debian package maintainers are asked to not modify this archive in order to be able to easily check the origin and integrity of the file (by simple comparison with a checksum) and to respect the wishes of some authors.
zh-CN: <filename>.orig.tar.gz</filename> 文件包括原开发者提供的源代码。要求 Debian 的软件包维护者不要修改它，以便检查原来的文件与集成后的文件 (比较校验码就知道) 并且尊重其他著者的意愿。

en: <emphasis>TOOL</emphasis> Decompressing a source package
zh-CN: <emphasis>工具</emphasis> 解压缩源码包

en: <primary>decompressing, source package</primary>
zh-CN: <primary>解压缩，原始软件包</primary>

en: <primary>uncompressing, source package</primary>
zh-CN: <primary>解压缩，原始软件包</primary>

en: <primary>unpacking</primary><secondary>source package</secondary>
zh-CN: <primary>拆包</primary><secondary>原始软件包</secondary>

en: <primary>source package</primary><secondary>unpacking</secondary>
zh-CN: <primary>源码包</primary><secondary>解压</secondary>

en: If you have a source package, you can use the <command>dpkg-source</command> command (from the <emphasis role="pkg">dpkg-dev</emphasis> package) to decompress it:
zh-CN: 使用原始软件包时，您可使用 <command>dpkg-source</command> 指令 (从 <emphasis role="pkg">dpkg-dev</emphasis> 软件包取得) 解压缩它：

en: You can also use <command>apt</command> to download a source package and unpack it right away. It requires that the appropriate <literal>deb-src</literal> lines be present in the <filename>/etc/apt/sources.list</filename> file, however (for further details, see <xref linkend="sect.apt-sources.list" />). These are used to list the “sources” of source packages (meaning the servers on which a group of source packages are hosted).
zh-CN: 可以使用 <command>apt</command> 来下载原码包，并立即将它拆包。然而，这需要适当的 <literal>deb-src</literal> 出现在 <filename>/etc/apt/sources.list</filename> 文件内（进一步的细节请参见 <xref linkend="sect.apt-sources.list" />）。这些用于列出原码包的 “来源”（就是托管一组源码包的服务器）。

en: Usage within Debian
zh-CN: Debian 中的使用

en: <emphasis>GOING FURTHER</emphasis> Source only maintainer uploads
zh-CN: <emphasis>进阶阅读</emphasis> 维护者只能上传源码

en: Manipulating Packages with <command>dpkg</command>
zh-CN: 通过<command>dpkg</command>来操作软件包

en: <command>dpkg</command> is the base command for handling Debian packages on the system. If you have <filename>.deb</filename> packages, it is <command>dpkg</command> that allows installation or analysis of their contents. But this program only has a partial view of the Debian universe: it knows what is installed on the system, and whatever it is given on the command line, but knows nothing of the other available packages. As such, it will fail if a dependency is not met. Tools such as <command>apt</command> and <command>aptitude</command>, on the contrary, will create a list of dependencies to install everything as automatically as possible.
zh-CN: <command>dpkg</command> 是系统上处理 Debian 软件包的基础指令。如果有 <filename>.deb</filename> 软件包，那么可以用 <command>dpkg</command> 来安装或分析其内容。但此指令只能看到 Debian 世界的部分内容：它知道系统安装了那些软件包，以及命令行给出了什么，但不知道其它还有哪些可用的软件包。这样，如果没有相依性就会失败。如 <command>apt</command> 和 <command>aptitude</command> 这样的工具，相反会可产生相依性清单，来尽量自动地安装软件包。

en: <emphasis>NOTE</emphasis> <command>dpkg</command> or <command>apt</command>?
zh-CN: <emphasis>说明</emphasis> <command>dpkg</command> 或 <command>apt</command>?

en: <command>dpkg</command> should be seen as a system tool (backend), and <command>apt</command> as a tool closer to the user, which overcomes the limitations of the former. These tools work together, each one with its particularities, suited to specific tasks.
zh-CN: <command>dpkg</command> 应视为系统工具 (背景) 之一，而 <command>apt</command> 则是较倾向用户的工具，可克服前者的限制。这些工具各有其限制，共同解决特定的作业。

en: Installing Packages
zh-CN: 安装软件包

en: <primary>installation</primary><secondary>package installation</secondary>
zh-CN: <primary>安装</primary><secondary>软件包安装</secondary>

en: <command>dpkg</command> is, above all, the tool for installing an already available Debian package (because it does not download anything). To do this, we use its <literal>-i</literal> or <literal>--install</literal> option.
zh-CN: 首先，<command>dpkg</command> 是安装 Debian 已经可用软件包的工具 (因为不需下载任何东西)。我们使用它的 <literal>-i</literal> 或 <literal>--install</literal> 选项。

en: Installation of a package with <command>dpkg</command>
zh-CN: 通过<command>dpkg</command>来安装一个软件包

en: We can see the different steps performed by <command>dpkg</command>; we know, thus, at what point any error may have occurred. The installation can also be effected in two stages: first unpacking, then configuration. <command>apt</command> takes advantage of this, limiting the number of calls to <command>dpkg</command> (since each call is costly, due to loading of the database in memory, especially the list of already installed files).
zh-CN: 可以看到由 <command>dpkg</command> 执行的不同步骤；这样，我们知道在哪一点会发生错误。安装也可以分为两个阶段来生效：首先拆包，然后配置。<command>apt</command> 会利用这个优点，来限制调用 <command>dpkg</command> 的次数（因为每次调用都有成本，要把数据加载到内存中，特别是已经安装的文件的列表）。

en: Separate unpacking and configuration
zh-CN: 分开解压和配置

en: <primary>package</primary><secondary>unpacking</secondary>
zh-CN: <primary>软件包</primary><secondary>解压</secondary>

en: Sometimes <command>dpkg</command> will fail to install a package and return an error; if the user orders it to ignore this, it will only issue a warning; it is for this reason that we have the different <literal>--force-*</literal> options. The <command>dpkg --force-help</command> command, or documentation of this command, will give a complete list of these options. The most frequent error, which you are bound to encounter sooner or later, is a file collision. When a package contains a file that is already installed by another package, <command>dpkg</command> will refuse to install it. The following messages will then appear:
zh-CN: 有时 <command>dpkg</command> 在安装软件包的时候会失败并且返回一个错误信息；如果用户命令 dpkg 忽略掉这个错误，那么它仅仅会发出一个警告；就是这个原因使我们有不同的 <literal>--force--*</literal> 选项。<command>dpkg --force-help</command> 命令，或者这个命令的文档，将给出这些选项的完整列表。早晚会遇到的最常见的错误，是文件冲突。当软件包包含一个由其它软件包已经安装的文件时，<command>dpkg</command> 会拒绝安装。然后出现后面的消息：

en: 
    <computeroutput>Unpacking libgdm (from .../libgdm_3.8.3-2_amd64.deb) ...
    dpkg: error processing /var/cache/apt/archives/libgdm_3.8.3-2_amd64.deb (--unpack):
     trying to overwrite '/usr/bin/gdmflexiserver', which is also in package gdm3 3.4.1-9</computeroutput>
zh-CN: 
    <computeroutput>Unpacking libgdm (from .../libgdm_3.8.3-2_amd64.deb) ...
    dpkg: 处理 /var/cache/apt/archives/libgdm_3.8.3-2_amd64.deb (--unpack) 时发生错误:
     试图覆写 '/usr/bin/gdmflexiserver'，也同时在软件包 gdm3 3.4.1-9 内</computeroutput>

en: In this case, if you think that replacing this file is not a significant risk to the stability of your system (which is usually the case), you can use the option <literal>--force-overwrite</literal>, which tells <command>dpkg</command> to ignore this error and overwrite the file.
zh-CN: 在这种情况下，如果你认为文件替换该文件可能不会对系统的稳定性造成重大的风险（通常情况下），你可以使用<literal>--force-overwrite</literal>选项来告诉<command>dpkg</command>去忽略这个错误并且覆盖该文件。

en: <emphasis>CAUTION</emphasis> Effective use of <literal>--force-*</literal>
zh-CN: <emphasis>注意</emphasis> 使用<literal>--force-*</literal>的影响

en: <primary>broken dependency</primary>
zh-CN: <primary>破坏依赖</primary>

en: If you are not careful, the use of an option <literal>--force-*</literal> can lead to a system where the APT family of commands will refuse to function. In effect, some of these options allow installation of a package when a dependency is not met, or when there is a conflict. The result is an inconsistent system from the point of view of dependencies, and the APT commands will refuse to execute any action except those that will bring the system back to a consistent state (this often consists of installing the missing dependency or removing a problematic package). This often results in a message like this one, obtained after installing a new version of <emphasis role="pkg">rdesktop</emphasis> while ignoring its dependency on a newer version of the <emphasis role="pkg">libc6</emphasis>:
zh-CN: 若不小心使用 <literal>--force-*</literal> 的选项，可能造成 APT 命令家族拒绝运作的困境。在相依性不足或冲突的情况下，使用部分选项后，仍可安装该等软件包。结果就是相依性不足的不一致系统，APT 命令将拒绝运行任何工作，直到系统恢复一致 (通常包括安装遗失的相依软件包或移除问题软件包)。通常出现以下的消息，安装新版 <emphasis role="pkg">rdesktop</emphasis> 时忽略其对新版 <emphasis role="pkg">libc6</emphasis> 的相依性：

en: A courageous administrator who is certain of the correctness of their analysis may choose to ignore a dependency or conflict and use the corresponding <literal>--force-*</literal> option. In this case, if they want to be able to continue to use <command>apt</command> or <command>aptitude</command>, they must edit <filename>/var/lib/dpkg/status</filename> to delete/modify the dependency, or conflict, that they chose to override.
zh-CN: 确信其分析结果的勇敢管理者，可能选择忽略使用 <literal>--force-*</literal> 选项时发生的相依性问题与冲突。结果是，想要继续使用 <command>apt</command> 或 <command>aptitude</command> 的话，他们必须先编辑 <filename>/var/lib/dpkg/status</filename> 以删除/修改相依性问题或冲突。

en: This manipulation is an ugly hack, and should never be used, except in the most extreme case of necessity. Quite frequently, a more fitting solution is to recompile the package that is causing the problem (see <xref linkend="sect.rebuilding-package" />) or use a new version (potentially corrected) from a repository such as the <literal>stable-backports</literal> one (see <xref linkend="sect.apt-sources.list.stable.backports" />).
zh-CN: 这是一种丑陋的黑客行为，除了在极为必要的情况，否则不该使用。非常常见的，更合适的解决方案是重新编译产生问题的软件包（请参见 <xref linkend="sect.rebuilding-package" />），或使用来自如 <literal>stable-backports</literal> 那样的仓库中的新版本（可能已修复该问题）的软件包（请参见 <xref linkend="sect.apt-sources.list.stable.backports" />）。

en: Invoking <command>dpkg</command> with the <literal>-r</literal> or <literal>--remove</literal> option, followed by the name of a package, removes that package. This removal is, however, not complete: all of the configuration files, maintainer scripts, log files (system logs) and other user data handled by the package remain. That way disabling the program is easily done by uninstalling it, and it is still possible to quickly reinstall it with the same configuration. To completely remove everything associated with a package, use the <literal>-P</literal> or <literal>--purge</literal> option, followed by the package name.
zh-CN: 使用 <command>dpkg</command> 加上 <literal>-r</literal> 或 <literal>--remove</literal> 选项，再加上软件包名称，就可移除该软件包。然而，这种方式的移除并不完整：仍保留了所有的配置文件、维护脚本、日志文件（系统日志）及由软件包而处理的其他用户数据。停用程序的方式是卸载它，并且仍可以用相同的配置快速地重新安装回来。要完全移除与软件包相关的所有内容，应使用 <literal>-P</literal> 或 <literal>--purge</literal> 选项，再加上软件包的名称。

en: Removal and purge of the <emphasis role="pkg">debian-cd</emphasis> package
zh-CN: 移除与清除 <emphasis role="pkg">debian-cd</emphasis> 软件包

en: Querying <command>dpkg</command>'s Database and Inspecting <filename>.deb</filename> Files
zh-CN: 查询 <command>dpkg</command> 的数据库，并检查 <filename>.deb</filename> 文件

en: <primary>package</primary><secondary>status</secondary>
zh-CN: <primary>软件包</primary><secondary>状态</secondary>

en: <primary>package</primary><secondary>file list</secondary>
zh-CN: <primary>软件包</primary><secondary>文件列表</secondary>

en: <primary>package</primary><secondary>content inspection</secondary>
zh-CN: <primary>软件包</primary><secondary>内容检查</secondary>

en: <emphasis>BACK TO BASICS</emphasis> Option syntax
zh-CN: <emphasis>回到基础</emphasis> 选项的语法

en: Most options are available in a “long” version (one or more relevant words, preceded by a double dash) and a “short” version (a single letter, often the initial of one word from the long version, and preceded by a single dash). This convention is so common that it is a POSIX standard.
zh-CN: “长” 版 (一个或多个字，前置两个链接号) 与 “短” 版 (一个字母，通常是长版字的第一个字母，前置一个链接号) 软件包都有该等选项。这是 POSIX 标准常见的用法。

en: <emphasis>CAUTION</emphasis> <command>dpkg --search</command> and merged <filename>/usr</filename>
zh-CN: <emphasis>警告</emphasis> <command>dpkg --search</command> 和 <filename>/usr</filename> 合并问题

en: <primary>merged <filename>/usr</filename></primary>
zh-CN: <primary>合并<filename>/usr</filename></primary>

en: For <ulink url="https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/">various reasons</ulink>, Debian now installs by default a few top-level directories as symlinks to their counterparts below <filename>/usr</filename>. For instance, <filename>/bin</filename>, <filename>/sbin</filename> and <filename>/lib</filename> are now symlinks to, respectively, <filename>/usr/bin</filename>, <filename>/usr/sbin</filename> and <filename>/usr/lib</filename>.
zh-CN: 由于<ulink url="https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/">各种原因</ulink>，Debian现在默认将一些顶层文件夹作为符号链接安装到<filename>/usr</filename>下面的相应位置。例如，<filename>/bin</filename>、<filename>/sbin</filename>和<filename>/lib</filename>现在是<filename>/usr/bin</filename>、<filename>/usr/sbin</filename>和<filename>/usr/lib</filename>各自的符号链接。

en: While this does provide desirable benefits, it can also be a source of confusion. For example, when you query <command>dpkg</command> which package is owning a given file, it will only be able to answer when you ask for its original path:
zh-CN: 这提供了所需的优点，但也会导致混淆。例如，当查询<command>dpkg</command>时，这个软件包拥有一个给定文件，当你查询其原始路径时，他只能回答：

en: Various queries with <command>dpkg</command>
zh-CN: <command>dpkg</command>的各种查询

en: <emphasis>GOING FURTHER</emphasis> Comparison of versions
zh-CN: <emphasis>更进一步</emphasis> 版本的对比

en: <primary>version, comparison</primary>
zh-CN: <primary>版本，对比</primary>

en: <primary>comparison of versions</primary>
zh-CN: <primary>对比版本</primary>

en: <primary>package</primary><secondary>version, comparison</secondary>
zh-CN: <primary>软件包</primary><secondary>版本，比较</secondary>

en: Since <command>dpkg</command> is the program for handling Debian packages, it also provides the reference implementation of the logic of comparing version numbers. This is why it has a <literal>--compare-versions</literal> option, usable by external programs (especially configuration scripts executed by <command>dpkg</command> itself). This option requires three parameters: a version number, a comparison operator, and a second version number. The different possible operators are <literal>lt</literal> (strictly less than), <literal>le</literal> (less than or equal to), <literal>eq</literal> (equal), <literal>ne</literal> (not equal), <literal>ge</literal> (greater than or equal to), and <literal>gt</literal> (strictly greater than). If the comparison is correct, <command>dpkg</command> returns 0 (success); if not, it gives a non-zero return value (indicating failure).
zh-CN: 因为 <command>dpkg</command> 是处理 Debian 软件包的程序，它也能够逻辑地比较版本编号。所以有 <literal>--compare-versions</literal> 选项，以外部程序使用它 (尤其是被 <command>dpkg</command> 本身运行的配置脚本)。这个选项需要三个参数：版本编号、比较操作数、以及第二个版本编号。可能的操作数为 <literal>lt</literal> (小于)、<literal>le</literal> (大于或等于)、<literal>eq</literal> (等于)、<literal>ne</literal> (不等于)、<literal>ge</literal> (大于或等于)、以及 <literal>gt</literal> (大于)。若比较结果正确，<command>dpkg</command> 送回 0 (成功)；若不正确，则送回 0 以外的数值 (表示失败)。

en: Note the unexpected failure of the last comparison: for <command>dpkg</command>, <literal>pre</literal>, usually denoting a pre-release, has no particular meaning, and this program compares the alphabetic characters in the same way as the numbers (a &lt; b &lt; c ...), in alphabetical order. This is why it considers “<literal>0pre3</literal>” to be greater than “<literal>0</literal>”. When we want a package's version number to indicate that it is a pre-release, we use the tilde character, “<literal>~</literal>”:
zh-CN: 注意前例最后一个比较的失败：<command>dpkg</command>、<literal>pre</literal>，表示为预发布版，没有特别的意义，此程序以比较数字版本 (a &lt; b &lt; c ...) 相同的方式比较字顺版本。所以，“<literal>0pre3</literal>” 大于 “<literal>0</literal>”。我们以毛毛虫 “<literal>~</literal>” 表示该软件包的预发布版：

en: <command>dpkg</command>'s Log File
zh-CN: <command>dpkg</command>的日志文件

en: <command>dpkg</command> keeps a log of all of its actions in <filename>/var/log/dpkg.log</filename>. This log is extremely verbose, since it details every one of the stages through which packages handled by <command>dpkg</command> go. In addition to offering a way to track dpkg's behavior, it helps, above all, to keep a history of the development of the system: one can find the exact moment when each package has been installed or updated, and this information can be extremely useful in understanding a recent change in behavior. Additionally, all versions being recorded, it is easy to cross-check the information with the <filename>changelog.Debian.gz</filename> for packages in question, or even with online bug reports.
zh-CN: <command>dpkg</command> 把所有的交易记录存在名为 <filename>/var/log/dpkg.log</filename> 的日志档。这个日志档的内容颇为详尽且啰唆，记录软件包被 <command>dpkg</command> 处理的每个进程。追踪 dpkg 的每个作为之外，日志档还保留系统发展的记录：可以覆查每个软件包的安装与移除步骤，对于了解最近的变动极有帮助。此外，还记录所有的版本，可以交互检查 <filename>changelog.Debian.gz</filename> 的内容，查看有问题的软件包或在线的错误报告。

en: Multi-Arch Support
zh-CN: 多架构支持

en: <primary>Multi-Arch</primary>
zh-CN: <primary>多架构</primary>

en: <primary>architecture</primary><secondary>multi-arch support</secondary>
zh-CN: <primary>架构</primary><secondary>多架构支持</secondary>

en: All Debian packages have an <literal>Architecture</literal> field in their control information. This field can contain either “<literal>all</literal>” (for packages that are architecture independent) or the name of the architecture that it targets (like “amd64”, “armhf”, …). In the latter case, by default, <command>dpkg</command> will only accept to install the package if its architecture matches the host's architecture as returned by <command>dpkg --print-architecture</command>.
zh-CN: 所有的 Debian 包在它们的管控信息中都有一个<literal>架构</literal> 字段。该字段可包含：“<literal>全部</literal>“（对与架构无关的包），或者它的目标架构名称（如“amd64”， “armhf”，…）。对于后者，默认情况下，<command>dpkg</command>将只能接受安装与主机架构匹配的软件包，主机架构可通过<command>dpkg --print-architecture</command>来获得。

en: This restriction ensures that users do not end up with binaries compiled for an incorrect architecture. Everything would be perfect except that (some) computers can run binaries for multiple architectures, either natively (an “amd64“ system can run “i386” binaries) or through emulators.
zh-CN: 该限制确保用户不会因为错误架构编译的二进制文件而挂掉。一切都很完美，除了（某些）计算机可以运行多架构的二进制文件，或者以本地方式（“amd64“系统可运行”i386“二进制文件）运行，或者以模拟器运行。

en: Enabling Multi-Arch
zh-CN: 启用多架构

en: <command>dpkg</command>'s multi-arch support allows users to define “foreign architectures” that can be installed on the current system. This is simply done with <command>dpkg --add-architecture</command> like in the example below. There is a corresponding <command>dpkg --remove-architecture</command> to drop support of a foreign architecture, but it can only be used when no packages of this architecture remain.
zh-CN: <command>dpkg</command>的多架构支持允许用户定义可安装于当前系统的“异质架构” 。这可以方便的通过 <command>dpkg --add-architecture</command>完成，如下例。有一相应的 <command>dpkg --remove-architecture</command> 以放弃对异质架构的支持，但仅可用于未余留该架构软件包的情况。

en: <emphasis>NOTE</emphasis> APT's multi-arch support
zh-CN: <emphasis>备注</emphasis> APT 的多架构支持

en: APT will automatically detect when dpkg has been configured to support foreign architectures and will start downloading the corresponding <filename>Packages</filename> files during its update process.
zh-CN: 当已经配置 dpkg 来支持异质架构时，APT将会自动检测，并在更新过程中开始下载相应的 <filename>Package</filename>（软件包）文件。

en: Foreign packages can then be installed with <command>apt install <replaceable>package</replaceable>:<replaceable>architecture</replaceable></command>.
zh-CN: 异质软件包可通过 <command>apt install <replaceable>软件包</replaceable>: <replaceable>架构</replaceable></command>安装。

en: <emphasis>IN PRACTICE</emphasis> Using proprietary i386 binaries on amd64
zh-CN: <emphasis>实例</emphasis> 在 amd64 架构上使用专有 i386 二进制文件

en: There are multiple use cases for multi-arch, but the most popular ones are the possibility to execute (sometimes proprietary) 32 bit binaries (i386) on 64 bit systems (amd64), and the possibility to cross-compile software for a platform or an architecture different from the host one.
zh-CN: 对于多架构有多个用例，但最常见的是在 64 位系统上（amd64）上执行（有时是专有的） 32 位二进制文件（i386）的可能性，以及对与托管的主机不同的平台或架构来交叉编译软件的可能性。

en: Multi-Arch Related Changes
zh-CN: 多架构相关的变更

en: To make multi-arch actually useful and usable, libraries had to be repackaged and moved to an architecture-specific directory so that multiple copies (targeting different architectures) can be installed alongside. Such updated packages contain the “<literal>Multi-Arch: same</literal>” header field to tell the packaging system that the various architectures of the package can be safely co-installed (and that those packages can only satisfy dependencies of packages of the same architecture). The most important libraries have been converted since the introduction of multi-arch in Debian 7 <emphasis role="distribution">Wheezy</emphasis>, but there are many libraries that will likely never be converted unless someone specifically requests it (through a bug report for example).
zh-CN: 要让多架构真正实用和可用，库文件必须要重新打包，并移动到于特定架构的目录中，以便可以并存安装多个副本（针对不同架构）。这样的更新软件包中包含“<literal>Multi-Arch: same</literal>”标头字段，以告诉打包系统此软件包的不同架构可以安全地并存安装（而且这些软件包仅能满足相同架构的软件包的依赖）。自从 Debian 7 <emphasis role="distribution">Wheezy</emphasis> 引入多重架构后，最重要的库已经转换了。但也有很多库恐怕永远不会被转换，除非有人特别请求（例如通过缺陷报告）。

en: It is worth noting that <literal>Multi-Arch: same</literal> packages must have their names qualified with their architecture to be unambiguously identifiable. They also have the possibility to share files with other instances of the same package; <command>dpkg</command> ensures that all packages have bit-for-bit identical files when they are shared. Last but not least, all instances of a package must have the same version. They must thus be upgraded together.
zh-CN: 值得注意的是，<literal>Multi-Arch: same</literal>软件包需具备能够明晰识别架构的名称。它们也能够与相同包的其他实例共享文件；<command>dpkg</command>确保所有的包在共享时具有逐位对应识别的文件。最后但并非最不重要的，一个包的所有实例必须为相同版本。它们必须同时升级。

en: Multi-Arch support also brings some interesting challenges in the way dependencies are handled. Satisfying a dependency requires either a package marked “<literal>Multi-Arch: foreign</literal>” or a package whose architecture matches the one of the package declaring the dependency (in this dependency resolution process, architecture-independent packages are assumed to be of the same architecture than the host). A dependency can also be weakened to allow any architecture to fulfill it, with the <literal><replaceable>package</replaceable>:any</literal> syntax, but foreign packages can only satisfy such a dependency if they are marked “<literal>Multi-Arch: allowed</literal>”.
zh-CN: 多架构支持也带来了在依赖处理方式上的一些有趣的挑战。要满足依赖，需要：或者有<literal>Multi-Arch: foreign</literal>标识的软件包，或者架构上能匹配已声明依赖的软件包（在该依赖方案处理中，架构无关包假定为同样架构，而非主机架构）。通过<literal><replaceable> 软件包</replaceable> :any</literal>语法，依赖可以被弱化，以便允许任意架构能够满足依赖，但异质软件包仅能满足如下依赖：有“<literal> Multi-Arch: allowed</literal> ”标识的依赖。

en: Coexistence with Other Packaging Systems
zh-CN: 与其它软件包共存

en: Debian packages are not the only software packages used in the free software world. The main competitor is the RPM format of the Red Hat Linux distribution and its many derivatives. Red Hat is a very popular, commercial distribution. It is thus common for software provided by third parties to be offered as RPM packages rather than Debian.
zh-CN: Debian 包格式并非唯一用于自由软件领域的软件包格式。主要竞争者是红帽 Linux 发行版的 RPM 格式以及其衍生格式。红帽是一个非常流行的商业化发行版。对于来自第三方的软件，常以 RPM 格式软件包提供，而非 Debian 格式。

en: In this case, you should know that the program <command>rpm</command>, which handles RPM packages, is available as a Debian package, so it is possible to use this package format on Debian. Care should be taken, however, to limit these manipulations to extract the information from a package or to verify its integrity. It is, in truth, unreasonable to use <command>rpm</command> to install an RPM on a Debian system; RPM uses its own database, separate from those of native software (such as <command>dpkg</command>). This is why it is not possible to ensure a stable coexistence of two packaging systems.
zh-CN: 这个情况下，你应该知道<command>rpm</command>程序是如何处理RPM软件包的，这种格式在Debian软件包中也可用。需要谨慎的使用，尽管如何，这些操作会限制从一个软件包中解压并且提取出信息以验证其完整性。实际上，不应该在Debian系统中使用<command>rpm</command>来安装一个RPM软件包；RPM使用了它自己的数据库以便和Debian的软件中分离（比如<command>dpkg</command>）。这也就是为什么不可能确保两个包管理系统共存在一个系统中，而这个系统还能保持稳定。

en: On the other hand, the <emphasis role="pkg">alien</emphasis> utility can convert RPM packages into Debian packages, and vice versa.
zh-CN: 另一方面，<emphasis role="pkg">alien</emphasis> 可以把RPM软件包转换成Debian软件包，反之亦然。

en: <emphasis>COMMUNITY</emphasis> Encouraging the adoption of <filename>.deb</filename>
zh-CN: <emphasis>社区</emphasis> 鼓励<filename>.deb</filename>的使用

en: You will find that this process is extremely simple. You must know, however, that the package generated does not have any dependency information, since the dependencies in the two packaging formats don't have systematic correspondence. The administrator must thus manually ensure that the converted package will function correctly, and this is why Debian packages thus generated should be avoided as much as possible. Fortunately, Debian has the largest collection of software packages of all distributions, and it is likely that whatever you seek is already in there.
zh-CN: 此例极为简单。然而，您必须知道不需任何相依性信息就能产生软件包，两种软件包格式并不必然有系统性的关系。管理者必须以手动方式确保转换过的软件包能够正确运作，这就是 Debian 产生的软件包能够避免此种可能。幸运的是，Debian 拥有软件软件包各种版本的数据库，想要的都能找到。

en: Looking at the man page for the <command>alien</command> command, you will also note that this program handles other packaging formats, especially the one used by the Slackware distribution (it is made of a simple <filename>tar.gz</filename> archive).
zh-CN: 翻看<command>alien</command>命令的帮助页面，您会注意到该程序也可处理其他的包格式，特别是使用 Slackware 发行版所用的格式（它使用简单的<filename>tar.gz</filename>归档格式）。

en: The stability of the software deployed using the <command>dpkg</command> tool contributes to Debian's fame. The APT suite of tools, described in the following chapter, preserves this advantage, while relieving the administrator from managing the status of packages, a necessary but difficult task.
zh-CN: <command>dpkg</command>作为一个稳定的工具有助于提高Debian的名字。APT软件包工具，在下面的章节中会告诉我们，它不但保留了这一优势，同时减轻了管理员管理软件包这一必须但是艰难得任务的负担。
