This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

手册:X86/使用Portage/混合使用不同的软件分支

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:X86/Portage/Branches and the translation is 100% complete.
X86 Handbook
安装
关于安装
选择安装媒介
配置网络
准备磁盘
安装stage3
安装基本系统
配置Linux内核
配置系统
安装系统工具
配置系统引导程序Bootloader
收尾安装工作
使用Gentoo
Portage介绍
USE标记
Portage功能特性
初始化脚本(Initscript)系统
环境变量
使用Portage
文件和目录
变量
混合使用不同的软件分支
额外的工具
定制Portage树
高级特性
网络配置
入门
高级配置
模块化网络
无线
添加功能
动态管理


使用一个分支

稳定版

Gentoo提供了一个 ACCEPT_KEYWORDS变量来定义您系统所使用的软件分支。默认情况下,系统会选择您的体系结构的稳定软件分支x86。

我们推荐您只使用默认的稳定软件分支。不过,如果您不是那么注重稳定性,并且愿意向http://bugs.gentoo.org提交一些bug报告来帮助和完善Gentoo,请继续阅读下面的内容。

测试

如果您想用最新版本的软件,您可以考虑转向使用测试分支。要让Portage转而使用测试分支的软件,您只需在您的体系结构名称前加上一个 ~符号。

顾名思义,“测试分支”就是带有测试性质的。如果一个包正处于测试中,这代表软件的开发人员认为它虽然已经具有了相当的功能但还没有经过完全的测试。使用这样的软件,您当然可能会第一个发现它的bug,并可以提交一个bug报告来通知相关的开发者。

要小心的是,您可能会遇到不稳定性、不完美的软件包处理(例如错误或者缺失的依赖关系)、过于频繁的更新(导致大量的编译)和损坏的包等问题。如果您还不是很清楚Gentoo的工作方式以及如何去解决这些问题,我们推荐您还是使用稳定且测试过分支。

例如,要选择针对 x86 体系结构的测试分支,请修改 /etc/portage/make.conf 文件并设定如下内容:

FILE /etc/portage/make.conf使用测试分支
ACCEPT_KEYWORDS="~x86"

之后如果您更新系统,您将会发现有大量的包需要更新。要提醒您注意的是:您使用测试分支更新系统后,再想转回使用官方的稳定分支将不是一件容易的事情。

混合使用稳定和测试分支

package.accept_keywords

您可以让Portage使用某些软件的测试分支中的版本,对于系统的其他软件则使用稳定分支。要实现这样的目的,您需要在/etc/portage/package.accept_keywords文件里加入那些软件包的名字及其所属分类的名称。您也可以建立一个同名文件夹,并在里面建立的文件里加入上述内容。

例如,要使用gnumeric属于测试分支中的版本:

FILE /etc/portage/package.accept_keywords混合使用稳定和测试分支gnumeric application例子
app-office/gnumeric

测试特定版本

如果您希望Portage使用测试分支中某软件的特定版本,但后续版本不再这么做,你可以在package.accept_keywords 里加入相应的版本号来实现这个目的。在此情况下您必须使用 = 运算符。您也可以通过使用<=,<,>或>=运算符来指定一个要使用的版本范围。

任何情况下,如果您添加了版本号,您必须使用一个运算符;如果您忽略了版本号,您就不能使用运算符。

在如下的例子中,我们要求Portage接受版本号为1.2.13的gnumeric:

FILE /etc/portage/package.accept_keywords允许gnumeric的测试版本
=app-office/gnumeric-1.2.13

使用被屏蔽的包

package.unmask

Important
The Gentoo developers do not support the use of unmasking packages. Please exercise due caution when doing so. Support requests related to package.unmask and/or package.mask might not be answered.

When a package has been masked by the Gentoo developers, yet despite the reason mentioned in the package.mask file (situated in /usr/portage/profiles/ by default) a user still wants to use this package, then add the desired version (usually this will be the exact same line from the package.mask file in the profile) to the /etc/portage/package.unmask file (or in a file in that directory if it is a directory).

For instance, if =net-mail/hotwayd-0.8 is masked, then it can be unmasked by adding the exact same line in the package.unmask location:

FILE /etc/portage/package.unmask使用特定版本
=net-mail/hotwayd-0.8
附注
如果 /usr/portage/profiles/package.mask 中的条目包含一系列软件包版本,则只需要取消屏蔽实际需要的版本即可。 请阅读上一节以了解如何指定版本。

package.mask

当您希望Portage忽略一个特定的软件包或者一个软件包的特定版本,您可以在/etc/portage/package.mask文件(或者此目录下的一个文件)中加入一行适当的内容来屏蔽它。

For instance, to prevent Portage from installing kernel sources newer than gentoo-sources-4.9.16, add the following line at the package.mask location:

FILE /etc/portage/package.maskMask gentoo-sources 高于 2.6.8.1 的版本
>sys-kernel/gentoo-sources-2.6.8.1