From: Zac Medico Date: Thu, 7 Feb 2008 23:40:30 +0000 (-0000) Subject: Bug #155993 - Update environment.bz2 after postinst in case X-Git-Tag: v2.1.4.4~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b9106505a3075b9547c2d177e2c5e782c591b057;p=portage.git Bug #155993 - Update environment.bz2 after postinst in case installation phases need to pass some variables to uninstallation phases. (trunk r9281) svn path=/main/branches/2.1.2/; revision=9282 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 61799ad88..eca24c626 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1777,6 +1777,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 100644 --- 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.py b/pym/portage.py index c844d6ff0..43dc6704e 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1021,7 +1021,7 @@ class config: "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", @@ -9133,8 +9133,12 @@ class dblink: 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: