diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-04-05 21:42:26 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-05 22:23:00 +0200 |
commit | a6c52990f925a3790afc2601e31053b44fdac565 (patch) | |
tree | 2045f374f3e328993d99b67e1e8469996e58ec59 | |
parent | eba90886a712ffa1fd0ed03b7caaf1fee800f24f (diff) |
ckmake: fix getting number of CPUs
The code to get the number of CPUs is wrong, it finds the
maximum *string* between the CPUs and then converts it to
an integer after that -- fix that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rwxr-xr-x | devel/ckmake | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/devel/ckmake b/devel/ckmake index 0b680b6f..aae99b78 100755 --- a/devel/ckmake +++ b/devel/ckmake @@ -183,7 +183,7 @@ def cpu_info_build_jobs(): if not os.path.exists('/proc/cpuinfo'): return 1 f = open('/proc/cpuinfo', 'r') - max_cpus = 1 + max_cpu = 1 for line in f: m = re.match(r"(?P<PROC>processor\s*:)\s*" \ "(?P<NUM>\d+)", @@ -191,9 +191,10 @@ def cpu_info_build_jobs(): if not m: continue proc_specs = m.groupdict() - if (proc_specs['NUM'] > max_cpus): - max_cpus = proc_specs['NUM'] - return int(max_cpus) + 1 + cpu_num = int(proc_specs['NUM']) + if cpu_num > max_cpu: + max_cpu = cpu_num + return max_cpu + 1 def kill_curses(): curses.endwin() |