summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2009-12-10 08:47:53 +0000
committerFabian Groffen <grobian@gentoo.org>2009-12-10 08:47:53 +0000
commitc7fe3bd3909f85512d9476d92c1ba5cf1fd14082 (patch)
tree2e3b95005e235c52ad9d5dd0076096dd5df06912
parent1cf22705298a358ea2a2e9afa78be69b70751951 (diff)
downloadportage-c7fe3bd3909f85512d9476d92c1ba5cf1fd14082.tar.gz
portage-c7fe3bd3909f85512d9476d92c1ba5cf1fd14082.tar.bz2
portage-c7fe3bd3909f85512d9476d92c1ba5cf1fd14082.zip
Implement forward compatible Prefix support. This makes EPREFIX, ED and
EROOT available to the ebuild environment, and updates the manpage accordingly. EPREFIX is hardwired to the empty string, and not configurable. For that, the prefix branch should be used for now. This should satisfy the requirements for EAPI=3. svn path=/main/trunk/; revision=15024
-rwxr-xr-xbin/ebuild.sh4
-rw-r--r--man/ebuild.573
-rw-r--r--pym/portage/__init__.py22
3 files changed, 67 insertions, 32 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index fd14314d6..630ff3118 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1597,8 +1597,8 @@ READONLY_EBUILD_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI"
READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE \
- EBUILD_SH_ARGS EMERGE_FROM FILESDIR PORTAGE_BINPKG_FILE \
- PORTAGE_BIN_PATH PORTAGE_IUSE \
+ EBUILD_SH_ARGS ED EMERGE_FROM EROOT FILESDIR \
+ PORTAGE_BINPKG_FILE PORTAGE_BIN_PATH PORTAGE_IUSE \
PORTAGE_PYM_PATH PORTAGE_MUTABLE_FILTERED_VARS \
PORTAGE_SAVED_READONLY_VARS PORTAGE_TMPDIR T WORKDIR"
diff --git a/man/ebuild.5 b/man/ebuild.5
index b9b4ce62f..16d6138c1 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -15,10 +15,12 @@ Here's a simple example ebuild:
.DS
.nf
-# Copyright 1999\-2007 Gentoo Foundation
+# Copyright 1999\-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
+EAPI="3"
+
inherit some_eclass another_eclass
DESCRIPTION="Super\-useful stream editor (sed)"
@@ -33,10 +35,9 @@ IUSE=""
RDEPEND=""
DEPEND="nls? ( sys-devel/gettext )"
-src_compile() {
+src_configure() {
econf \\
- \-\-bindir=/bin
- emake || die "emake failed"
+ \-\-bindir="${EPREFIX}"/bin
}
src_install() {
@@ -101,6 +102,12 @@ Contains the path to the package build root. Do not modify this variable.
Contains the path to the 'files' sub folder in the package specific
location in the portage tree. Do not modify this variable.
.TP
+.B EPREFIX
+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}. Do not modify this
+variable.
+.TP
\fBS\fR = \fI"${WORKDIR}/${P}"\fR
Contains the path to the temporary \fIbuild directory\fR. This variable
is used by the functions \fIsrc_compile\fR and \fIsrc_install\fR. Both
@@ -116,6 +123,10 @@ 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}. 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.
+.TP
.B PORTAGE_LOG_FILE
Contains the path of the build log. If \fBPORT_LOGDIR\fR variable is unset then
\fBPORTAGE_LOG_FILE\fR=\fB"${T}/build.log"\fR.
@@ -125,6 +136,10 @@ Contains the path that portage should use as the root of the live filesystem.
When packages wish to make changes to the live filesystem, they should do so in
the tree prefixed by ${ROOT}. Do not modify this variable.
.TP
+\fBEROOT\fR = \fI"${ROOT}${EPREFIX%/}"\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.
.TP
@@ -755,13 +770,13 @@ directory. The function will append \fIsource\fR to the \fBDISTDIR\fR variable.
This is used as a replacement for configure. Performs:
.nf
${\fIECONF_SOURCE\fR:-.}/configure \\
- \-\-prefix=/usr \\
- \-\-host=${CHOST} \\
- \-\-mandir=/usr/share/man \\
- \-\-infodir=/usr/share/info \\
- \-\-datadir=/usr/share \\
- \-\-sysconfdir=/etc \\
- \-\-localstatedir=/var/lib \\
+ \-\-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 \\
\fI${EXTRA_ECONF}\fR \\
\fIconfigure options\fR || die "econf failed"
.fi
@@ -787,12 +802,12 @@ the issue, then you should run '\fBemake\fR \-j1' instead of 'make'.
This is used as a replacement for make install. Performs:
.nf
make \\
- prefix=${D}/usr \\
- datadir=${D}/usr/share \\
- infodir=${D}/usr/share/info \\
- localstatedir=${D}/var/lib \\
- mandir=${D}/usr/share/man \\
- sysconfdir=${D}/etc \\
+ prefix=${ED}/usr \\
+ datadir=${ED}/usr/share \\
+ infodir=${ED}/usr/share/info \\
+ localstatedir=${ED}/var/lib \\
+ mandir=${ED}/usr/share/man \\
+ sysconfdir=${ED}/etc \\
\fI${EXTRA_EINSTALL}\fR \\
\fImake options\fR \\
install
@@ -827,13 +842,13 @@ libraries +x, and then checks aclocal directories. Please note this
does \fI*not*\fR run \fBprepalldocs\fR.
.TP
.B prepalldocs:
-Compresses all doc files in ${D}/usr/share/doc.
+Compresses all doc files in ${ED}/usr/share/doc.
.TP
.B prepallinfo:
-Compresses all info files in ${D}/usr/share/info.
+Compresses all info files in ${ED}/usr/share/info.
.TP
.B prepallman:
-Compresses all man files in ${D}/usr/share/man.
+Compresses all man files in ${ED}/usr/share/man.
.TP
.B prepallstrip:
Strips all executable files of debugging symboles. This includes libraries.
@@ -853,31 +868,32 @@ Similiar to the \fBprepall\fR functions, these are subtle in their differences.
.B prepinfo:
If a \fIdir\fR is not specified, then \fBprepinfo\fR will assume the dir
\fIusr\fR. \fBprepinfo\fR will then compress all the files in
-${D}/\fIdir\fR/info.
+${ED}/\fIdir\fR/info.
.TP
.B prepman:
If a \fIdir\fR is not specified, then \fBprepman\fR will assume the dir
\fIusr\fR. \fBprepman\fR will then compress all the files in
-${D}/\fIdir\fR/man/*/.
+${ED}/\fIdir\fR/man/*/.
.TP
.B prepstrip:
-All the files found in ${D}/\fIdir\fR will be stripped. You may specify
+All the files found in ${ED}/\fIdir\fR will be stripped. You may specify
multiple directories.
.RE
.PD 1
.TP
\fBdosed\fR \fI"s:orig:change:g" <filename>\fR
-Performs sed in place on \fIfilename\fR inside ${D}. If no expression is
-given then \fI"s:${D}::g"\fR is used as the default expression.
+Performs sed in place on \fIfilename\fR inside ${ED}. If no expression is
+given then \fI"s:${D}::g"\fR is used as the default expression. Note
+that this expression does \fBNOT\fR use the offset prefix.
.br
.BR 'dosed\ "s:/usr/local:/usr:g"\ /usr/bin/some\-script'
-runs sed on ${D}/usr/bin/some\-script
+runs sed on ${ED}/usr/bin/some\-script
.TP
\fBdodir\fR \fI<path>\fR
-Creates a directory inside of ${D}.
+Creates a directory inside of ${ED}.
.br
.BR 'dodir\ /usr/lib/apache'
-creates ${D}/usr/lib/apache. Note that the do* functions will run
+creates ${ED}/usr/lib/apache. Note that the do* functions will run
\fBdodir\fR for you.
.TP
\fBdiropts\fR \fI[options for install(1)]\fR
@@ -1049,6 +1065,7 @@ Mark Guertin <gerk@gentoo.org>
Nicholas Jones <carpaski@gentoo.org>
Mike Frysinger <vapier@gentoo.org>
Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@gmail.com>
+Fabian Groffen <grobian@gentoo.org>
.fi
.SH "FILES"
.TP
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index c13a7149b..d44422cb7 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1369,7 +1369,7 @@ class config(object):
_env_blacklist = [
"A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
- "EBUILD_PHASE", "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
+ "EBUILD_PHASE", "EMERGE_FROM", "EPREFIX", "EROOT",
"HOMEPAGE", "INHERITED", "IUSE",
"KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE",
"PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
@@ -1392,7 +1392,8 @@ class config(object):
"ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "D",
"DISTDIR", "DOC_SYMLINKS_DIR", "EBUILD",
"EBUILD_EXIT_STATUS_FILE", "EBUILD_FORCE_TEST",
- "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "EMERGE_FROM",
+ "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "ED",
+ "EMERGE_FROM", "EPREFIX", "EROOT",
"FEATURES", "FILESDIR", "HOME", "NOCOLOR", "PATH",
"PKGDIR",
"PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR",
@@ -1972,6 +1973,12 @@ class config(object):
self["ROOT"] = target_root
self.backup_changes("ROOT")
+ # Prefix forward compatability, set EPREFIX to the empty string
+ self["EPREFIX"] = ''
+ self.backup_changes("EPREFIX")
+ self["EROOT"] = target_root
+ self.backup_changes("EROOT")
+
self.pusedict = {}
self.pkeywordsdict = {}
self._plicensedict = {}
@@ -2216,6 +2223,10 @@ class config(object):
_validate_cache_for_unsupported_eapis = False
_glep_55_enabled = True
+ # inject EPREFIX as it needs to be available using portageq
+ # TODO: this is just forward compatability, need to use EPREFIX
+ self["EPREFIX"] = ''
+
for k in self._case_insensitive_vars:
if k in self:
self[k] = self[k].lower()
@@ -6176,6 +6187,10 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
# due to how it's coded... Don't overwrite this so we can use it.
mysettings["PORTAGE_DEBUG"] = "1"
+ # Prefix forward compatability
+ mysettings["EPREFIX"] = ''
+ mysettings["EROOT"] = myroot
+
mysettings["ROOT"] = myroot
mysettings["STARTDIR"] = getcwd()
mysettings["EBUILD"] = ebuild_path
@@ -6268,6 +6283,9 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
mysettings["D"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image") + os.sep
mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
+ # Prefix forward compatability
+ mysettings["ED"] = mysettings["D"]
+
mysettings["PORTAGE_BASHRC"] = os.path.join(
mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_FILE)
mysettings["EBUILD_EXIT_STATUS_FILE"] = os.path.join(