Use new vardbapi lock function in FakeVartree.
authorDavid James <davidjames@chromium.org>
Sun, 8 May 2011 06:08:01 +0000 (23:08 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 8 May 2011 06:24:18 +0000 (23:24 -0700)
BUG=none
TEST=Merged some packages with new code. Ran test suite.

Change-Id: Ibb9380122631bf6c79e39691233cfd641931b75a

pym/_emerge/FakeVartree.py

index fa490c2d6e8f880321cb5c525552621faf5ba79a..ff092adfe8687987c594b7c1b7a94abeeee7c643 100644 (file)
@@ -119,20 +119,15 @@ class FakeVartree(vartree):
                after one or more packages may have been installed or
                uninstalled.
                """
-               vdb_path = os.path.join(self.settings['EROOT'], portage.VDB_PATH)
+               locked = False
                try:
-                       # At least the parent needs to exist for the lock file.
-                       portage.util.ensure_dirs(vdb_path)
-               except portage.exception.PortageException:
-                       pass
-               vdb_lock = None
-               try:
-                       if acquire_lock and os.access(vdb_path, os.W_OK):
-                               vdb_lock = portage.locks.lockdir(vdb_path)
+                       if acquire_lock and os.access(self._real_vardb._dbroot, os.W_OK):
+                               self._real_vardb.lock()
+                               locked = True
                        self._sync()
                finally:
-                       if vdb_lock:
-                               portage.locks.unlockdir(vdb_lock)
+                       if locked:
+                               self._real_vardb.unlock()
 
                # Populate the old-style virtuals using the cached values.
                # Skip the aux_get wrapper here, to avoid unwanted