fi
case "$EAPI" in
- 0|1|2|3)
+ 0|1|2|3|3_pre2)
PRESERVE_SYMLINKS=n
;;
*)
rm -rf "${T}/${2}" || exit $?
case "$EAPI" in
- 0|1|2|3)
+ 0|1|2|3|3_pre2)
cp "$1" "$T/$2" || exit $?
;;
*)
# Skip this for older EAPIs since lots of ebuilds/eclasses
# have stuff in global scope that really belongs somewhere
# like pkg_setup or src_configure.
- if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 ; then
+ if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 3_pre2 ; then
die "use() called during invalid phase: $EBUILD_PHASE"
fi
_unpack_tar lzma
;;
xz)
- if hasq $eapi 0 1 2 3 ; then
+ if hasq $eapi 0 1 2 ; then
vecho "unpack ${x}: file format not recognized. Ignoring."
else
_unpack_tar xz
fi
# EAPI=3 adds --disable-dependency-tracking to econf
- if ! hasq "$EAPI" 0 1 2 3 ; then
+ if ! hasq "$EAPI" 0 1 2 3 3_pre2 ; then
set -- --disable-dependency-tracking "$@"
fi
if [[ -d $S ]] ; then
cd "${S}"
- elif hasq $EAPI 0 1 2 3; then
+ elif hasq $EAPI 0 1 2 3 3_pre2 ; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
cd "${WORKDIR}"
if [[ -d $S ]] ; then
cd "${S}"
- elif hasq $EAPI 0 1 2 3; then
+ elif hasq $EAPI 0 1 2 3 3_pre2 ; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
cd "${WORKDIR}"
if [[ -d $S ]] ; then
cd "${S}"
- elif hasq $EAPI 0 1 2 3; then
+ elif hasq $EAPI 0 1 2 3 3_pre2 ; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
cd "${WORKDIR}"
mkdir "${PORTAGE_BUILDDIR}/image"
if [[ -d $S ]] ; then
cd "${S}"
- elif hasq $EAPI 0 1 2 3; then
+ elif hasq $EAPI 0 1 2 3 3_pre2 ; then
cd "${WORKDIR}"
elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
cd "${WORKDIR}"
case "$arg" in
pretend)
- ! hasq $eapi 0 1 2 3 && \
+ ! hasq $eapi 0 1 2 3 3_pre2 && \
phase_func=pkg_pretend
;;
setup)
declare -F src_compile >/dev/null || \
src_compile() { _eapi2_src_compile "$@" ; }
- has $eapi 2 3 || declare -F src_install >/dev/null || \
+ has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \
src_install() { _eapi4_src_install "$@" ; }
if hasq $phase_func $default_phases ; then
[[ -n $EAPI ]] || EAPI=0
- if has "$EAPI" 0 1 2 3 ; then
+ if has "$EAPI" 0 1 2 3 3_pre2 ; then
export RDEPEND=${RDEPEND-${DEPEND}}
debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
fi
pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
pkg_setup src_test src_unpack"
;;
- 2|3)
+ 2|3|3_pre2)
_valid_phases="src_compile pkg_config src_configure pkg_info
src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
src_prepare pkg_prerm pkg_setup src_test src_unpack"
}
nonfatal() {
- if has "${EAPI:-0}" 0 1 2 3; then
+ if has "${EAPI:-0}" 0 1 2 3 3_pre2 ; then
die "$FUNCNAME() not supported in this EAPI"
fi
if [[ $# -lt 1 ]]; then
-<section id='package-ebuild-eapi-3_pre1'>
-<title>EAPI 3_pre1</title>
-<section id='package-ebuild-eapi-3_pre1-helpers'>
+<section id='package-ebuild-eapi-3_pre2'>
+<title>EAPI 3_pre2</title>
+<section id='package-ebuild-eapi-3_pre2-helpers'>
<title>Helpers</title>
-<section id='package-ebuild-eapi-3_pre1-helpers-unpack'>
+<section id='package-ebuild-eapi-3_pre2-helpers-unpack'>
<title>unpack</title>
-<section id='package-ebuild-eapi-3_pre1-helpers-unpack-xz'>
+<section id='package-ebuild-eapi-3_pre2-helpers-unpack-xz'>
<title>Support for the xz file extension</title>
<para>
-The xz file extension is now supported.
+The unpack helper now supports the xz file extension.
</para>
</section>
</section>
</section>
+<section id='package-ebuild-eapi-3_pre2-prefix'>
+<title>Support for installation prefix</title>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers'>
+<title>Helpers</title>
+<para>
+Beginning with EAPI 3, all helpers use ${ED} instead of ${D}
+when appropriate. For example, see econf and einstall below.
+</para>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers-econf'>
+<title>econf</title>
+<programlisting>
+${ECONF_SOURCE:-.}/configure \
+ --prefix="${EPREFIX}"/usr \
+ --host="${EPREFIX}${CHOST} \
+ --mandir="${EPREFIX}"/usr/share/man \
+ --infodir="${EPREFIX}"/usr/share/info \
+ --datadir="${EPREFIX}"/usr/share \
+ --sysconfdir="${EPREFIX}"/etc \
+ --localstatedir="${EPREFIX}"/var/lib \
+ ${EXTRA_ECONF} \
+ configure options || die "econf failed"
+</programlisting>
+</section>
+<section id='package-ebuild-eapi-3_pre2-prefix-helpers-einstall'>
+<title>einstall</title>
+<para>
+Note that, for make-based packages, 'emake install DESTDIR=${D}' (with
+DESTDIR=${D} rather than ${ED}) is still preferred over einstall.
+</para>
+<programlisting>
+make \
+ prefix=${ED}/usr \
+ datadir=${ED}/usr/share \
+ infodir=${ED}/usr/share/info \
+ localstatedir=${ED}/var/lib \
+ mandir=${ED}/usr/share/man \
+ sysconfdir=${ED}/etc \
+ ${EXTRA_EINSTALL} \
+ make options \
+ install
+</programlisting>
+</section>
+</section>
+<section id='package-ebuild-eapi-3_pre2-prefix-variables'>
+<title>Variables</title>
+<table><title>Installation Prefix Variables</title>
+ <tgroup cols='2' align='left' >
+ <colspec colname='name'/>
+ <colspec colname='description'/>
+ <thead>
+ <row>
+ <entry>Variable Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>ED</entry>
+ <entry>Contains the path
+ "${D%/}${EPREFIX}/" for convenience purposes.
+ For EAPI values prior to EAPI 3 which do not
+ support ${ED}, helpers use ${D} where they would
+ otherwise use ${ED}. Do not modify this variable.
+ </entry>
+ </row>
+ <row>
+ <entry>EPREFIX</entry>
+ <entry>Contains the offset
+ that this Portage was configured for during
+ installation. The offset is sometimes necessary
+ in an ebuild or eclass, and is available in such
+ cases as ${EPREFIX}. EPREFIX does not contain a
+ trailing slash, therefore an absent offset is
+ represented by the empty string. Do not modify
+ this variable. </entry>
+ </row>
+ <row>
+ <entry>EROOT</entry>
+ <entry>Contains
+ "${ROOT%/}${EPREFIX}/" for convenience purposes.
+ Do not modify this variable. </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</table>
+</section>
+</section>
</section>
location in the portage tree. Do not modify this variable.
.TP
.B EPREFIX
-Contains the offset that this Portage was configured for during
+Beginning with \fBEAPI 3\fR, contains the offset
+that this Portage was configured for during
installation. The offset is sometimes necessary in an ebuild or eclass,
and is available in such cases as ${EPREFIX}. EPREFIX does not contain
a trailing slash, therefore an absent offset is represented by the empty
\fBD\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/"\fR
Contains the path to the temporary \fIinstall directory\fR. Every write
operation that does not involve the helper tools and functions (found below)
-should be prefixed with ${D}. Often the offset prefix needs to be taken
-into account here, for which the variable ${ED} is provided (see below).
+should be prefixed with ${D}.
+Beginning with \fBEAPI 3\fR, the offset prefix often needs
+to be taken into account here, for which the variable
+${ED} is provided (see below).
Do not modify this variable.
.TP
\fBED\fT = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/${EPREFIX}/"\fR
-Contains the path "${D%/}${EPREFIX}/" for convenience purposes. Do not
-modify this variable.
+Beginning with \fBEAPI 3\fR, contains the path
+"${D%/}${EPREFIX}/" for convenience purposes.
+For \fBEAPI\fR values prior to \fBEAPI 3\fR which do
+not support \fB${ED}\fR, helpers use \fB${D}\fR where
+they would otherwise use \fB${ED}\fR.
+Do not modify this variable.
.TP
.B PORTAGE_LOG_FILE
Contains the path of the build log. If \fBPORT_LOGDIR\fR variable is unset then
below). Do not modify this variable.
.TP
\fBEROOT\fR = \fI"${ROOT%/}${EPREFIX}/"\fR
-Contains "${ROOT%/}${EPREFIX}/" for convenience purposes. Do not modify
-this variable.
+Beginning with \fBEAPI 3\fR, contains
+"${ROOT%/}${EPREFIX}/" for convenience
+purposes. Do not modify this variable.
.TP
\fBDESCRIPTION\fR = \fI"A happy little package"\fR
Should contain a short description of the package.
writers. If you wish to pass more options to configure, just pass the
extra arguments to \fBeconf\fR. Also note that \fBeconf\fR automatically
calls \fBdie\fR if the configure script fails.
+Beginning with \fBEAPI 3\fR, \fBeconf\fR uses the \fB${EPREFIX}\fR
+variable which is disregared for prior \fBEAPI\fR values.
.TP
\fBemake\fR \fI[make options]\fR
This is used as a replacement for make. Performs 'make ${MAKEOPTS}
# in it's bashrc (causing major leakage).
_environ_whitelist += [
"ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "D",
- "DISTDIR", "DOC_SYMLINKS_DIR", "EBUILD",
+ "DISTDIR", "DOC_SYMLINKS_DIR", "EAPI", "EBUILD",
"EBUILD_EXIT_STATUS_FILE", "EBUILD_FORCE_TEST",
"EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "ED",
"EMERGE_FROM", "EPREFIX", "EROOT",
mydict["USE"] = self.get("PORTAGE_USE", "")
# Don't export AA to the ebuild environment in EAPIs that forbid it
- if eapi not in ("0", "1", "2", "3"):
+ if eapi not in ("0", "1", "2", "3", "3_pre2"):
mydict.pop("AA", None)
# sandbox's bashrc sources /etc/profile which unsets ROOTPATH,
if mydo == "prepare" and eapi in ("0", "1"):
return os.EX_OK
- if mydo == "pretend" and eapi in ("0", "1", "2", "3"):
+ if mydo == "pretend" and eapi in ("0", "1", "2", "3", "3_pre2"):
return os.EX_OK
kwargs = actionmap[mydo]["args"]
return rval
-_testing_eapis = frozenset()
+_testing_eapis = frozenset(["3_pre2"])
_deprecated_eapis = frozenset(["3_pre1", "2_pre3", "2_pre2", "2_pre1"])
def _eapi_is_deprecated(eapi):
mysettings["PORTAGE_BUILDDIR"], ".exit_status")
#set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent.
- if eapi not in ('0', '1', '2', '3'):
+ if eapi not in ('0', '1', '2', '3', '3_pre2'):
# Discard KV for EAPIs that don't support it. Cache KV is restored
# from the backupenv whenever config.reset() is called.
mysettings.pop('KV', None)
else:
# Prevent mtime from rounding up to the next second.
int_mtime = sstat[stat.ST_MTIME]
- mtime_str = "%i.9999999" % int_mtime
- min_len = len(str(int_mtime)) + 2
- while True:
- mtime_str = mtime_str[:-1]
- newmtime = float(mtime_str)
- if int_mtime == long(newmtime):
- break
- elif len(mtime_str) <= min_len:
- # This shouldn't happen, but let's make sure
- # we can never have an infinite loop.
- newmtime = int_mtime
+ mtime_str = "%i." % int_mtime
+ digits = 0
+ max_digits = 9
+ while digits < max_digits:
+ if int_mtime == long(float(mtime_str + "9")):
+ mtime_str += "9"
+ digits += 1
+ else:
+ if digits < max_digits:
+ another_digit = None
+ for i in range(1, 9):
+ i_str = str(i)
+ if int_mtime != \
+ long(float(mtime_str + i_str)):
+ break
+ else:
+ another_digit = i_str
+ if another_digit is not None:
+ mtime_str += another_digit
+ digits += 1
break
+ if digits > 0:
+ newmtime = float(mtime_str)
+ else:
+ newmtime = int_mtime
os.utime(dest, (newmtime, newmtime))
newmtime = sstat[stat.ST_MTIME]
self.eapi = pkg.metadata['EAPI']
def check_eapi(self, eapi):
- return self.eapi not in ('0', '1', '2', '3')
+ return self.eapi not in ('0', '1', '2', '3', '3_pre2')
def check(self, num, line):
m = self.banned_commands_re.match(line)
self.eapi = pkg.metadata['EAPI']
def check_eapi(self, eapi):
- return self.eapi not in ('0', '1', '2', '3')
+ return self.eapi not in ('0', '1', '2', '3', '3_pre2')
def check(self, num, line):
m = self.undefined_vars_re.match(line)