From: fuzzyray Date: Thu, 13 May 2010 16:07:10 +0000 (-0000) Subject: Replace portage.db[/] with portage.db[portage.root] so that root is not hardcoded X-Git-Tag: gentoolkit-0.3.0_rc11~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2da075929d99f961188efd63dffe6d650c917073;p=gentoolkit.git Replace portage.db[/] with portage.db[portage.root] so that root is not hardcoded svn path=/trunk/gentoolkit/; revision=782 --- diff --git a/bin/glsa-check b/bin/glsa-check index a783c27..a8c0188 100755 --- a/bin/glsa-check +++ b/bin/glsa-check @@ -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"])): diff --git a/pym/gentoolkit/deprecated/helpers.py b/pym/gentoolkit/deprecated/helpers.py index bd5d1bd..59d6a2c 100644 --- a/pym/gentoolkit/deprecated/helpers.py +++ b/pym/gentoolkit/deprecated/helpers.py @@ -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 diff --git a/pym/gentoolkit/glsa/__init__.py b/pym/gentoolkit/glsa/__init__.py index 425faf9..ab03947 100644 --- a/pym/gentoolkit/glsa/__init__.py +++ b/pym/gentoolkit/glsa/__init__.py @@ -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]