* When installing a binary package, export the file name of the package
authorZac Medico <zmedico@gentoo.org>
Tue, 11 Dec 2007 21:41:55 +0000 (21:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 11 Dec 2007 21:41:55 +0000 (21:41 -0000)
as PORTAGE_BINPKG_FILE in order to give bashrc users an opportunity
to do various things such as remove binary packages after they're
installed.

* Add a note in ebuild.sh explaining why hardcoded bash lists are
needed for backward compatibility with <portage-2.1.4 since they
assume that a newly installed version of ebuild.sh will work for
pkg_postinst, pkg_prerm, and pkg_postrm when portage is upgrading
itself.
(trunk r8878)

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

bin/ebuild.sh
pym/portage.py

index f1d42bd01a56f2befe0c40ad59525a9f79969b76..fbccce70ce32ad8f7c7f1889e113fd865654f898 100755 (executable)
@@ -1355,12 +1355,17 @@ source_all_bashrcs() {
        [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
 }
 
+# Hardcoded bash lists are needed for backward compatibility with
+# <portage-2.1.4 since they assume that a newly installed version
+# of ebuild.sh will work for pkg_postinst, pkg_prerm, and pkg_postrm
+# when portage is upgrading itself.
+
 READONLY_EBUILD_METADATA="DEPEND DESCRIPTION
        EAPI HOMEPAGE INHERITED IUSE KEYWORDS LICENSE
        PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI"
 
 READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE \
-       EBUILD_SH_ARGS EMERGE_FROM FILESDIR \
+       EBUILD_SH_ARGS EMERGE_FROM FILESDIR PORTAGE_BINPKG_FILE \
        PORTAGE_BIN_PATH PORTAGE_PYM_PATH PORTAGE_MUTABLE_FILTERED_VARS \
        PORTAGE_SAVED_READONLY_VARS PORTAGE_TMPDIR T WORKDIR"
 
index 4ce2e7f50999c48ff81fa6db371dae3918372029..11965f17666a08a565261031e4e4164bdcd225e5 100644 (file)
@@ -1010,7 +1010,9 @@ class config:
                "FEATURES", "FILESDIR", "HOME", "PATH",
                "PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR",
                "PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST",
-               "PORTAGE_BASHRC", "PORTAGE_BINPKG_TMPFILE", "PORTAGE_BIN_PATH",
+               "PORTAGE_BASHRC",
+               "PORTAGE_BINPKG_FILE", "PORTAGE_BINPKG_TMPFILE",
+               "PORTAGE_BIN_PATH",
                "PORTAGE_BUILDDIR", "PORTAGE_COLORMAP",
                "PORTAGE_CONFIGROOT", "PORTAGE_DEBUG", "PORTAGE_DEPCACHEDIR",
                "PORTAGE_GID", "PORTAGE_INST_GID", "PORTAGE_INST_UID",
@@ -9450,6 +9452,10 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes
                fp.write(str(portage_checksum.perform_md5(mytbz2))+"\n")
                fp.close()
 
+               # This gives bashrc users an opportunity to do various things
+               # such as remove binary packages after they're installed.
+               mysettings["PORTAGE_BINPKG_FILE"] = mytbz2
+               mysettings.backup_changes("PORTAGE_BINPKG_FILE")
                debug = mysettings.get("PORTAGE_DEBUG", "") == "1"
 
                # Eventually we'd like to pass in the saved ebuild env here.
@@ -9476,6 +9482,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes
                did_merge_phase = True
                return retval
        finally:
+               mysettings.pop("PORTAGE_BINPKG_FILE", None)
                if tbz2_lock:
                        portage_locks.unlockfile(tbz2_lock)
                if builddir_lock: