diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-02-25 22:28:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-02-25 22:28:00 +0000 |
commit | 32d5fd3a9134c6f3b4de79fa96e52377d87aca45 (patch) | |
tree | bd3f6bc7bd637c0221c9e5319cd2728fb80e8be0 /pym/portage/dbapi/vartree.py | |
parent | 62128295491943aad7e9fcf8bd1ae302c6e60417 (diff) | |
download | portage-32d5fd3a9134c6f3b4de79fa96e52377d87aca45.tar.gz portage-32d5fd3a9134c6f3b4de79fa96e52377d87aca45.tar.bz2 portage-32d5fd3a9134c6f3b4de79fa96e52377d87aca45.zip |
Move merge and unmerge functions to the vartree module.
svn path=/main/trunk/; revision=15468
Diffstat (limited to 'pym/portage/dbapi/vartree.py')
-rw-r--r-- | pym/portage/dbapi/vartree.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index fbbe8176e..0ccc4ddd4 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -4473,6 +4473,38 @@ class dblink(object): "Is this a regular package (does it have a CATEGORY file? A dblink can be virtual *and* regular)" return os.path.exists(os.path.join(self.dbdir, "CATEGORY")) +def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None, + mytree=None, mydbapi=None, vartree=None, prev_mtimes=None, blockers=None, + scheduler=None): + if not os.access(myroot, os.W_OK): + writemsg(_("Permission denied: access('%s', W_OK)\n") % myroot, + noiselevel=-1) + return errno.EACCES + mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree, + vartree=vartree, blockers=blockers, scheduler=scheduler) + return mylink.merge(pkgloc, infloc, myroot, myebuild, + mydbapi=mydbapi, prev_mtimes=prev_mtimes) + +def unmerge(cat, pkg, myroot, mysettings, mytrimworld=1, vartree=None, + ldpath_mtimes=None, scheduler=None): + mylink = dblink(cat, pkg, myroot, mysettings, treetype="vartree", + vartree=vartree, scheduler=scheduler) + vartree = mylink.vartree + try: + mylink.lockdb() + if mylink.exists(): + vartree.dbapi.plib_registry.load() + vartree.dbapi.plib_registry.pruneNonExisting() + retval = mylink.unmerge(trimworld=mytrimworld, cleanup=1, + ldpath_mtimes=ldpath_mtimes) + if retval == os.EX_OK: + mylink.delete() + return retval + return os.EX_OK + finally: + vartree.dbapi.linkmap._clear_cache() + mylink.unlockdb() + def write_contents(contents, root, f): """ Write contents to any file like object. The file will be left open. |