summaryrefslogtreecommitdiffstats
path: root/bin/egencache
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-01 00:08:06 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-01 00:08:06 +0000
commit358a34b09b6f8213442564fbe087fa2a0f5d5a46 (patch)
tree8f475853fe1f18a8458496721bfb481be1e27b19 /bin/egencache
parent7c13a2840a41766716f76bc6a0dc4bb3fa3dfa20 (diff)
downloadportage-358a34b09b6f8213442564fbe087fa2a0f5d5a46.tar.gz
portage-358a34b09b6f8213442564fbe087fa2a0f5d5a46.tar.bz2
portage-358a34b09b6f8213442564fbe087fa2a0f5d5a46.zip
Add support for a EGENCACHE_DEFAULT_OPTS variable in make.conf.
svn path=/main/trunk/; revision=13266
Diffstat (limited to 'bin/egencache')
-rwxr-xr-xbin/egencache36
1 files changed, 28 insertions, 8 deletions
diff --git a/bin/egencache b/bin/egencache
index 3c4894612..66af2a75a 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -50,12 +50,11 @@ def parse_args(args):
action="store_true",
help="enable rsync stat collision workaround " + \
"for bug 139134 (use with --update)")
+ parser.add_option("--ignore-default-opts",
+ action="store_true",
+ help="do not use the EGENCACHE_DEFAULT_OPTS environment variable")
options, args = parser.parse_args(args)
- if not options.update:
- parser.error('No action specified (--update ' + \
- 'is the only available action)')
-
if options.jobs:
jobs = None
try:
@@ -105,7 +104,7 @@ def parse_args(args):
if str(atom) != atom.cp:
parser.error('Atom is too specific: %s' % (atom,))
- return options, args
+ return parser, options, args
class GenCache(object):
def __init__(self, portdb, cp_iter=None, max_jobs=None, max_load=None,
@@ -223,7 +222,7 @@ class GenCache(object):
level=logging.ERROR, noiselevel=-1)
def egencache_main(args):
- options, args = parse_args(args)
+ parser, options, atoms = parse_args(args)
config_root = options.config_root
if config_root is None:
@@ -242,6 +241,27 @@ def egencache_main(args):
settings = portage.config(config_root=config_root,
target_root='/', env=env)
+ default_opts = None
+ if not options.ignore_default_opts:
+ default_opts = settings.get('EGENCACHE_DEFAULT_OPTS', '').split()
+
+ if default_opts:
+ parser, options, args = parse_args(default_opts + args)
+
+ if options.config_root is not None:
+ config_root = options.config_root
+
+ if options.cache_dir is not None:
+ env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
+
+ settings = portage.config(config_root=config_root,
+ target_root='/', env=env)
+
+ if not options.update:
+ parser.error('No action specified (--update ' + \
+ 'is the only available action)')
+ return 1
+
if 'metadata-transfer' not in settings.features:
writemsg_level("ecachegen: warning: " + \
"automatically enabling FEATURES=metadata-transfer\n",
@@ -255,8 +275,8 @@ def egencache_main(args):
portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings)
cp_iter = None
- if args:
- cp_iter = iter(args)
+ if atoms:
+ cp_iter = iter(atoms)
gen_cache = GenCache(portdb, cp_iter=cp_iter,
max_jobs=options.jobs,