Pass a config instance into the bindbapi and fakedbapi constructors in order to avoid...
authorZac Medico <zmedico@gentoo.org>
Fri, 30 Jun 2006 10:10:06 +0000 (10:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 30 Jun 2006 10:10:06 +0000 (10:10 -0000)
svn path=/main/trunk/; revision=3716

bin/emerge
pym/portage.py

index fc11cfb97543d9b8cd9c5767c05bb4425cc32cc7..6bde09bc1c4ca7aafa71883b325a39e448ef84f0 100755 (executable)
@@ -618,12 +618,12 @@ class depgraph:
                self.orderedkeys=[]
                self.outdatedpackages=[]
                self.mydbapi={}
-               self.mydbapi["/"] = portage.fakedbapi()
+               self.mydbapi["/"] = portage.fakedbapi(settings=settings)
                if "empty" not in self.myparams or settings["ROOT"] != "/":
                        for pkg in self.trees["/"]["vartree"].getallcpv():
                                self.mydbapi["/"].cpv_inject(pkg)
                if settings["ROOT"] != "/":
-                       self.mydbapi[settings["ROOT"]] = portage.fakedbapi()
+                       self.mydbapi[settings["ROOT"]] = portage.fakedbapi(settings=settings)
                        if "empty" not in self.myparams:
                                for pkg in self.trees[settings["ROOT"]]["vartree"].getallcpv():
                                        self.mydbapi[settings["ROOT"]].cpv_inject(pkg)
index e7bb750bb7c29e92d38c6a2d1b86d18ef014d3a7..f82045fcf939bdc445a6279bdb3580fe5d1519d7 100644 (file)
@@ -4143,7 +4143,7 @@ class dbapi:
                raise NotImplementedError
 
        def match(self,origdep,use_cache=1):
-               mydep=dep_expand(origdep,mydb=self)
+               mydep = dep_expand(origdep, mydb=self, settings=self.settings)
                mykey=dep_getkey(mydep)
                mycat=mykey.split("/")[0]
                return match_from_list(mydep,self.cp_list(mykey,use_cache=use_cache))
@@ -4170,9 +4170,12 @@ class dbapi:
 
 class fakedbapi(dbapi):
        "This is a dbapi to use for the emptytree function.  It's empty, but things can be added to it."
-       def __init__(self):
+       def __init__(self, settings=None):
                self.cpvdict={}
                self.cpdict={}
+               if settings is None:
+                       settings = globals()["settings"]
+               self.settings = settings
 
        def cpv_exists(self,mycpv):
                return self.cpvdict.has_key(mycpv)
@@ -4221,10 +4224,13 @@ class fakedbapi(dbapi):
                        del self.cpdict[mycp]
 
 class bindbapi(fakedbapi):
-       def __init__(self,mybintree=None):
+       def __init__(self, mybintree=None, settings=None):
                self.bintree = mybintree
                self.cpvdict={}
                self.cpdict={}
+               if settings is None:
+                       settings = globals()["settings"]
+               self.settings = settings
 
        def match(self, *pargs, **kwargs):
                if self.bintree and not self.bintree.populated:
@@ -5444,7 +5450,7 @@ class binarytree(packagetree):
                        self.root=root
                        #self.pkgdir=settings["PKGDIR"]
                        self.pkgdir=pkgdir
-                       self.dbapi=bindbapi(self)
+                       self.dbapi = bindbapi(self, settings=settings)
                        self.populated=0
                        self.tree={}
                        self.remotepkgs={}