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
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 \
"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",
del conf_mem_file
#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: