summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-30 23:15:25 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-30 23:15:25 +0000
commit8e10426aad390c88b3683b374199a20b48cdce9e (patch)
tree2d50c13d6bfaf3530f2448f5f6c94578fdf6028f
parentb052587e35d2dda778fccb3db3b19557ce05be5b (diff)
downloadportage-8e10426aad390c88b3683b374199a20b48cdce9e.tar.gz
portage-8e10426aad390c88b3683b374199a20b48cdce9e.tar.bz2
portage-8e10426aad390c88b3683b374199a20b48cdce9e.zip
Add support in MetadataRegen for cleansing stale cache when only a subset
of packages are processed. svn path=/main/trunk/; revision=13255
-rw-r--r--pym/_emerge/__init__.py36
-rw-r--r--pym/portage/__init__.py2
2 files changed, 28 insertions, 10 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index e756b6a9c..611ac064c 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -11580,9 +11580,7 @@ class MetadataRegen(PollScheduler):
if cp_iter is None:
cp_iter = self._iter_every_cp()
# We can globally cleanse stale cache only if we
- # iterate over every single cp. TODO: Add support
- # to cleanse cache for the specific cp values that
- # are processed.
+ # iterate over every single cp.
self._global_cleanse = True
self._cp_iter = cp_iter
@@ -11597,6 +11595,7 @@ class MetadataRegen(PollScheduler):
unregister=self._unregister)
self._valid_pkgs = set()
+ self._cp_set = set()
self._process_iter = self._iter_metadata_processes()
self.returncode = os.EX_OK
self._error_count = 0
@@ -11613,8 +11612,10 @@ class MetadataRegen(PollScheduler):
def _iter_metadata_processes(self):
portdb = self._portdb
valid_pkgs = self._valid_pkgs
+ cp_set = self._cp_set
for cp in self._cp_iter:
+ cp_set.add(cp)
portage.writemsg_stdout("Processing %s\n" % cp)
cpv_list = portdb.cp_list(cp)
for cpv in cpv_list:
@@ -11632,6 +11633,12 @@ class MetadataRegen(PollScheduler):
from portage.cache.cache_errors import CacheError
dead_nodes = {}
+ while self._schedule():
+ self._poll_loop()
+
+ while self._jobs:
+ self._poll_loop()
+
if self._global_cleanse:
for mytree in portdb.porttrees:
try:
@@ -11643,14 +11650,23 @@ class MetadataRegen(PollScheduler):
del e
dead_nodes = None
break
+ else:
+ cp_set = self._cp_set
+ cpv_getkey = portage.cpv_getkey
+ for mytree in portdb.porttrees:
+ try:
+ dead_nodes[mytree] = set(cpv for cpv in \
+ portdb.auxdb[mytree].iterkeys() \
+ if cpv_getkey(cpv) in cp_set)
+ except CacheError, e:
+ portage.writemsg("Error listing cache entries for " + \
+ "'%s': %s, continuing...\n" % (mytree, e),
+ noiselevel=-1)
+ del e
+ dead_nodes = None
+ break
- while self._schedule():
- self._poll_loop()
-
- while self._jobs:
- self._poll_loop()
-
- if self._global_cleanse and dead_nodes:
+ if dead_nodes:
for y in self._valid_pkgs:
for mytree in portdb.porttrees:
if portdb.findname2(y, mytree=mytree)[0]:
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 919b2108b..a5828cf5a 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7180,6 +7180,8 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
def cpv_getkey(mycpv):
myslash=mycpv.split("/")
mysplit=pkgsplit(myslash[-1])
+ if mysplit is None:
+ return None
mylen=len(myslash)
if mylen==2:
return myslash[0]+"/"+mysplit[0]