public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10390 - in main/trunk/pym: _emerge portage/dbapi
@ 2008-05-24 20:35 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-05-24 20:35 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-05-24 20:35:30 +0000 (Sat, 24 May 2008)
New Revision: 10390

Modified:
   main/trunk/pym/_emerge/__init__.py
   main/trunk/pym/portage/dbapi/vartree.py
Log:
Bug #223417 - Make the vardbapi.cpv_all() use_cache parameter useful
for forcing direct os.listdir() calls. This is more of an issue now
that these listdir() calls are frequently triggered when merging
packages (due to things like blocker and preserve-libs handling).


Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py	2008-05-24 19:22:00 UTC (rev 10389)
+++ main/trunk/pym/_emerge/__init__.py	2008-05-24 20:35:30 UTC (rev 10390)
@@ -998,7 +998,7 @@
 				vdb_lock = portage.locks.lockdir(vdb_path)
 			real_dbapi = real_vartree.dbapi
 			slot_counters = {}
-			for cpv in real_dbapi.cpv_all():
+			for cpv in real_dbapi.cpv_all(use_cache=0):
 				cache_key = ("installed", self.root, cpv, "nomerge")
 				pkg = self._pkg_cache.get(cache_key)
 				if pkg is not None:

Modified: main/trunk/pym/portage/dbapi/vartree.py
===================================================================
--- main/trunk/pym/portage/dbapi/vartree.py	2008-05-24 19:22:00 UTC (rev 10389)
+++ main/trunk/pym/portage/dbapi/vartree.py	2008-05-24 20:35:30 UTC (rev 10390)
@@ -136,7 +136,7 @@
 		libs = {}
 		obj_properties = {}
 		lines = []
-		for cpv in self._dbapi.cpv_all():
+		for cpv in self._dbapi.cpv_all(use_cache=0):
 			lines += self._dbapi.aux_get(cpv, ["NEEDED.ELF.2"])[0].split('\n')
 		# Cache NEEDED.* files avoid doing excessive IO for every rebuild.
 		self._dbapi.flush_cache()
@@ -455,8 +455,25 @@
 		return returnme
 
 	def cpv_all(self, use_cache=1):
+		"""
+		Set use_cache=0 to bypass the portage.cachedir() cache in cases
+		when the accuracy of mtime staleness checks should not be trusted
+		(generally this is only necessary in critical sections that
+		involve merge or unmerge of packages).
+		"""
 		returnme = []
 		basepath = os.path.join(self.root, VDB_PATH) + os.path.sep
+
+		if use_cache:
+			from portage import listdir
+		else:
+			def listdir(p, **kwargs):
+				try:
+					return [x for x in os.listdir(p) \
+						if os.path.isdir(os.path.join(p, x))]
+				except EnvironmentError:
+					return []
+
 		for x in listdir(basepath, EmptyOnError=1, ignorecvs=1, dirsonly=1):
 			if self._excluded_dirs.match(x) is not None:
 				continue

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-24 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-24 20:35 [gentoo-commits] portage r10390 - in main/trunk/pym: _emerge portage/dbapi Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox