summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-31 22:16:51 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-31 22:16:51 +0000
commit628e22b357c0561abb0d3c09b0debe119853524d (patch)
treeec774477aebc948c992ff14b6c46bedf6f4f9970
parent98961815eda7c7ff44cfca3643d8b280f3873d47 (diff)
downloadportage-628e22b357c0561abb0d3c09b0debe119853524d.tar.gz
portage-628e22b357c0561abb0d3c09b0debe119853524d.tar.bz2
portage-628e22b357c0561abb0d3c09b0debe119853524d.zip
Add parsing code for --jobs and --load-average.
svn path=/main/trunk/; revision=13263
-rwxr-xr-xbin/egencache31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/egencache b/bin/egencache
index e8981deba..c7b73c98c 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -56,6 +56,37 @@ def parse_args(args):
parser.error('No action specified (--update ' + \
'is the only available action)')
+ if options.jobs:
+ jobs = None
+ try:
+ jobs = int(options.jobs)
+ except ValueError:
+ jobs = -1
+
+ if jobs < 1:
+ parser.error("Invalid: --jobs='%s'" % \
+ (options.jobs,))
+
+ options.jobs = jobs
+
+ else:
+ options.jobs = None
+
+ if options.load_average:
+ try:
+ load_average = float(options.load_average)
+ except ValueError:
+ load_average = 0.0
+
+ if load_average <= 0.0:
+ parser.error("Invalid: --load-average='%s'" % \
+ (options.load_average,))
+
+ options.load_average = load_average
+
+ else:
+ options.load_average = None
+
if options.config_root is not None and \
not os.path.isdir(options.config_root):
parser.error("Not a directory: --config-root='%s'" % \