Index: portage-2.1_pre3/pym/cache/util.py =================================================================== --- portage-2.1_pre3.orig/pym/cache/util.py +++ portage-2.1_pre3/pym/cache/util.py @@ -101,3 +101,13 @@ class non_quiet_mirroring(quiet_mirrorin def corruption(self,key,*arg): print "corrupt %s:" % key,arg def eclass_stale(self,key,*arg):print "stale %s:"%key,arg +def is_cache_valid(emtime, eclasses, mydata): + if emtime != long(mydata.get("_mtime_", 0)): + return False + ec_dict = mydata.get("_eclasses_", []) + if len(ec_dict) == 0: + return True + for eclass, tup in ec_dict.iteritems(): + if eclass not in eclasses or tuple(tup) != eclasses[eclass]: + return False + return True Index: portage-2.1_pre3/pym/portage.py =================================================================== --- portage-2.1_pre3.orig/pym/portage.py +++ portage-2.1_pre3/pym/portage.py @@ -29,6 +29,7 @@ try: from time import sleep from random import shuffle from cache.cache_errors import CacheError + from cache.util import is_cache_valid except SystemExit, e: raise except Exception, e: @@ -4721,7 +4722,12 @@ class portdbapi(dbapi): for x in self.porttrees: # location, label, auxdbkeys self.auxdb[x] = self.auxdbmodule(portage_const.DEPCACHE_PATH, x, filtered_auxdbkeys, gid=portage_gid) - + + if "metadb" in self.mysettings.features: + for x in self.porttrees: + if os.path.exists(x+"/metadata/cache"): + self.metadb[x]=self.metadbmodule(x, "metadata/cache", auxdbkeys) + def close_caches(self): for x in self.auxdb.keys(): self.auxdb[x].sync() @@ -4825,14 +4831,16 @@ class portdbapi(dbapi): raise KeyError try: - mydata = self.auxdb[mylocation][mycpv] - if emtime != long(mydata.get("_mtime_", 0)): - doregen = True - elif len(mydata.get("_eclasses_", [])) > 0: - doregen = not self.eclassdb.is_eclass_data_valid(mydata["_eclasses_"]) - else: - doregen = False - + mydata=None + doregen=False + if self.metadb.has_key(mylocation): + try: + mydata = self.metadb[mylocation][mycpv] + except (KeyError, CacheError): + pass + if not mydata or not is_cache_valid(emtime, self.eclassdb.eclasses, mydata): + mydata = self.auxdb[mylocation][mycpv] + doregen = not is_cache_valid(emtime, self.eclassdb.eclasses, mydata) except KeyError: doregen = True except CacheError: Index: portage-2.1_pre3/bin/emerge =================================================================== --- portage-2.1_pre3.orig/bin/emerge +++ portage-2.1_pre3/bin/emerge @@ -2768,6 +2768,10 @@ if myaction in ["sync","rsync","metadata except: pass + if updatecache_flg and "metadb" in portage.features: + updatecache_flg=False + print "!!! Skipping metadata transfer because metadb is in FEATURES." + if os.path.exists(myportdir+"/metadata/cache") and updatecache_flg: if "--quiet" not in myopts: print "\n>>> Updating Portage cache: ",