summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-30 06:53:14 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-30 06:53:14 +0000
commit0a79d68038f10265760ce6650da5a7f9ef5da7c2 (patch)
tree989add0757a0810a85880d1096fb70af87641732
parentAdd a new egencache --rsync option which enables a stat collision workaround (diff)
downloadportage-multirepo-0a79d68038f10265760ce6650da5a7f9ef5da7c2.tar.gz
portage-multirepo-0a79d68038f10265760ce6650da5a7f9ef5da7c2.tar.bz2
portage-multirepo-0a79d68038f10265760ce6650da5a7f9ef5da7c2.zip
Add parsing code for --jobs and --load-average. (trunk r13263)
svn path=/main/branches/2.1.6/; revision=13442
-rwxr-xr-xbin/egencache31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/egencache b/bin/egencache
index e8981deb..c7b73c98 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'" % \