summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-12-26 15:32:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-12-26 15:32:44 +0000
commit53888d1612634475fe0c3b6902a7e5c7de7b73f2 (patch)
treed8c668a9030ec30d492d1d2f0e7bd0cd5bf82149
parentbe9ff7944ea248d94983d9d87031a9e8980064ff (diff)
downloadportage-53888d1612634475fe0c3b6902a7e5c7de7b73f2.tar.gz
portage-53888d1612634475fe0c3b6902a7e5c7de7b73f2.tar.bz2
portage-53888d1612634475fe0c3b6902a7e5c7de7b73f2.zip
Export the ROOT environment variable when using functions that take a <root>
svn path=/main/trunk/; revision=2479
-rwxr-xr-xbin/portageq17
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/portageq b/bin/portageq
index 9ed78b337..0b9f60cc5 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -47,6 +47,7 @@ def has_version(argv):
sys.exit(1)
except KeyError:
sys.exit(1)
+has_version.uses_root = True
def best_version(argv):
@@ -61,6 +62,7 @@ def best_version(argv):
print portage.best(mylist)
except KeyError:
sys.exit(1)
+best_version.uses_root = True
def mass_best_version(argv):
@@ -76,6 +78,7 @@ def mass_best_version(argv):
print pack+":"+portage.best(mylist)
except KeyError:
sys.exit(1)
+mass_best_version.uses_root = True
def best_visible(argv):
@@ -90,6 +93,7 @@ def best_visible(argv):
print portage.best(mylist)
except KeyError:
sys.exit(1)
+best_visible.uses_root = True
def mass_best_visible(argv):
@@ -105,6 +109,7 @@ def mass_best_visible(argv):
print pack+":"+portage.best(mylist)
except KeyError:
sys.exit(1)
+mass_best_visible.uses_root = True
def all_best_visible(argv):
@@ -119,6 +124,8 @@ def all_best_visible(argv):
mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg))
if mybest:
print mybest
+all_best_visible.uses_root = True
+
def match(argv):
"""<root> <category/package>
@@ -131,6 +138,7 @@ def match(argv):
print string.join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]),"\n")
except KeyError:
sys.exit(1)
+match.uses_root = True
def vdb_path(argv):
@@ -140,6 +148,7 @@ def vdb_path(argv):
"""
print portage.root+portage.VDB_PATH
+
def gentoo_mirrors(argv):
"""
Returns the mirrors set to use in the portage configuration.
@@ -255,13 +264,13 @@ def main():
usage(sys.argv)
sys.exit()
- # no more fatties
- global portage
- import portage
-
cmd = sys.argv[1]
try:
function = globals()[cmd]
+ if getattr(function, "uses_root", False) and len(sys.argv) > 2:
+ os.environ["ROOT"] = sys.argv[2]
+ global portage
+ import portage
function(sys.argv[2:])
except KeyError:
usage(sys.argv)