Merged from trunk 10577:10582
authorFabian Groffen <grobian@gentoo.org>
Thu, 5 Jun 2008 17:17:49 +0000 (17:17 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 5 Jun 2008 17:17:49 +0000 (17:17 -0000)
   | 10578   | Use sets for more accurate cache modification counts         |
   | zmedico | BlockerCache and vardbapi.                                   |

   | 10580   | Mention PORTAGE_RO_DISTDIRS in the DISTDIR docs.             |
   | zmedico |                                                              |

   | 10582   | Bug #224713 - Avoid TypeError when make.conf is missing:     |
   | zmedico | TypeError: argument of type 'NoneType' is not iterable       |

svn path=/main/branches/prefix/; revision=10585

man/make.conf.5
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py

index f854a2538c38714cbee5f5b94446c94caeaa11b0..b24844b6b52be6abc40b0a066b83e3ccfc47dda5 100644 (file)
@@ -102,7 +102,12 @@ Defines the location of your local source file repository. After packages
 are built, it is safe to remove any and all files from this directory since
 they will be automatically fetched on demand for a given build. If you would
 like to selectively prune obsolete files from this directory, see
-\fBeclean\fR(1) from the gentoolkit package. Note
+\fBeclean\fR(1) from the gentoolkit package.
+
+Use the \fBPORTAGE_RO_DISTDIRS\fR variable to specify one or
+more read-only directories containing distfiles.
+
+Note
 that locations under /usr/portage are not necessarily safe for data storage.
 See the \fBPORTDIR\fR documentation for more information.
 .br
index bb3bab358f001370cc4e245863daed3349d3346b..773de639f07bdfe2f3cc9e6423823aa7fb8094db 100644 (file)
@@ -1497,7 +1497,7 @@ class BlockerCache(DictMixin):
                        portage.CACHE_PATH.lstrip(os.path.sep), "vdb_blockers.pickle")
                self._cache_version = "1"
                self._cache_data = None
-               self._modified = 0
+               self._modified = set()
                self._load()
 
        def _load(self):
@@ -1567,7 +1567,7 @@ class BlockerCache(DictMixin):
                        self._cache_data = {"version":self._cache_version}
                        self._cache_data["blockers"] = {}
                        self._cache_data["virtuals"] = self._virtuals
-               self._modified = 0
+               self._modified.clear()
 
        def flush(self):
                """If the current user has permission and the internal blocker cache
@@ -1585,7 +1585,7 @@ class BlockerCache(DictMixin):
                        "virtuals" : vardb.settings.getvirtuals()
                }
                """
-               if self._modified >= self._cache_threshold and \
+               if len(self._modified) >= self._cache_threshold and \
                        secpass >= 2:
                        try:
                                f = portage.util.atomic_ofstream(self._cache_filename)
@@ -1595,7 +1595,7 @@ class BlockerCache(DictMixin):
                                        self._cache_filename, gid=portage.portage_gid, mode=0644)
                        except (IOError, OSError), e:
                                pass
-                       self._modified = 0
+                       self._modified.clear()
 
        def __setitem__(self, cpv, blocker_data):
                """
@@ -1609,7 +1609,7 @@ class BlockerCache(DictMixin):
                """
                self._cache_data["blockers"][cpv] = \
                        (blocker_data.counter, tuple(str(x) for x in blocker_data.atoms))
-               self._modified += 1
+               self._modified.add(cpv)
 
        def __iter__(self):
                return iter(self._cache_data["blockers"])
index 551a47b1f48f4d20939c2ca9c1982e56792ec771..a498c748c7c4a77cd7d3c54b6397481a33e32c39 100644 (file)
@@ -1279,6 +1279,8 @@ class config(object):
                        make_conf = getconfig(
                                os.path.join(config_root, MAKE_CONF_FILE.lstrip(os.path.sep)),
                                tolerant=tolerant, allow_sourcing=True)
+                       if make_conf is None:
+                               make_conf = {}
 
                        # Allow ROOT setting to come from make.conf if it's not overridden
                        # by the constructor argument (from the calling environment).
index 66418983341df731958e2802dbdb8297f2ce4ce7..dd6cba4712345c5ff6abd4be1eb802876ab537f2 100644 (file)
@@ -663,7 +663,7 @@ class vardbapi(dbapi):
                users have read access and benefit from faster metadata lookups (as
                long as at least part of the cache is still valid)."""
                if self._aux_cache is not None and \
-                       self._aux_cache["modified"] >= self._aux_cache_threshold and \
+                       len(self._aux_cache["modified"]) >= self._aux_cache_threshold and \
                        secpass >= 2:
                        valid_nodes = set(self.cpv_all())
                        for cpv in self._aux_cache["packages"].keys():
@@ -678,7 +678,7 @@ class vardbapi(dbapi):
                                        self._aux_cache_filename, gid=portage_gid, mode=0644)
                        except (IOError, OSError), e:
                                pass
-                       self._aux_cache["modified"] = 0
+                       self._aux_cache["modified"] = set()
 
        def aux_get(self, mycpv, wants):
                """This automatically caches selected keys that are frequently needed
@@ -723,7 +723,7 @@ class vardbapi(dbapi):
                                not self._aux_cache.get("packages"):
                                self._aux_cache = {"version": self._aux_cache_version}
                                self._aux_cache["packages"] = {}
-                       self._aux_cache["modified"] = 0
+                       self._aux_cache["modified"] = set()
                mydir = self.getpath(mycpv)
                mydir_stat = None
                try:
@@ -768,7 +768,7 @@ class vardbapi(dbapi):
                                for aux_key in cache_these:
                                        cache_data[aux_key] = mydata[aux_key]
                                self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data)
-                               self._aux_cache["modified"] += 1
+                               self._aux_cache["modified"].add(mycpv)
                return [mydata[x] for x in wants]
 
        def _aux_get(self, mycpv, wants):