Bug #155993 - Update environment.bz2 after postinst in case
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Feb 2008 23:40:30 +0000 (23:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Feb 2008 23:40:30 +0000 (23:40 -0000)
installation phases need to pass some variables to
uninstallation phases. (trunk r9281)

svn path=/main/branches/2.1.2/; revision=9282

bin/ebuild.sh
bin/isolated-functions.sh
pym/portage.py

index 61799ad88cb046b2373ecfd2a37991d83b4815b3..eca24c626834b3ed5cdef6c02e0db8aa0682c765 100755 (executable)
@@ -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
index 5750ce8ddd691b7b227db40d6b5b49e5db1c02b7..ee73e7bcda3783786b29718366746d4760074149 100644 (file)
@@ -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 \
index c844d6ff06d582fae726d332491a33ffa8476905..43dc6704e22b2a9a55fb5efa5264e79bed45cc5e 100644 (file)
@@ -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: