Saturday, April 25, 2009

emerge学习

使用gentoo有一段时间了, 其实还不是很不解它的包机制. 最近常使用, 就随便记录一点点笔记.( 记性一天比一天差了 )

emerge是gentoo的用户级接口. 如下:

emerge [options] [action] [ebuild | tbz2file | file | set | atom] ...

optins和action就常见了, 是命令行的就会有一两个的. 重点在于后面的ebuild, tbz2file等等几个概念.

[ ... | ... | ...]这种结构表示多选一, 就是只为能其中的一种.

命令行最后的"..."表示还可以重复使用前的选项,这里指的是[...]结构

emerge对ebuild的定义为:
1. ebuild, 有几种情况: 包名, 分类/包名, 或者是直接是*.build的完整路径, 这种是最常使用的

2. tbz2file, 这种还不清楚, 不知道是不安装二进制的包.

3. set, 中文也叫集合. 还是比较好理解, 见: A set is a convenient shorthand for a large group of packages. Two sets are currently available: system and world. 这样的集合是早有的. 知道目前只有system和world这两个set就算了解了

4. atom, 什么叫atom? 在portage的man手册中这样描述:
DEPEND atom
A string which matches a package. It is of the form category/package. It may also
contain optional logical operators and versions.
More reading: ebuild(5)

atom重点是有逻辑操作与版本的, 更的信息应该参看ebuild中的DEPEND atom一节.

本人觉得atom这个概念很复杂.


不同的包使用不同的USE, 有如下文件:
/etc/make.profile/
package.use
package.use.force
package.use.mask
文件内的内容:
# force docs for GTK 2.x
=x11-libs/gtk+-2* doc
# unforce mysql support for QT
x11-libs/qt -mysql


还有一个概念: slot , 什么叫slot?
With Portage different versions of a single package can coexist on a system. While other distributions tend to name their package to those versions (like freetype and freetype2) Portage uses a technology called SLOTs. An ebuild declares a certain SLOT for its version. Ebuilds with different SLOTs can coexist on the same system. For instance, the freetype package has ebuilds with SLOT="1" and SLOT="2".

可见, slot是very powerful的东西

如下:
Atom Slots
Beginning with EAPI 1, any atom can be constrained to match a specific SLOT.
This is accomplished by appending a colon followed by a SLOT:
x11-libs/qt:3
~x11-libs/qt-3.3.8:3
>=x11-libs/qt-3.3.8:3
=x11-libs/qt-3.3*:3

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.