Use vardbapi.lock() where applicable.
authorZac Medico <zmedico@gentoo.org>
Sun, 15 May 2011 05:21:08 +0000 (22:21 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 15 May 2011 05:21:08 +0000 (22:21 -0700)
pym/_emerge/main.py
pym/_emerge/unmerge.py

index 38afe7dfdfddc26a62aaa5f8f0d13267155f2a03..ee0fc4ed069cd6755934754888fb54ae72953ca5 100644 (file)
@@ -356,7 +356,8 @@ def post_emerge(myaction, myopts, myfiles,
        portage.util.ensure_dirs(vdb_path)
        vdb_lock = None
        if os.access(vdb_path, os.W_OK) and not "--pretend" in myopts:
-               vdb_lock = portage.locks.lockdir(vdb_path)
+               vardbapi.lock()
+               vdb_lock = True
 
        if vdb_lock:
                try:
@@ -366,7 +367,7 @@ def post_emerge(myaction, myopts, myfiles,
                        mtimedb.commit()
                finally:
                        if vdb_lock:
-                               portage.locks.unlockdir(vdb_lock)
+                               vardbapi.unlock()
 
        chk_updated_cfg_files(settings['EROOT'], config_protect)
 
index 8fff516c163ce9a21c64ac75f2db3b18c7a4b767..53317449949eee81c79d513667f5dba4cabb4fac 100644 (file)
@@ -11,6 +11,7 @@ from portage import os
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.output import bold, colorize, darkgreen, green
 from portage._sets import SETPREFIX
+from portage._sets.base import EditablePackageSet
 from portage.util import cmp_sort_key
 
 from _emerge.emergelog import emergelog
@@ -57,7 +58,8 @@ def unmerge(root_config, myopts, unmerge_action,
        vdb_lock = None
        try:
                if os.access(vdb_path, os.W_OK):
-                       vdb_lock = portage.locks.lockdir(vdb_path)
+                       vartree.dbapi.lock()
+                       vdb_lock = True
 
                realsyslist = []
                for x in sets["system"].getAtoms():
@@ -293,10 +295,8 @@ def unmerge(root_config, myopts, unmerge_action,
        finally:
                if vdb_lock:
                        vartree.dbapi.flush_cache()
-                       portage.locks.unlockdir(vdb_lock)
-       
-       from portage._sets.base import EditablePackageSet
-       
+                       vartree.dbapi.unlock()
+
        # generate a list of package sets that are directly or indirectly listed in "selected",
        # as there is no persistent list of "installed" sets
        installed_sets = ["selected"]