Pass a vardbapi instance into getportageversion() so that it doesn't have to construc...
authorZac Medico <zmedico@gentoo.org>
Thu, 29 Jun 2006 05:11:47 +0000 (05:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 29 Jun 2006 05:11:47 +0000 (05:11 -0000)
svn path=/main/trunk/; revision=3691

bin/emerge

index 7d8eb79b531d3cdbd487bdd353db55863250f82c..a9b131c2aa950f5cc1d040125a468fee9919c601 100755 (executable)
@@ -305,7 +305,7 @@ def getgccversion(chost):
        portage.writemsg(gcc_not_found_error, noiselevel=-1)
        return "[unavailable]"
 
-def getportageversion(portdir, target_root, profile, chost):
+def getportageversion(portdir, target_root, profile, chost, vardb):
        try:
                import re
                profilever = os.path.normpath("///"+os.readlink(profile))
@@ -318,8 +318,8 @@ def getportageversion(portdir, target_root, profile, chost):
        except (OSError,IOError):
                profilever="unavailable"
        libcver=[]
-       libclist  = portage.vardbapi(target_root).match("virtual/libc")
-       libclist += portage.vardbapi(target_root).match("virtual/glibc")
+       libclist  = vardb.match("virtual/libc")
+       libclist += vardb.match("virtual/glibc")
        libclist  = portage_util.unique_array(libclist)
        for x in libclist:
                xs=portage.catpkgsplit(x)
@@ -3015,8 +3015,10 @@ def action_config(myopts, myfiles):
 def action_info(myopts):
        unameout=commands.getstatusoutput("uname -mrp")[1]
        settings = portage.settings
+       trees = portage.db
        print getportageversion(settings["PORTDIR"], settings["ROOT"],
-               settings.profile_path, settings["CHOST"])
+               settings.profile_path, settings["CHOST"],
+               trees[settings["ROOT"]]["vartree"].dbapi)
        print "================================================================="
        print "System uname: "+unameout
        if os.path.exists("/etc/gentoo-release"):
@@ -3719,7 +3721,8 @@ def emerge_main():
        if "--version" in myopts:
                settings = portage.settings
                print getportageversion(settings["PORTDIR"], settings["ROOT"],
-                       settings.profile_path, settings["CHOST"])
+                       settings.profile_path, settings["CHOST"],
+                       trees[settings["ROOT"]]["vartree"].dbapi)
                sys.exit(0)
        elif "--help" in myopts:
                emergehelp.help(myaction, myopts, havecolor)