diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-04-11 01:37:51 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-04-11 01:37:51 +0000 |
commit | 80b45c986dcf8eeb4ffe3e110239fc64b3211282 (patch) | |
tree | fa1369c614d95dd37414584bb20bf6c89d1aaf89 | |
parent | 59b7169a0532711be7a5fa1ac4d02880408c8f1f (diff) | |
download | portage-80b45c986dcf8eeb4ffe3e110239fc64b3211282.tar.gz portage-80b45c986dcf8eeb4ffe3e110239fc64b3211282.tar.bz2 portage-80b45c986dcf8eeb4ffe3e110239fc64b3211282.zip |
Fix FetchlistDict so usage of global portdb leaves portdb.porttrees intact.
svn path=/main/trunk/; revision=3119
-rw-r--r-- | pym/portage.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pym/portage.py b/pym/portage.py index 2d4963da0..367f43544 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2103,9 +2103,9 @@ def digestParseFile(myfilename,mysettings=None,db=None): mysplit = myfilename.split(os.sep) if mysplit[-2] == "files" and mysplit[-1].startswith("digest-"): - pkgdir = os.sep+os.sep.join(mysplit[:-2]) + pkgdir = os.sep + os.sep.join(mysplit[:-2]).strip(os.sep) elif mysplit[-1] == "Manifest": - pkgdir = os.sep+os.sep.join(mysplit[:-1]) + pkgdir = os.sep + os.sep.join(mysplit[:-1]).strip(os.sep) if db is None: db = portagetree().dbapi @@ -6360,13 +6360,17 @@ class FetchlistDict(UserDict.DictMixin): self.pkgdir = pkgdir self.cp = os.sep.join(pkgdir.split(os.sep)[-2:]) self.settings = settings - self.db = portagetree().dbapi - porttree = os.sep + os.path.normpath(os.path.dirname(os.path.dirname(pkgdir))).strip(os.sep) - # This ensures that the fetchlist comes from the correct portage tree. - self.db.porttrees = [porttree] + self.porttrees = [os.path.dirname(os.path.dirname(pkgdir))] def __getitem__(self, pkg_key): """Returns the complete fetch list for a given package.""" - return self.db.getfetchlist(pkg_key, mysettings=self.settings, all=True)[1] + global portdb # has the global auxdb caches + all_trees = portdb.porttrees + # This ensures that the fetchlist comes from the correct portage tree. + portdb.porttrees = self.porttrees + fetchlist = portdb.getfetchlist(pkg_key, mysettings=self.settings, all=True)[1] + # XXX The db is global so we restore it's trees back to their original state. + portdb.porttrees = all_trees + return fetchlist def has_key(self, pkg_key): """Returns true if the given package exists within pkgdir.""" return pkg_key in self.keys() |