[SCM] Debian package checker branch, master, updated. 2.5.9-29-g7c3b969
The following commit has been merged in the master branch:
commit 7c3b969adc8f8dca9afd8e1380bf849bf6f7d513
Author: Niels Thykier <niels@thykier.net>
Date: Wed Jun 27 19:57:30 2012 +0200
lintian: Use nproc instead /proc/cpuinfo
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/frontend/lintian b/frontend/lintian
index 28f9db4..88f95cf 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1949,27 +1949,14 @@ sub finished_coll {
sub default_parallel {
# check cpuinfo for the number of cores...
- if ( -r '/proc/cpuinfo') {
- my $jobs = 0;
- my $cpus = 0;
- open my $fd, '<', '/proc/cpuinfo'
- or fail ("failed to open /proc/cpuinfo: $!");
- while (<$fd>) {
- next unless m/^cpu cores\s*:\s*(\d+)/;
- $jobs += $1;
- $cpus++;
- }
- close $fd;
-
- if ($cpus) {
- # Running up to twice the number of cores usually gets the most out
- # of the CPUs and disks but it might be too aggresive to be the
- # default for -j. Only use <cores>+1 then.
- debug_msg (1, "Number of cores: $jobs (CPUs: $cpus)");
-
- return $jobs + 1;
- }
- debug_msg (1, "Did not find any core information for any cpus in /proc/cpuinfo?");
+ my $cpus;
+ chomp ( $cpus = `nproc 2>&1` );
+ if ($? == 0 and $cpus =~ m/^\d+$/ ) {
+ # Running up to twice the number of cores usually gets the most out
+ # of the CPUs and disks but it might be too aggresive to be the
+ # default for -j. Only use <cores>+1 then.
+ debug_msg (1, "Number of CPUs: $cpus");
+ return $cpus + 1;
}
# No decent number of jobs? Just use 2 as a default
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index 559e873..aab01fd 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -411,8 +411,8 @@ Limit the number of unpacking jobs Lintian will run in parallel.
This option overrides the B<jobs> variable in the configuration file.
-By default Lintian will use I</proc/cpuinfo> to determine a reasonable
-default (or 2, if the file cannot be read).
+By default Lintian will use I<nproc> to determine a reasonable default
+(or 2, if the nproc fails).
=item B<--root> rootdir
--
Debian package checker
Reply to: