From 463b82e15e317cd210b78886a319fbdee8981a63 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 24 Jun 2009 06:47:57 +0000 Subject: [PATCH] In binarytree.inject(), when a symlink is created for the current package and it overwrites another package, delete the corresponding metadata from the Packages file. Thanks to Eitan Mosenkis for reporting. svn path=/main/trunk/; revision=13680 --- pym/portage/dbapi/bintree.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index b2984fafc..41da32d39 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -833,6 +833,7 @@ class binarytree(object): # process) and then updated it, all while holding a lock. from portage.locks import lockfile, unlockfile pkgindex_lock = None + created_symlink = False try: pkgindex_lock = lockfile(self._pkgindex_file, wantnewlockfile=1) @@ -843,6 +844,7 @@ class binarytree(object): if self._all_directory and \ self.getname(cpv).split(os.path.sep)[-2] == "All": self._create_symlink(cpv) + created_symlink = True pkgindex = self._new_pkgindex() try: f = open(self._pkgindex_file) @@ -874,8 +876,14 @@ class binarytree(object): # Handle path collisions in $PKGDIR/All # when CPV is not identical. del pkgindex.packages[i] - elif cpv == d2.get("CPV") and path == d2.get("PATH", ""): - del pkgindex.packages[i] + elif cpv == d2.get("CPV"): + if path == d2.get("PATH", ""): + del pkgindex.packages[i] + elif created_symlink and not d2.get("PATH", ""): + # Delete entry for the package that was just + # overwritten by a symlink to this package. + del pkgindex.packages[i] + pkgindex.packages.append(d) self._update_pkgindex_header(pkgindex.header) -- 2.26.2