When an unprivileged user runs portage (not in the portage group), use metadata_overl...
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Dec 2006 23:26:48 +0000 (23:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Dec 2006 23:26:48 +0000 (23:26 -0000)
svn path=/main/trunk/; revision=5354

pym/cache/flat_hash.py
pym/cache/metadata_overlay.py
pym/portage.py

index a8adb220515ec4af371db2159ff5e427833d0adf..48e8a175e6ab1347adae4af4477fdaf8b282a753 100644 (file)
@@ -17,7 +17,7 @@ class database(fs_template.FsBased):
                self.location = os.path.join(self.location, 
                        self.label.lstrip(os.path.sep).rstrip(os.path.sep))
 
-               if not os.path.exists(self.location):
+               if not self.readonly and not os.path.exists(self.location):
                        self._ensure_dirs()
 
        def __getitem__(self, cpv):
index c4d18c173327de1a06dc63a152c0cd747e51a4e2..b829ea579cfcc758de5766134f846a7cd4799fec 100644 (file)
@@ -19,7 +19,10 @@ class database(template.database):
                **config):
                super(database, self).__init__(location, label, auxdbkeys)
                self.db_rw = db_rw(location, label, auxdbkeys, **config)
-               self.db_ro = db_ro(label,"metadata/cache",auxdbkeys)
+               self.commit = self.db_rw.commit
+               ro_config = config.copy()
+               ro_config["readonly"] = True
+               self.db_ro = db_ro(label, "metadata/cache", auxdbkeys, **ro_config)
 
        def __getitem__(self, cpv):
                """funnel whiteout validation through here, since value needs to be fetched"""
index 4349dcca476bb29673bd9e0e78e4b218a43c2ce7..e67231ca0d2c53e5d17750d3bd7169259bc787bc 100644 (file)
@@ -3236,8 +3236,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                # Only try and fetch the files if we are going to need them ...
                # otherwise, if user has FEATURES=noauto and they run `ebuild clean
                # unpack compile install`, we will try and fetch 4 times :/
-               need_distfiles = (mydo in ("digest", "fetch", "unpack") or \
-                       mydo != "manifest" and "noauto" not in features)
+               need_distfiles = (mydo in ("fetch", "unpack") or \
+                       mydo not in ("digest", "manifest") and "noauto" not in features)
                if need_distfiles and not fetch(
                        fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
                        return 1
@@ -5168,9 +5168,18 @@ class portdbapi(dbapi):
                # XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
                # ~harring
                filtered_auxdbkeys = filter(lambda x: not x.startswith("UNUSED_0"), auxdbkeys)
-               for x in self.porttrees:
-                       # location, label, auxdbkeys
-                       self.auxdb[x] = self.auxdbmodule(self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid)
+               if secpass < 1:
+                       from cache import metadata_overlay, volatile
+                       for x in self.porttrees:
+                               self.auxdb[x] = metadata_overlay.database(
+                                       self.depcachedir, x, filtered_auxdbkeys,
+                                       gid=portage_gid, db_rw=volatile.database,
+                                       db_ro=self.auxdbmodule)
+               else:
+                       for x in self.porttrees:
+                               # location, label, auxdbkeys
+                               self.auxdb[x] = self.auxdbmodule(
+                                       self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid)
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(["EAPI", "KEYWORDS", "SLOT"])
                self._aux_cache = {}