Layman

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Layman and the translation is 53% complete.
Outdated translations are marked like this.
Other languages:
警告
Eselect/Repository 取代了 layman, 而且是目前处理 ebuild 仓库的首选方式。
Some of the information in this article may have drifted out of sync with current practices. Please help out by checking over the content (how to get started).
Resources

Layman is a ebuild repository management tool. It offers a single command-line interface to repository management for end users.

Even though most of layman's functionality is now integrated into Portage and eselect-repository, layman does support some version control systems which Portage does not natively sync (e.g. darcs and g-sorcery).

特征

While the eselect repository eselect module supersedes layman for listing, configuring, and handling synchronization of ebuild repositories, app-portage/layman users can manage their ebuild repositories (overlays) in a simple, centralized manner. The layman provides an overview of available remote repositories and allows the user to select one or more for the system. Once selected, the user can update (similar to emerge --sync), add, remove, display and information about the overlays.

Versions greater than 2.1.0 are improved with a plug-in sync system.

附注
Although not all features of plug-in sync system of Portage are supported yet from layman the migration of Portage is a good step to be prepared for that.

安装

USE 标记

Cannot load package information. Is the atom app-portage/layman correct?

The sync-plugin-portage and git USE flags are especially important in newer versions of layman.

文件 /etc/portage/package.use/laymanAdd important USE flags
app-portage/layman sync-plugin-portage git

Please refer to portage projects page.

Emerge

下一步安装 layman 软件包:

root #emerge --ask app-portage/layman

配置

Layman 将在 /etc/portage/repos.conf/ 下创建配置文件。

Configure layman to use the repos.conf method in /etc/layman/layman.cfg. New installations of layman will probably have this already set correctly:

文件 /etc/layman/layman.cfg
# Repository config types used by layman
# (repos.conf, make.conf)
conf_type : repos.conf

如果不存在则创建 /etc/portage/repos.conf/ 目录:

If you have layman version 2.3.0 or greater installed, you can force a rebuild of layman's repos.conf files:

root #layman-updater -R

使用

基本调用

The layman man page (see External resources) provides a full overview of the available functions. However, for most users, the following commands suffice for repository management activities.

To fetch and display a list of all the repositories available through official references:

root #layman -L

要在本地列表生成的列表中添加一个存储库:

root #layman -a <name>

要添加一个非官方的存储库:

root #layman -o <url of repository xml file> -f -a <name>

要从本地列表中移除存储库:

root #layman -d <name>

要更新一个特定的存储库:

root #layman -s <name>

要更新所有存储库:

root #layman -S

使用 layman-mounter 的可挂载存储库

Since the release of layman version 2.2.0, support for squashfs repository types has been included. layman will interact with squashfs repository by mounting them as read-only on the filesystem. On the initial install of the squashfs repository, it will be mounted as read-only. However, after a reboot the repository will no longer be mounted and the ebuilds in that repository will not be accessible by the system.

In order to assist users in handling these mountable repositories, a utility was added that goes by the name of layman-mounter.

To find all repositories that are currently mounted, type:

root #layman-mounter -l

要找到所有由 layman 安装的、可以挂载的存储库,输入:

root #layman-mounter -L

要挂载可挂载的存储库,输入:

root #layman-mounter -m <name>

要卸载存储库,输入:

root #layman-mounter -u <name>

使用 Layman 设置存储库优先级

The information in this section has been deprecated. It may or may not be relevant for contemporary usage. Handle with care!

As each ebuild repository is assigned a unique priority, layman provides a simple way of defining priorities for repositories it manages. For more information about repository priorities see the ebuild repository priorities.

The file /var/lib/layman/installed.xml contains some information about the repositories, among which is the priority attribute in the repo tag. The number there determines only the priority relative to the other repository entries, 50 is the default value. Larger numbers take priority over smaller numbers. Layman then analyses this file and sets the order of the repository entries in the PORTDIR_OVERLAY variable defined in /var/lib/layman/make.conf.

As the file /var/lib/layman/make.conf is automatically generated by layman based on the settings in /var/lib/layman/installed.xml, it is strongly recommended that only /var/lib/layman/installed.xml is used to set the priorities.

To add a personal repository, and to ensure that the repository has a higher priority, add the repository before /var/lib/layman/make.conf is sourced.

文件 /var/lib/layman/make.confExample layman overlays setting
PORTDIR_OVERLAY="
/home/jdoe/gamerlay
/var/lib/layman/lisp
/var/lib/layman/Spring
${PORTDIR_OVERLAY}" #the variable defined in /etc/portage/make.conf is now expanded
                    #when /var/lib/layman/make.conf is sourced in /etc/portage/make.conf

However, this can be also "fooled" by defining the PORTDIR_OVERLAY in /etc/portage/make.conf after /var/lib/layman/make.conf has been sourced.

文件 /etc/portage/make.confCustom repository setting
source /var/lib/layman/make.conf #this sources the PORTDIR_OVERLAY variable defined by layman.
                                 #however, the variable expanded by layman was empty
PORTDIR_OVERLAY="/home/user/overlay ${PORTDIR} ${PORTDIR_OVERLAY}" #now the layman defined repositories take precedence,
                                                                   #but the user defined repository still has the lowest priority

This "trick" is merely an opportunity offered by shell variable expansion.

添加自定义存储库

To add repositories which are not listed when layman -L is ran, find their repository XML files and add them using the -o option under a name specified by the -a option.

Example: repositories.xml in brother-overlay

缺少 repository.xml 文件

在某些情况下,自定义存储库不提供存储库 XML 文件。

手动创建存储库 XML 文件

该 XML 文件可以在 /etc/layman/overlays 文件夹中手动创建。

For example, if Larry the cow were to create his repository:

文件 /etc/layman/overlays/larry.xmlLarry the cow's nginx overlay
<?xml version="1.0" ?>
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
<repositories version="1.0">
	<repo priority="50" quality="experimental" status="unofficial">
		<name>larry</name>
		<description>nginx server for the barn computer from Larry the cow.</description>
		<homepage>https://github.com/gentoo/nginx-overlay</homepage>
		<owner>
			<email>larry@gentoo.org</email>
		</owner>
		<source type="git">https://github.com/gentoo/nginx-overlay.git</source>
	</repo>
</repositories>
Using layman-overlay-maker utility

With the addition of layman version 2.2.0 a new utility was added to assist users in this process that goes by the name of layman-overlay-maker. As long as the overlay information has been properly added via the prompts, layman-overlay-maker will create a XML defined overlay and save into /etc/layman/overlays or the specified in the layman configuration file for overlay_defs.

layman-overlay-maker can become a useful tool in assisting users who would like to submit a patch to have their overlays added to the official repositories.xml file.

To use the utility simply invoke it by name:

root #layman-overlay-maker

and go through its prompts until completion.

启用存储库

When finished rebuild the repos.conf using layman-updater:

root #layman-updater -R

Now you can add the custom repository by:

root #layman -a <name>

where name is the name of the repository that was created.

另请参阅

外部资源