public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10385 - in main/branches/prefix/pym: _emerge portage portage/dbapi
@ 2008-05-21 17:37 Fabian Groffen (grobian)
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2008-05-21 17:37 UTC (permalink / raw
  To: gentoo-commits

Author: grobian
Date: 2008-05-21 17:37:05 +0000 (Wed, 21 May 2008)
New Revision: 10385

Modified:
   main/branches/prefix/pym/_emerge/__init__.py
   main/branches/prefix/pym/portage/__init__.py
   main/branches/prefix/pym/portage/dbapi/vartree.py
Log:
   Merged from trunk 10359:10377

   | 10360   | Tweak vardbapi.aux_get() cache logic a bit.                  |
   | zmedico |                                                              |
   
   | 10361   | In unmerge(), flush the vardbapi aux_get() cache to disk     |
   | zmedico | before releasing the vardb lock.                             |
   
   | 10364   | Exclude "env" from use in variable substitution since we     |
   | zmedico | want to avoid any interaction with the calling environment   |
   |         | that might lead to unexpected results.                       |
   
   | 10367   | Fix vardbapi.aux_get() logic so that it will correctly pull  |
   | zmedico | the metadata value corresponding to an unrecognized metadata |
   |         | key.                                                         |
   
   | 10369   | Validate and normalize target_root earlier in the config     |
   | zmedico | constructor.                                                 |
   
   | 10372   | Adjust code order to organize it a bit. (branches/2.1.2      |
   | zmedico | r10371)                                                      |
   
   | 10373   | Inside vardbapi.aux_get(), do more validation on the cache   |
   | zmedico | data to ensure it contains the expected data types.          |
   
   | 10375   | In vardbapi.aux_get(), don't mark cacheed metadata invalid   |
   | zmedico | just because some of the values are missing.                 |
   
   | 10377   | Simplify cache code in vardbapi.aux_get().                   |
   | zmedico |                                                              |


Modified: main/branches/prefix/pym/_emerge/__init__.py
===================================================================
--- main/branches/prefix/pym/_emerge/__init__.py	2008-05-21 17:30:12 UTC (rev 10384)
+++ main/branches/prefix/pym/_emerge/__init__.py	2008-05-21 17:37:05 UTC (rev 10385)
@@ -6361,6 +6361,7 @@
 			return 0
 	finally:
 		if vdb_lock:
+			vartree.dbapi.flush_cache()
 			portage.locks.unlockdir(vdb_lock)
 	
 	from portage.sets.base import EditablePackageSet

Modified: main/branches/prefix/pym/portage/__init__.py
===================================================================
--- main/branches/prefix/pym/portage/__init__.py	2008-05-21 17:30:12 UTC (rev 10384)
+++ main/branches/prefix/pym/portage/__init__.py	2008-05-21 17:37:05 UTC (rev 10385)
@@ -1285,18 +1285,27 @@
 			if target_root is None:
 				target_root = "/"
 
+			target_root = normalize_path(os.path.abspath(
+				target_root)).rstrip(os.path.sep) + os.path.sep
+
+			portage.util.ensure_dirs(target_root + EPREFIX_LSTRIP)
+			check_var_directory("ROOT", target_root + EPREFIX_LSTRIP)
+
 			# The expand_map is used for variable substitution
 			# in getconfig() calls, and the getconfig() calls
 			# update expand_map with the value of each variable
 			# assignment that occurs. Variable substitution occurs
-			# in the following order:
+			# in the following order, which corresponds to the
+			# order of appearance in self.lookuplist:
 			#
 			#   * env.d
-			#   * env
 			#   * make.globals
 			#   * make.defaults
 			#   * make.conf
 			#
+			# Notably absent is "env", since we want to avoid any
+			# interaction with the calling environment that might
+			# lead to unexpected results.
 			expand_map = {}
 
 			env_d = getconfig(os.path.join(target_root + EPREFIX_LSTRIP, "etc", "profile.env"),
@@ -1308,13 +1317,7 @@
 
 			# backupenv is used for calculating incremental variables.
 			self.backupenv = os.environ.copy()
-			expand_map.update(self.backupenv)
 
-			# make.globals should not be relative to config_root
-			# because it only contains constants.
-			self.mygcfg = getconfig(os.path.join(BPREFIX, "etc", "make.globals"),
-				expand=expand_map)
-
 			if env_d:
 				# Remove duplicate values so they don't override updated
 				# profile.env values later (profile.env is reloaded in each
@@ -1329,6 +1332,11 @@
 
 			self.configdict["env"] = self.backupenv.copy()
 
+			# make.globals should not be relative to config_root
+			# because it only contains constants.
+			self.mygcfg = getconfig(os.path.join(BPREFIX, "etc", "make.globals"),
+				expand=expand_map)
+
 			if self.mygcfg is None:
 				self.mygcfg = {}
 
@@ -1396,12 +1404,6 @@
 					cfg.pop(blacklisted, None)
 			del blacklisted, cfg
 
-			target_root = normalize_path(os.path.abspath(
-				target_root)).rstrip(os.path.sep) + os.path.sep
-
-			portage.util.ensure_dirs(target_root + EPREFIX_LSTRIP)
-			check_var_directory("ROOT", target_root + EPREFIX_LSTRIP)
-
 			self["PORTAGE_CONFIGROOT"] = config_root
 			self.backup_changes("PORTAGE_CONFIGROOT")
 			self["ROOT"] = target_root

Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
===================================================================
--- main/branches/prefix/pym/portage/dbapi/vartree.py	2008-05-21 17:30:12 UTC (rev 10384)
+++ main/branches/prefix/pym/portage/dbapi/vartree.py	2008-05-21 17:37:05 UTC (rev 10385)
@@ -715,33 +715,36 @@
 			raise KeyError(mycpv)
 		mydir_mtime = long(mydir_stat.st_mtime)
 		pkg_data = self._aux_cache["packages"].get(mycpv)
+		pull_me = cache_these.union(wants)
 		mydata = {}
 		cache_valid = False
 		cache_incomplete = False
+		cache_mtime = None
+		metadata = None
+		if pkg_data is not None:
+			if not isinstance(pkg_data, tuple) or len(pkg_data) != 2:
+				pkg_data = None
+			else:
+				cache_mtime, metadata = pkg_data
+				if not isinstance(cache_mtime, (long, int)) or \
+					not isinstance(metadata, dict):
+					pkg_data = None
+
 		if pkg_data:
 			cache_mtime, metadata = pkg_data
 			cache_valid = cache_mtime == mydir_mtime
 		if cache_valid:
-			cache_incomplete = cache_these.difference(metadata)
-			if cache_incomplete:
-				# Allow self._aux_cache_keys to change without a cache version
-				# bump and efficiently recycle partial cache whenever possible.
-				cache_valid = False
-				pull_me = cache_incomplete.union(wants)
-			else:
-				pull_me = set(wants).difference(cache_these)
 			mydata.update(metadata)
-		else:
-			pull_me = cache_these
+			pull_me.difference_update(metadata)
 
 		if pull_me:
 			# pull any needed data and cache it
 			aux_keys = list(pull_me)
 			for k, v in izip(aux_keys, self._aux_get(mycpv, aux_keys)):
 				mydata[k] = v
-			if not cache_valid or cache_incomplete:
+			if not cache_valid or cache_these.difference(metadata):
 				cache_data = {}
-				if cache_incomplete:
+				if cache_valid and metadata:
 					cache_data.update(metadata)
 				for aux_key in cache_these:
 					cache_data[aux_key] = mydata[aux_key]

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



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

only message in thread, other threads:[~2008-05-21 17:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 17:37 [gentoo-commits] portage r10385 - in main/branches/prefix/pym: _emerge portage portage/dbapi Fabian Groffen (grobian)

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