Ensure that the root of the vdb exists before attempting to lock it. Thanks to Flame...
authorZac Medico <zmedico@gentoo.org>
Mon, 11 Dec 2006 01:24:34 +0000 (01:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 11 Dec 2006 01:24:34 +0000 (01:24 -0000)
svn path=/main/trunk/; revision=5267

bin/emerge
pym/portage.py

index 93ec0706b0a0680a988967c990a29f46f90dfc86..326c6c57c4e7e229bfce7d2aa7abdb25b3c04396 100755 (executable)
@@ -715,6 +715,11 @@ class FakeVartree(portage.vartree):
                self.settings = real_vartree.settings
                self.dbapi = portage.fakedbapi(settings=real_vartree.settings)
                vdb_path = os.path.join(self.root, portage.VDB_PATH)
+               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 os.access(vdb_path, os.W_OK):
@@ -2759,6 +2764,11 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files,
        xterm_titles = "notitles" not in settings.features
 
        vdb_path = os.path.join(settings["ROOT"], portage.VDB_PATH)
+       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 os.access(vdb_path, os.W_OK):
index 96a1ca4664b56df0195a24d52efd1e583027a2f9..2dc16e016dee8c840da150967fa8b49d7cbc9368 100644 (file)
@@ -6201,6 +6201,8 @@ class dblink:
        def lockdb(self):
                if self._lock_vdb:
                        raise AssertionError("Lock already held.")
+               # At least the parent needs to exist for the lock file.
+               portage_util.ensure_dirs(self.dbroot)
                self._lock_vdb = portage_locks.lockdir(self.dbroot)
 
        def unlockdb(self):