The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "EAPI 6"
(Created page with "W.I.P a brief review of new EAPI=6 planned in this page.") |
|||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
A new EAPI=6 has been released as of 2015-11-13 and supported with portage-2.4.1. Noticeable changes and explanation of new features are given below. | |||
a | == bash version== | ||
Bash version Ebuilds can use features of Bash version 4.2 (was 3.2 before). | |||
The ebuild file format is in its basic form a subset of the format of a bash script. The interpreter is BASH-VERSION | |||
assumed to be GNU bash, version as listed in table below, or any later version. If possible, the package | |||
manager should set the shell’s compatibility level to the exact version specified. It must ensure | |||
that any such compatibility settings (e.g. the BASH_COMPAT variable) are not exported to external | |||
programs. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>Bash version</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>3.2</td></tr> | |||
<tr><td>6</td><td>4.2</td></tr> | |||
{{TableEnd}} | |||
===Bash's failglob option=== | |||
The <code>failglob</code> option of Bash is set in global scope, so that unintentional pattern expansion will be caught as an error. | |||
For EAPIs listed table the failglob option of bash is set in the global scope of ebuilds. FAILGLOB | |||
If set, failed pattern matches during filename expansion result in an error when the ebuild is being | |||
sourced | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th> GNU find? </th><th>failglob in global scope?</th></tr> | |||
<tr><td>0,1,2,3,4</td><td>Undefined</td><td>No</td></tr> | |||
<tr><td>5</td><td>Yes</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
==Locale settings== | |||
It is ensured that the behavior of case modification and collation order for ASCII characters (LC_CTYPE and LC_COLLATE) are the same as in the | |||
POSIX locale. The package manager must ensure that the LC_CTYPE and LC_COLLATE locale categories are equivalent to the POSIX locale, as far as characters in the ASCII range (U+0000 to U+007F) are concerned. Only for EAPIs listed in such a manner in table. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>Sane LC_CTYPE and LC_COLLATE?</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
==Ebuild Functions changes== | |||
===src_prepare=== | |||
This phase function has a default now, which applies patches from the PATCHES variable with the new <code>eapply</code> command, and user-provided patches | |||
with <code>eapply_user</code>, formerly known <code>epatch_user</code>. | |||
Example of code: | |||
<pre> | |||
src_prepare() { | |||
if declare -p PATCHES | grep -q "^declare -a "; then | |||
[[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}" | |||
else | |||
[[ -n ${PATCHES} ]] && eapply ${PATCHES} | |||
fi | |||
eapply_user | |||
} | |||
</pre> | |||
===nonfatal die=== | |||
When <code>die</code> or <code>assert</code> are called under the <code>nonfatal</code> command and with the <code>-n</code> option, they | |||
will not abort the build process but return with an error. | |||
These commands are used when an error is detected that will prevent the build process from completing. | |||
Ebuilds must not run any of these commands once the current phase function has returned. | |||
* die If called under the <code>nonfatal</code> command and with <code>-n</code> as its first parameter, displays a failure message provided in its following argument and then returns a non-zero exit status. Only in EAPIs listed in table as supporting option <code>-n</code>. Otherwise, displays a failure message provided in its first and only argument, and then aborts the build process. die is not guaranteed to work correctly if called from a subshell environment. | |||
* assert Checks the value of the shell’s pipe status variable, and if any component is non-zero (indicating failure), calls die, passing any parameters to it. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>die and assert support -n?</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
===src_unpack=== | |||
====pathnames==== | |||
Both absolute paths and paths relative to the working directory are accepted as arguments. | |||
Unpacks one or more source archives, in order, into the current directory. After unpacking, must ensure that all filesystem objects inside the current working directory (but not the currentworking directory itself) have permissions <b>a+r</b>,<b>u+w</b>,<b>go-w</b> and that all directories under the current working directory additionally have permissions <b>a+x</b>. Arguments to unpack are interpreted as follows: | |||
* A filename without path (i. e., not containing any slash) is looked up in <code>DISTDIR</code>. | |||
* An argument starting with the string .<b>/</b> is a path relative to the working directory. | |||
* Otherwise, for EAPIs listed in table as supporting absolute and relative paths, the argument is interpreted as a literal path (absolute, or relative to the working directory); for EAPIs listed as not supporting such paths, unpack shall abort the build process. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>Supports absolute and relative paths?</th><th> Case-insensitive matching?</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>No</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
====.txz files ==== | |||
Suffix .txz for xz compressed tarballs is recognised. | |||
====Filename case==== | |||
Character case of filename extensions is ignored. unpack matches filename extensions in a case-insensitive manner, for EAPIs listed such in above table. | |||
===econf changes=== | |||
Options <code>--docdir</code> and <code>--htmldir</code> are passed to configure, in addition to the existing options. | |||
<b>econf</b> Calls the program’s <code>./configure</code> script. This is designed to work with GNU Autoconf generated scripts. Any additional parameters passed to econf are passed directly to <code>./configure</code>, after the default options below. econf will look in the current working directory for a configure script unless the ECONF_SOURCE environment variable is set, in which case it is taken to be the directory containing it. econf must pass the following options to the configure script: | |||
* <code>--docdir</code> must be <code>${EPREFIX}/usr/share/doc/${PF}</code>, if the EAPI is listed in table as using it. This option will only be passed if the string <code>--docdir</code> occurs in the output of configure --help. | |||
* <code>--htmldir</code> must be <code>${EPREFIX}/usr/share/doc/${PF}/html</code>, if the EAPI is listed in table as using it. This option will only be passed if the string <code>--htmldir</code> occurs in the output of configure --help. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>--docdir</th><th> --htmldir</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>No</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
===eapply=== | |||
The <code>eapply</code> command is a simplified substitute for <code>epatch</code>, implemented in the package manager. The patches from its file or directory arguments are applied using patch -p1. | |||
Takes zero or more GNU patch options, followed by one or more file or directory paths. If applying the patches fails, it aborts the build using die, unless run using nonfatal, in which case it returns non-zero exit status. | |||
===eapply_user=== | |||
The <code>eapply_user</code> command permits the package manager to apply user-provided patches. This is replacement of <code>epath_user</code>. It must be called from every <code>src_prepare</code> function. | |||
Takes no arguments. Package managers supporting it apply user-provided patches to the source tree in the current working directory. Exact behavior is implementation defined and beyond the scope of this specification. Package managers not supporting it must implement the command as a no-op. Returns shell true (0) if patches applied successfully, or if no patches were provided. Otherwise, aborts the build process, unless run using nonfatal, in which case it returns non-zero exit status. In EAPIs where it is supported, <code>eapply_user</code> must be called once in the <code>src_prepare</code> phase. For any subsequent calls, the command will do nothing and return 0. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>epply</th><th>eapply_user</th></tr> | |||
<tr><td>0,1,2,3,4,5</td><td>No</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
===einstalldocs=== | |||
The <code>einstalldocs</code> function will install the files specified by the <code>DOCS</code> variable (or a default set of files if DOCS is unset) and by the <code>HTML_DOCS</code> variable. Takes no arguments. Installs the files specified by the <code>DOCS</code> and <code>HTML_DOCS</code> variables or a default set of files. If called using nonfatal and any of the called commands returns a non-zero exit status, returns immediately with the same exit status. | |||
===get_libdir=== | |||
The <code>get_libdir</code> command outputs the lib* directory basename suitable for the current ABI. | |||
{{TableStart}} | |||
<tr class="info"><th>EAPI</th><th>default?</th><th>einstalldocs?</th><th>get_libdir?</th></tr> | |||
<tr><td>0,1</td><td>No</td><td>No</td><td>No</td></tr> | |||
<tr><td>2,3,4,5</td><td>Yes</td><td>No</td><td>No</td></tr> | |||
<tr><td>6</td><td>Yes</td><td>Yes</td><td>Yes</td></tr> | |||
{{TableEnd}} | |||
===in_iuse=== | |||
The <code>in_iuse</code> function returns true if the USE flag given as its argument is available in the ebuild for USE queries. | |||
Returns shell true (0) if the first argument (a USE flag name) is included in <code>IUSE_ EFFECTIVE</code>, false otherwise. | |||
==Removed/Banned functions== | |||
===einstall=== | |||
No longer allowed. Use <code>emake install</code> as replacement. |
Latest revision as of 10:56, January 27, 2016
A new EAPI=6 has been released as of 2015-11-13 and supported with portage-2.4.1. Noticeable changes and explanation of new features are given below.
bash version
Bash version Ebuilds can use features of Bash version 4.2 (was 3.2 before).
The ebuild file format is in its basic form a subset of the format of a bash script. The interpreter is BASH-VERSION assumed to be GNU bash, version as listed in table below, or any later version. If possible, the package manager should set the shell’s compatibility level to the exact version specified. It must ensure that any such compatibility settings (e.g. the BASH_COMPAT variable) are not exported to external programs.
EAPI | Bash version |
---|---|
0,1,2,3,4,5 | 3.2 |
6 | 4.2 |
Bash's failglob option
The failglob
option of Bash is set in global scope, so that unintentional pattern expansion will be caught as an error.
For EAPIs listed table the failglob option of bash is set in the global scope of ebuilds. FAILGLOB
If set, failed pattern matches during filename expansion result in an error when the ebuild is being
sourced
EAPI | GNU find? | failglob in global scope? |
---|---|---|
0,1,2,3,4 | Undefined | No |
5 | Yes | No |
6 | Yes | Yes |
Locale settings
It is ensured that the behavior of case modification and collation order for ASCII characters (LC_CTYPE and LC_COLLATE) are the same as in the POSIX locale. The package manager must ensure that the LC_CTYPE and LC_COLLATE locale categories are equivalent to the POSIX locale, as far as characters in the ASCII range (U+0000 to U+007F) are concerned. Only for EAPIs listed in such a manner in table.
EAPI | Sane LC_CTYPE and LC_COLLATE? |
---|---|
0,1,2,3,4,5 | No |
6 | Yes |
Ebuild Functions changes
src_prepare
This phase function has a default now, which applies patches from the PATCHES variable with the new eapply
command, and user-provided patches
with eapply_user
, formerly known epatch_user
.
Example of code:
src_prepare() { if declare -p PATCHES | grep -q "^declare -a "; then [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}" else [[ -n ${PATCHES} ]] && eapply ${PATCHES} fi eapply_user }
nonfatal die
When die
or assert
are called under the nonfatal
command and with the -n
option, they
will not abort the build process but return with an error.
These commands are used when an error is detected that will prevent the build process from completing.
Ebuilds must not run any of these commands once the current phase function has returned.
- die If called under the
nonfatal
command and with-n
as its first parameter, displays a failure message provided in its following argument and then returns a non-zero exit status. Only in EAPIs listed in table as supporting option-n
. Otherwise, displays a failure message provided in its first and only argument, and then aborts the build process. die is not guaranteed to work correctly if called from a subshell environment. - assert Checks the value of the shell’s pipe status variable, and if any component is non-zero (indicating failure), calls die, passing any parameters to it.
EAPI | die and assert support -n? |
---|---|
0,1,2,3,4,5 | No |
6 | Yes |
src_unpack
pathnames
Both absolute paths and paths relative to the working directory are accepted as arguments. Unpacks one or more source archives, in order, into the current directory. After unpacking, must ensure that all filesystem objects inside the current working directory (but not the currentworking directory itself) have permissions a+r,u+w,go-w and that all directories under the current working directory additionally have permissions a+x. Arguments to unpack are interpreted as follows:
- A filename without path (i. e., not containing any slash) is looked up in
DISTDIR
. - An argument starting with the string ./ is a path relative to the working directory.
- Otherwise, for EAPIs listed in table as supporting absolute and relative paths, the argument is interpreted as a literal path (absolute, or relative to the working directory); for EAPIs listed as not supporting such paths, unpack shall abort the build process.
EAPI | Supports absolute and relative paths? | Case-insensitive matching? |
---|---|---|
0,1,2,3,4,5 | No | No |
6 | Yes | Yes |
.txz files
Suffix .txz for xz compressed tarballs is recognised.
Filename case
Character case of filename extensions is ignored. unpack matches filename extensions in a case-insensitive manner, for EAPIs listed such in above table.
econf changes
Options --docdir
and --htmldir
are passed to configure, in addition to the existing options.
econf Calls the program’s ./configure
script. This is designed to work with GNU Autoconf generated scripts. Any additional parameters passed to econf are passed directly to ./configure
, after the default options below. econf will look in the current working directory for a configure script unless the ECONF_SOURCE environment variable is set, in which case it is taken to be the directory containing it. econf must pass the following options to the configure script:
--docdir
must be${EPREFIX}/usr/share/doc/${PF}
, if the EAPI is listed in table as using it. This option will only be passed if the string--docdir
occurs in the output of configure --help.--htmldir
must be${EPREFIX}/usr/share/doc/${PF}/html
, if the EAPI is listed in table as using it. This option will only be passed if the string--htmldir
occurs in the output of configure --help.
EAPI | --docdir | --htmldir |
---|---|---|
0,1,2,3,4,5 | No | No |
6 | Yes | Yes |
eapply
The eapply
command is a simplified substitute for epatch
, implemented in the package manager. The patches from its file or directory arguments are applied using patch -p1.
Takes zero or more GNU patch options, followed by one or more file or directory paths. If applying the patches fails, it aborts the build using die, unless run using nonfatal, in which case it returns non-zero exit status.
eapply_user
The eapply_user
command permits the package manager to apply user-provided patches. This is replacement of epath_user
. It must be called from every src_prepare
function.
Takes no arguments. Package managers supporting it apply user-provided patches to the source tree in the current working directory. Exact behavior is implementation defined and beyond the scope of this specification. Package managers not supporting it must implement the command as a no-op. Returns shell true (0) if patches applied successfully, or if no patches were provided. Otherwise, aborts the build process, unless run using nonfatal, in which case it returns non-zero exit status. In EAPIs where it is supported, eapply_user
must be called once in the src_prepare
phase. For any subsequent calls, the command will do nothing and return 0.
EAPI | epply | eapply_user |
---|---|---|
0,1,2,3,4,5 | No | No |
6 | Yes | Yes |
einstalldocs
The einstalldocs
function will install the files specified by the DOCS
variable (or a default set of files if DOCS is unset) and by the HTML_DOCS
variable. Takes no arguments. Installs the files specified by the DOCS
and HTML_DOCS
variables or a default set of files. If called using nonfatal and any of the called commands returns a non-zero exit status, returns immediately with the same exit status.
get_libdir
The get_libdir
command outputs the lib* directory basename suitable for the current ABI.
EAPI | default? | einstalldocs? | get_libdir? |
---|---|---|---|
0,1 | No | No | No |
2,3,4,5 | Yes | No | No |
6 | Yes | Yes | Yes |
in_iuse
The in_iuse
function returns true if the USE flag given as its argument is available in the ebuild for USE queries.
Returns shell true (0) if the first argument (a USE flag name) is included in IUSE_ EFFECTIVE
, false otherwise.
Removed/Banned functions
einstall
No longer allowed. Use emake install
as replacement.