summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-20 08:29:10 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-20 08:29:10 +0000
commit405fb754c25ca41a3797a3eeaddc581d778217e0 (patch)
treeb624666c53350b976843ec0fdc215dfd46f1c6b9
parent480c356b9553d9cc144d4ea11e2db7cae59acac3 (diff)
downloadportage-405fb754c25ca41a3797a3eeaddc581d778217e0.tar.gz
portage-405fb754c25ca41a3797a3eeaddc581d778217e0.tar.bz2
portage-405fb754c25ca41a3797a3eeaddc581d778217e0.zip
Enable PORTAGE_CONFIGROOT to be set via an new --config-root option. Thanks to Daniel Barkalow <barkalow@iabervon.org> for the initial patch (submitted on the gentoo-portage-dev mailing list).
svn path=/main/trunk/; revision=5107
-rwxr-xr-xbin/emerge18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/emerge b/bin/emerge
index b99d897da..9f3d38670 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -4197,7 +4197,7 @@ def multiple_actions(action1, action2):
sys.stderr.write("!!! '%s' or '%s'\n\n" % (action1, action2))
sys.exit(1)
-def parse_opts(tmpcmdline):
+def parse_opts(tmpcmdline, silent=False):
myaction=None
myopts = {}
myfiles=[]
@@ -4206,6 +4206,10 @@ def parse_opts(tmpcmdline):
longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"}
argument_options = {
+ "--config-root": {
+ "help":"specify the location for portage configuration files",
+ "action":"store"
+ },
"--color": {
"help":"enable or disable color output",
"type":"choice",
@@ -4272,7 +4276,9 @@ def parse_opts(tmpcmdline):
myfiles.append(x)
if "--nocolor" in myopts:
- print "*** Deprecated use of '--nocolor', use '--color=n' instead."
+ if not silent:
+ sys.stderr.write("*** Deprecated use of '--nocolor', " + \
+ "use '--color=n' instead.\n")
del myopts["--nocolor"]
myopts["--color"] = "n"
@@ -4391,6 +4397,14 @@ def adjust_config(myopts, settings):
settings.backup_changes("NOCOLOR")
def emerge_main():
+ # This first pass is just for options that need to be known as early as
+ # possible, such as --config-root. They will be parsed again later,
+ # together with EMERGE_DEFAULT_OPTS (which may vary depending on the
+ # the value of --config-root).
+ myaction, myopts, myfiles = parse_opts(sys.argv[1:], silent=True)
+ if "--config-root" in myopts:
+ os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"]
+
# Portage needs to ensure a sane umask for the files it creates.
os.umask(022)
settings, trees, mtimedb = load_emerge_config()