diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-31 21:07:11 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-31 21:07:11 +0000 |
commit | d9a9f08fc3a80bba3332267e13ed9409530c50ec (patch) | |
tree | 097dc620e5d7661a73223809bafe8d67223342c9 | |
parent | f53b2ac56d4b5415dc3febff891a5cfd58c21b89 (diff) | |
download | portage-d9a9f08fc3a80bba3332267e13ed9409530c50ec.tar.gz portage-d9a9f08fc3a80bba3332267e13ed9409530c50ec.tar.bz2 portage-d9a9f08fc3a80bba3332267e13ed9409530c50ec.zip |
Replace deprecated binarytree.remotepkgs usage with binarytree._remotepkgs since the former is vulnerable to collisions in the tbz2 filename.
svn path=/main/trunk/; revision=6697
-rw-r--r-- | pym/portage/dbapi/bintree.py | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 51d565489..d6c4b1418 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -43,11 +43,12 @@ class bindbapi(fakedbapi): mysplit = mycpv.split("/") mylist = [] tbz2name = mysplit[1]+".tbz2" - if self.bintree and not self.bintree.isremote(mycpv): - tbz2 = portage.xpak.tbz2(self.bintree.getname(mycpv)) - getitem = tbz2.getfile + if not self.bintree._remotepkgs or \ + not self.bintree.isremote(mycpv): + tbz2_path = self.bintree.getname(mycpv) + getitem = portage.xpak.tbz2(tbz2_path).getfile else: - getitem = self.bintree.remotepkgs[tbz2name].get + getitem = self.bintree._remotepkgs[mycpv].get mydata = {} mykeys = wants if cache_me: @@ -535,12 +536,8 @@ class binarytree(object): self._remotepkgs = pkgindex.packages self._remote_has_index = True self.remotepkgs = {} - for cpv, metadata in self._remotepkgs.iteritems(): + for cpv in self._remotepkgs: self.dbapi.cpv_inject(cpv) - cat, pf = catsplit(cpv) - # backward compat - self.remotepkgs[pf+".tbz2"] = metadata - metadata["CATEGORY"] = cat self.populated = 1 return self._remotepkgs = {} @@ -739,16 +736,14 @@ class binarytree(object): def isremote(self, pkgname): "Returns true if the package is kept remotely." - mysplit = pkgname.split("/") - remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+".tbz2") + remote = pkgname in self._remotepkgs and \ + not os.path.exists(self.getname(pkgname)) return remote def get_use(self, pkgname): - mysplit=pkgname.split("/") - if self.isremote(pkgname): - return self.remotepkgs[mysplit[1]+".tbz2"]["USE"][:].split() - tbz2=portage.xpak.tbz2(self.getname(pkgname)) - return tbz2.getfile("USE").split() + writemsg("deprecated use of binarytree.get_use()," + \ + " use dbapi.aux_get() instead", noiselevel=-1) + return self.dbapi.aux_get(pkgname, ["USE"])[0].split() def gettbz2(self, pkgname): "fetches the package from a remote site, if necessary." |