From dff59172ed7a5f86302e873d1611961966aa35c3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 11 Dec 2006 01:24:34 +0000 Subject: [PATCH] Ensure that the root of the vdb exists before attempting to lock it. Thanks to Flameeyes for reporting. svn path=/main/trunk/; revision=5267 --- bin/emerge | 10 ++++++++++ pym/portage.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/bin/emerge b/bin/emerge index 93ec0706b..326c6c57c 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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): diff --git a/pym/portage.py b/pym/portage.py index 96a1ca466..2dc16e016 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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): -- 2.26.2