diff options
author | Marius Mauch <genone@gentoo.org> | 2007-01-03 02:46:58 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2007-01-03 02:46:58 +0000 |
commit | 758658576434647805d21f97f1f1dc3a5e163df9 (patch) | |
tree | c7fbe78225eb3e4dcac43d74d853ee11a7f64ed9 /pym/dbapi/binpkg.py | |
parent | cf63c3d7170030bfb09f4eb3288406ec052179a6 (diff) | |
download | portage-758658576434647805d21f97f1f1dc3a5e163df9.tar.gz portage-758658576434647805d21f97f1f1dc3a5e163df9.tar.bz2 portage-758658576434647805d21f97f1f1dc3a5e163df9.zip |
Allow - in elog module names
svn path=/main/trunk/; revision=5450
Diffstat (limited to 'pym/dbapi/binpkg.py')
-rw-r--r-- | pym/dbapi/binpkg.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/pym/dbapi/binpkg.py b/pym/dbapi/binpkg.py new file mode 100644 index 000000000..f3ee215be --- /dev/null +++ b/pym/dbapi/binpkg.py @@ -0,0 +1,65 @@ +from dbapi.fake import fakedbapi +from portage import settings +import xpak, os + +class bindbapi(fakedbapi): + def __init__(self, mybintree=None, settings=None): + self.bintree = mybintree + self.cpvdict={} + self.cpdict={} + if settings is None: + settings = globals()["settings"] + self.settings = settings + self._match_cache = {} + + def match(self, *pargs, **kwargs): + if self.bintree and not self.bintree.populated: + self.bintree.populate() + return fakedbapi.match(self, *pargs, **kwargs) + + def aux_get(self,mycpv,wants): + if self.bintree and not self.bintree.populated: + self.bintree.populate() + mysplit = mycpv.split("/") + mylist = [] + tbz2name = mysplit[1]+".tbz2" + if self.bintree and not self.bintree.isremote(mycpv): + tbz2 = xpak.tbz2(self.bintree.getname(mycpv)) + for x in wants: + if self.bintree and self.bintree.isremote(mycpv): + # We use the cache for remote packages + mylist.append(" ".join( + self.bintree.remotepkgs[tbz2name].get(x,"").split())) + else: + myval = tbz2.getfile(x) + if myval is None: + myval = "" + else: + myval = " ".join(myval.split()) + mylist.append(myval) + if "EAPI" in wants: + idx = wants.index("EAPI") + if not mylist[idx]: + mylist[idx] = "0" + return mylist + + def aux_update(self, cpv, values): + if not self.bintree.populated: + self.bintree.populate() + tbz2path = self.bintree.getname(cpv) + if not os.path.exists(tbz2path): + raise KeyError(cpv) + mytbz2 = xpak.tbz2(tbz2path) + mydata = mytbz2.get_data() + mydata.update(values) + mytbz2.recompose_mem(xpak.xpak_mem(mydata)) + + def cp_list(self, *pargs, **kwargs): + if not self.bintree.populated: + self.bintree.populate() + return fakedbapi.cp_list(self, *pargs, **kwargs) + + def cpv_all(self): + if not self.bintree.populated: + self.bintree.populate() + return fakedbapi.cpv_all(self) |