From 69792d7bdd65279cb8edb43a93d0b9273c955687 Mon Sep 17 00:00:00 2001 From: Tails developers Date: Wed, 16 May 2012 08:42:08 +0200 Subject: vagrant: Add defaults for virtual CPUs build settings On Linux, we set the number of virtual CPUs to the number of CPUs in host system. --- Rakefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index f6ad2c5..fa66d3b 100644 --- a/Rakefile +++ b/Rakefile @@ -59,6 +59,16 @@ def enough_free_memory? end end +def system_cpus + return nil unless RbConfig::CONFIG['host_os'] =~ /linux/i + + begin + File.read('/proc/cpuinfo').scan(/^processor\s+:/).count + rescue + nil + end +end + task :parse_build_options do options = '' @@ -68,6 +78,10 @@ task :parse_build_options do # Use in-VM proxy unless an external proxy is set options += 'vmproxy ' unless EXTERNAL_HTTP_PROXY + # Default to the number of system CPUs when we can figure it out + cpus = system_cpus + options += "cpus=#{cpus} " if cpus + options += ENV['TAILS_BUILD_OPTIONS'] if ENV['TAILS_BUILD_OPTIONS'] options.split(' ').each do |opt| case opt -- cgit v1.1