Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13263 - main/trunk/bin
Date: Tue, 31 Mar 2009 22:16:53
Message-Id: E1LomGK-0007Bc-7R@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-03-31 22:16:51 +0000 (Tue, 31 Mar 2009)
3 New Revision: 13263
4
5 Modified:
6 main/trunk/bin/egencache
7 Log:
8 Add parsing code for --jobs and --load-average.
9
10
11 Modified: main/trunk/bin/egencache
12 ===================================================================
13 --- main/trunk/bin/egencache 2009-03-31 20:14:03 UTC (rev 13262)
14 +++ main/trunk/bin/egencache 2009-03-31 22:16:51 UTC (rev 13263)
15 @@ -56,6 +56,37 @@
16 parser.error('No action specified (--update ' + \
17 'is the only available action)')
18
19 + if options.jobs:
20 + jobs = None
21 + try:
22 + jobs = int(options.jobs)
23 + except ValueError:
24 + jobs = -1
25 +
26 + if jobs < 1:
27 + parser.error("Invalid: --jobs='%s'" % \
28 + (options.jobs,))
29 +
30 + options.jobs = jobs
31 +
32 + else:
33 + options.jobs = None
34 +
35 + if options.load_average:
36 + try:
37 + load_average = float(options.load_average)
38 + except ValueError:
39 + load_average = 0.0
40 +
41 + if load_average <= 0.0:
42 + parser.error("Invalid: --load-average='%s'" % \
43 + (options.load_average,))
44 +
45 + options.load_average = load_average
46 +
47 + else:
48 + options.load_average = None
49 +
50 if options.config_root is not None and \
51 not os.path.isdir(options.config_root):
52 parser.error("Not a directory: --config-root='%s'" % \