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

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:Parts/Portage/Branches and the translation is 24% complete.
Outdated translations are marked like this.


警告
Readers should not try to follow instructions directly from the Handbook:Parts namespace (which is THIS page!). The sections displayed below are used as a skeleton for transcluding information into the computer architecture specific handbooks and are therefore lacking critical information.

Please visit the Handbook list to read instructions for a relevant computer architecture.
Parts Handbook
Installation
About the installation
Choosing the media
Configuring the network
Preparing the disks
The stage file
Installing base system
Configuring the kernel
Configuring the system
Installing tools
Configuring the bootloader
Finalizing
Working with Gentoo
Portage introduction
USE flags
Portage features
Initscript system
Environment variables
Working with Portage
Files and directories
Variables
Mixing software branches
Additional tools
Custom package repository
Advanced features
OpenRC network configuration
Getting started
Advanced configuration
Modular networking
Wireless
Adding functionality
Dynamic management


使用一个分支

稳定版

变量 ACCEPT_KEYWORDS 定义了系统的软件分支。该变量在 /etc/portage/make.conf 文件中设置,默认配置为 stable 分支。在这种情况下,默认值是 amd64

文件 /etc/portage/make.confUsing the stable branch
# The following value is set by default, and does _not_ need explicitly defined.
ACCEPT_KEYWORDS="amd64"

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

测试

警告
Hic sunt dracones! Running software from the testing branch may incur stability issues, imperfect package handling (for instance wrong/missing dependencies), frequent ebuild revisions (resulting in a lot of compiling) or packages that are broken in another, often unexpected, manner. System administrators who are less comfortable with Gentoo or Linux in general should avoid the testing branch. As noted previously, the Handbook recommends staying with the stable, more thoroughly tested branch.

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

文件 /etc/portage/make.conf使用测试分支
ACCEPT_KEYWORDS="~amd64"

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

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

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

混合使用稳定和测试分支

package.accept_keywords

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

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

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

测试特定版本

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

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

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

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

使用被屏蔽的包

package.unmask

重要
Gentoo 的开发者们不支持您使用这个文件。如果您要使用它请千万小心。开发者们可能不会回应有关于package.unmaskpackage.mask 的支持请求。

当一个包被Gentoo的开发者们屏蔽,但你不考虑 package.mask 文件(默认保存于 /var/db/repos/gentoo/profiles/ 目录下)里所陈述的原因,仍然想使用它的话,请在package.mask文件(如果是一个文件夹,就在此文件夹下的文件中)中加入与/etc/portage/package.unmask 里那行一模一样的内容。

To do so, the system administrator would add the target package version (usually this will be the exact same line from the package.mask file in the profile) to the /etc/portage/package.unmask location.

比如说,软件包 =net-mail/hotwayd-0.8 被屏蔽了,但是您想解除这个屏蔽,需要做的只是在 package.unmask中加入相同的一行内容就可以了。

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

package.mask

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

例如,当您不希望Portage安装比 gentoo-sources-6.6.21 更新版本的内核时,您只需要在package.mask 文件里加入下面一行内容:

文件 /etc/portage/package.maskMask gentoo-sources 高于 6.6.21 的版本
>sys-kernel/gentoo-sources-6.6.21