翻译:Manpage of EBUILD

Last updated on 2020年9月26日 at 上午9:04

本文是对页面 Manpage of EBUILD 的翻译,最后更新日期:9.24。


EBUILD

章节:Portage (1)
上次更新:Mar 2013
目录  

名称

ebuild – Portage 系统的底层接口  

概要

ebuild 文件 命令 [命令] 

描述

Ebuild 程序是 Portage 系统的直接接口。它允许对具有特定子命令 或命令组的 ebuild 采取直接操作,以执行特定 ebuild 的内容(上下文)和函数。 Ebuild 程序接受一个 ebuild 脚本和一个或多个命令作为参数,然后解析 ebuild 脚本并执行指定的命令。 存在命令用于获取、解压缩、编译源代码,将目标文件安装到临时目录“image”,将映像合并到本地文件系统,从映像创建 bzip 压缩包等。  

文件

必须是有效的 ebuild 脚本。有关更多信息,请阅读 ebuild(5)。  

命令

默认情况下,portage 将按实际指定的顺序执行所有函数,但先前 ebuild 调用中已执行的除外。例如,仅仅发出命令 compile 会引发此前的函数同样运行(例如 setupunpack),除非它们已在先前的 ebuild 调用中运行。 如果要确保它们都将运行,则需要首先使用命令 clean。若只希望运行指定的命令,则应在 FEATURES 环境变量中开启 noauto 选项。有关更多信息,请参见 make.conf(5) 手册页 。

help
显示此手册页的精简形式及许多特定于软件包的信息。
setup
运行所有特定于程序包的设置操作和外部系统检查。
clean
Cleans the temporary build directory that Portage has created for this particular ebuild file. The temporary build directory normally contains the extracted source files as well as a possible “install image” (all the files that will be merged to the local filesystem or stored in a package). The location of the build directory is set by the PORTAGE_TMPDIR variable. For information on what this variable is, run emerge –info, or to override this variable, see make.conf(5).

Note: Portage cleans up almost everything after a package has been successfully merged unless FEATURES contains ‘noclean’. Adding noclean to FEATURES will cause a lot of files to remain and will consume large amounts of space, very quickly. It is not recommended to leave this on, unless you have use for the sources post-merge. Optionally, one may manually clean these files with rm -rf /var/tmp/portage.

fetch
Checks to see if all the sources specified in SRC_URI are available in DISTDIR (see make.conf(5) for more information) and have a valid checksum. If the sources aren’t available, an attempt is made to download them from the locations specified in SRC_URI. If multiple download locations are listed for a particular file, Portage pings each location to see which location is closer. (May not be true presently.) The Gentoo Linux mirrors defined by GENTOO_MIRRORS is always considered first. If for some reason the current or just-downloaded sources’ checksums don’t match those recorded in files/digest-[package]-[version-rev], a warning is printed and ebuild exits with an error code of 1.
digest
This is now equivalent to the manifest command.
manifest
Updates the manifest file for the package. This creates checksums for all of the files found in the same directory as the current ebuild as well as the recursive contents of the files subdirectory. It also creates checksums for all of the files listed in SRC_URI for each ebuild. For further information regarding the behavior of this command, see the documentation for the assume-digests value of the FEATURES variable in make.conf(5). See the –force option if you would like to prevent digests from being assumed.
unpack
Extracts the sources to a subdirectory in the build directory (BUILD_PREFIX) by running the src_unpack() function in the ebuild file. If no src_unpack() function has been specified, a default src_unpack() function is used that extracts all the files specified in SRC_URI. The sources are normally extracted to ${BUILD_PREFIX}/[package]-[version-rev]/work. This particular directory can be referenced by using the ${WORKDIR} variable.

If you’re creating an ebuild, you’ll want to make sure that the S (source directory) variable defined at the top of your ebuild script points to the directory that contains your extracted sources. This directory is defined by default to be ${WORKDIR}/${P}, so it is not often required. The src_unpack() function is also responsible for making the appropriate patches to the sources so that they’re ready for compilation.

prepare
Prepares the extracted sources by running the src_prepare() function specified in the ebuild file. When src_prepare() starts, the current working directory will be set to ${S}. This function is supported beginning with EAPI 2.
configure
Configures the extracted sources by running the src_configure() function specified in the ebuild file. When src_configure() starts, the current working directory will be set to ${S}. This function is supported beginning with EAPI 2.
compile
Compiles the extracted sources by running the src_compile() function specified in the ebuild file. When src_compile() starts, the current working directory will be set to ${S}. When src_compile() completes, the sources should be fully compiled.
test
Runs package-specific test cases to verify that everything was built properly.
preinst
Runs package-specific actions that need to be done before the package is installed into the live filesystem.
install
Installs the package to the temporary install directory by running the src_install() function. When completed, the install directory (${BUILD_PREFIX}/[package]-[version-rev]/image) will contain all the files that should either be merged to the local filesystem or included in a binary package.
instprep
Performs the additional post-install/pre-merge preparations inside the temporary install directory. This is intended to be called after building binary package but before executing preinst.
postinst
Runs package-specific actions that need to be done after the package is installed into the live filesystem. Usually helpful messages are shown here.
qmerge
This function installs all the files in the install directory to the live filesystem. The process works as follows: first, the pkg_preinst() function (if specified) is run. Then, the files are merged into the live filesystem, and the installed files’ checksums are recorded in /var/db/pkg/${CATEGORY}/${PN}-${PVR}/CONTENTS. After all the files have been merged, the pkg_postinst() function (if specified) is executed.
merge
Normally, to merge an ebuild, you need to fetch, unpack, compile, install and qmerge. If you’re simply interested in merging the ebuild, you can use this command, which will perform all these steps for you, stopping along the way if a particular step doesn’t complete successfully.
unmerge
This function first executes the pkg_prerm() function (if specified). Then it removes all files from the live filesystem that have a valid checksum and mtime in the package contents file. Any empty directories are recursively removed. Finally, it runs pkg_postrm() function (if specified). It is safe to merge a new version of a package first and then unmerge the old one. In fact, this is the recommended package upgrade method.
prerm
Runs package-specific actions that need to be executed before the package is removed from the filesystem. See also unmerge.
postrm
Runs package-specific actions that need to be executed after the package is removed from the filesystem. See also unmerge.
config
Runs package-specific actions that need to be executed after the emerge process has completed. This usually entails setup of configuration files or other similar setups that the user may wish to run.
package
This command is a lot like the merge command, except that after fetching, unpacking, compiling and installing, a .tbz2 binary package tarball is created and stored in PKGDIR (see make.conf(5)).
rpm
Builds a RedHat RPM package from the files in the temporary install directory. At the moment, the ebuild’s dependency information is not incorporated into the RPM.
 

OPTIONS

–debug
Run bash with the -x option, causing it to output verbose debugging information to stdout.
–color < y | n >
Enable or disable color output. This option will override NOCOLOR (see make.conf(5)) and may also be used to force color output when stdout is not a tty (by default, color is disabled unless stdout is a tty).
–force
When used together with the digest or manifest command, this option forces regeneration of digests for all distfiles associated with the current ebuild. Any distfiles that do not already exist in ${DISTDIR} will be automatically fetched.
–ignore-default-opts
Do not use the EBUILD_DEFAULT_OPTS environment variable.
–skip-manifest
Skip all manifest checks.
 

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/  

AUTHORS

Achim Gottinger <achim@gentoo.org>
Daniel Robbins <drobbins@gentoo.org>
Nicholas Jones <carpaski@gentoo.org>
Mike Frysinger <vapier@gentoo.org>
 

FILES

/etc/portage/make.conf
Contains variables for the build-process and overwrites those in make.globals.
/etc/portage/color.map
Contains variables customizing colors.
 

SEE ALSO

emerge(1), ebuild(5), make.conf(5), color.map(5)
The /usr/lib/portage/bin/ebuild.sh script.
The helper apps in /usr/lib/portage/bin.


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILE
COMMANDS
OPTIONS
REPORTING BUGS
AUTHORS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 06:06:52 GMT, September 21, 2020

发表评论

电子邮件地址不会被公开。 必填项已用*标注