summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-02-25 22:28:00 +0000
committerZac Medico <zmedico@gentoo.org>2010-02-25 22:28:00 +0000
commit32d5fd3a9134c6f3b4de79fa96e52377d87aca45 (patch)
treebd3f6bc7bd637c0221c9e5319cd2728fb80e8be0
parent62128295491943aad7e9fcf8bd1ae302c6e60417 (diff)
downloadportage-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
-rw-r--r--pym/portage/__init__.py34
-rw-r--r--pym/portage/dbapi/vartree.py32
2 files changed, 33 insertions, 33 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 005055a62..a49244e5d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -86,7 +86,7 @@ try:
'portage.dbapi.dep_expand:dep_expand',
'portage.dbapi.porttree:close_portdbapi_caches,FetchlistDict,' + \
'portagetree,portdbapi',
- 'portage.dbapi.vartree:vardbapi,vartree,dblink',
+ 'portage.dbapi.vartree:dblink,merge,unmerge,vardbapi,vartree',
'portage.dbapi.virtual:fakedbapi',
'portage.dep',
'portage.dep:best_match_to_list,dep_getcpv,dep_getkey,' + \
@@ -616,38 +616,6 @@ def _movefile(src, dest, **kwargs):
raise portage.exception.PortageException(
"mv '%s' '%s'" % (src, dest))
-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()
-
auxdbkeys = (
'DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION',
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.