summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/ebuild.sh10
-rwxr-xr-xbin/isolated-functions.sh3
-rw-r--r--pym/portage/__init__.py2
-rw-r--r--pym/portage/dbapi/vartree.py4
4 files changed, 17 insertions, 2 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 6752df9ae..61f6e18fe 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1781,6 +1781,16 @@ if [ -n "${EBUILD_SH_ARGS}" ] ; then
ebuild_phase_with_hooks pkg_${EBUILD_SH_ARGS}
set +x
fi
+ if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then
+ # Update environment.bz2 in case installation phases
+ # need to pass some variables to uninstallation phases.
+ (
+ unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_
+ save_ebuild_env | filter_readonly_variables \
+ --filter-sandbox --allow-extra-vars | \
+ bzip2 -c -f9 > "$PORTAGE_UPDATE_ENV"
+ )
+ fi
;;
unpack|compile|test|clean|install)
if [ "${SANDBOX_DISABLED="0"}" == "0" ]; then
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 5750ce8dd..ee73e7bcd 100755
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -470,7 +470,8 @@ save_ebuild_env() {
PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \
PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \
PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \
- PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_WORKDIR_MODE PORTDIR \
+ PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \
+ PORTAGE_WORKDIR_MODE PORTDIR \
PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \
PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \
RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL \
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 0dc6f1c40..741c99078 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -886,7 +886,7 @@ class config(object):
"PORTAGE_IUSE",
"PORTAGE_LOG_FILE", "PORTAGE_MASTER_PID",
"PORTAGE_PYM_PATH", "PORTAGE_REPO_NAME", "PORTAGE_RESTRICT",
- "PORTAGE_TMPDIR", "PORTAGE_WORKDIR_MODE",
+ "PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV", "PORTAGE_WORKDIR_MODE",
"PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", "PROFILE_PATHS",
"ROOT", "ROOTPATH", "STARTDIR", "T", "TMP", "TMPDIR",
"USE_EXPAND", "USE_ORDER", "WORKDIR",
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 3b11823b6..002a9f373 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2152,8 +2152,12 @@ class dblink(object):
self.vartree.dbapi.libmap.update()
#do postinst script
+ self.settings["PORTAGE_UPDATE_ENV"] = \
+ os.path.join(self.dbpkgdir, "environment.bz2")
+ self.settings.backup_changes("PORTAGE_UPDATE_ENV")
a = doebuild(myebuild, "postinst", destroot, self.settings, use_cache=0,
tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree)
+ self.settings.pop("PORTAGE_UPDATE_ENV", None)
# XXX: Decide how to handle failures here.
if a != os.EX_OK: