Replace portage.db[/] with portage.db[portage.root] so that root is not hardcoded
authorfuzzyray <fuzzyray@gentoo.org>
Thu, 13 May 2010 16:07:10 +0000 (16:07 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Thu, 13 May 2010 16:07:10 +0000 (16:07 -0000)
svn path=/trunk/gentoolkit/; revision=782

bin/glsa-check
pym/gentoolkit/deprecated/helpers.py
pym/gentoolkit/glsa/__init__.py

index a783c27b1d01d384f6a2c4c36b32a9292a71049d..a8c018888dc9ae80e6b55e79e8b8bd4d723a0381 100755 (executable)
@@ -148,8 +148,8 @@ glsaconfig = checkconfig(portage.config(clone=portage.settings))
 if quiet:
     glsaconfig["EMERGE_OPTS"] += " --quiet"
 
-vardb = portage.db["/"]["vartree"].dbapi
-portdb = portage.db["/"]["porttree"].dbapi
+vardb = portage.db[portage.root]["vartree"].dbapi
+portdb = portage.db[portage.root]["porttree"].dbapi
 
 # Check that we really have a glsa dir to work on
 if not (os.path.exists(glsaconfig["GLSA_DIR"]) and os.path.isdir(glsaconfig["GLSA_DIR"])):
index bd5d1bdbd5138d7922d5fd9911716b98d09464bf..59d6a2c427c087bd43b54283a98f0dbb015b3e6c 100644 (file)
@@ -25,22 +25,22 @@ def find_packages(search_key, masked=False):
        warnings.warn("Deprecated. Use helpers2.find_packages.", DeprecationWarning)
        try:
                if masked:
-                       t = portage.db["/"]["porttree"].dbapi.xmatch("match-all", search_key)
-                       t += portage.db["/"]["vartree"].dbapi.match(search_key)
+                       t = portage.db[portage.root]["porttree"].dbapi.xmatch("match-all", search_key)
+                       t += portage.db[portage.root]["vartree"].dbapi.match(search_key)
                else:
-                       t = portage.db["/"]["porttree"].dbapi.match(search_key)
-                       t += portage.db["/"]["vartree"].dbapi.match(search_key)
+                       t = portage.db[portage.root]["porttree"].dbapi.match(search_key)
+                       t += portage.db[portage.root]["vartree"].dbapi.match(search_key)
        # catch the "amgigous package" Exception
        except ValueError as e:
                if isinstance(e[0],list):
                        t = []
                        for cp in e[0]:
                                if masked:
-                                       t += portage.db["/"]["porttree"].dbapi.xmatch("match-all", cp)
-                                       t += portage.db["/"]["vartree"].dbapi.match(cp)
+                                       t += portage.db[portage.root]["porttree"].dbapi.xmatch("match-all", cp)
+                                       t += portage.db[portage.root]["vartree"].dbapi.match(cp)
                                else:
-                                       t += portage.db["/"]["porttree"].dbapi.match(cp)
-                                       t += portage.db["/"]["vartree"].dbapi.match(cp)
+                                       t += portage.db[portage.root]["porttree"].dbapi.match(cp)
+                                       t += portage.db[portage.root]["vartree"].dbapi.match(cp)
                else:
                        raise ValueError(e)
        except portage_exception.InvalidAtom as e:
@@ -56,13 +56,13 @@ def find_installed_packages(search_key, masked=False):
        warnings.warn("Deprecated. Use helpers2.find_installed_packages.",
                DeprecationWarning)
        try:
-                       t = portage.db["/"]["vartree"].dbapi.match(search_key)
+                       t = portage.db[portage.root]["vartree"].dbapi.match(search_key)
        # catch the "amgigous package" Exception
        except ValueError as e:
                if isinstance(e[0],list):
                        t = []
                        for cp in e[0]:
-                               t += portage.db["/"]["vartree"].dbapi.match(cp)
+                               t += portage.db[portage.root]["vartree"].dbapi.match(cp)
                else:
                        raise ValueError(e)
        except portage_exception.InvalidAtom as e:
@@ -75,7 +75,7 @@ def find_best_match(search_key):
        matched the search key."""
        warnings.warn("Deprecated. Use helpers2.find_best_match.",
                DeprecationWarning)
-       t = portage.db["/"]["porttree"].dep_bestmatch(search_key)
+       t = portage.db[portage.root]["porttree"].dep_bestmatch(search_key)
        if t:
                return Package(t)
        return None
index 425faf96e4689115a6f86b778a00364891b5863f..ab0394785c7bffb9b51a5c8687166880b3a38867 100644 (file)
@@ -336,7 +336,7 @@ def match(atom, portdbname, match_type="default"):
        @rtype:         list of strings
        @return:        a list with the matching versions
        """
-       db = portage.db["/"][portdbname].dbapi
+       db = portage.db[portage.root][portdbname].dbapi
        if atom[2] == "~":
                return revisionMatch(atom, db, match_type=match_type)
        elif match_type == "default" or not hasattr(db, "xmatch"):
@@ -430,7 +430,7 @@ def getMinUpgrade(vulnerableList, unaffectedList, minimize=True):
                        if portage.pkgcmp(c_pv[1:], i_pv[1:]) > 0 \
                                        and (update == "" \
                                                or (minimize ^ (portage.pkgcmp(c_pv[1:], portage.catpkgsplit(update)[1:]) > 0))) \
-                                       and portage.db["/"]["porttree"].dbapi.aux_get(c, ["SLOT"]) == portage.db["/"]["vartree"].dbapi.aux_get(vuln, ["SLOT"]):
+                                       and portage.db[portage.root]["porttree"].dbapi.aux_get(c, ["SLOT"]) == portage.db[portage.root]["vartree"].dbapi.aux_get(vuln, ["SLOT"]):
                                update = c_pv[0]+"/"+c_pv[1]+"-"+c_pv[2]
                                if c_pv[3] != "r0":             # we don't like -r0 for display
                                        update += "-"+c_pv[3]