summaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-05-16 10:18:50 +0200
committerTails developers <amnesia@boum.org>2012-05-16 13:30:42 +0200
commite279cbd3636165bc94b6384cf538815a42884bb0 (patch)
tree3f3a84e82809d2d7cbff48f91b99834d82b62f26 /Rakefile
parent30d5e68e1868f3d3284ca7b8822b72bb0ab77af2 (diff)
vagrant: Add defaults to SquashFS build settings
We default to the fast gzip algorithm when building a branch that is not considered "stable", namely `stable` and `testing`.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 20f5ac5..d0415e6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,6 +28,9 @@ require 'tails_build_settings'
# Path to the directory which holds our Vagrantfile
VAGRANT_PATH = File.expand_path('../vagrant', __FILE__)
+# Branches that are considered 'stable' (used to select SquashFS compression)
+STABLE_BRANCH_NAMES = ['stable', 'testing']
+
# Environment variables that will be exported to the build script
EXPORTED_VARIABLES = ['http_proxy', 'MKSQUASHFS_OPTIONS', 'TAILS_RAM_BUILD', 'TAILS_CLEAN_BUILD']
@@ -59,6 +62,11 @@ def enough_free_memory?
end
end
+def stable_branch?
+ branch_name = `git name-rev --name-only HEAD`
+ STABLE_BRANCH_NAMES.include? branch_name
+end
+
def system_cpus
return nil unless RbConfig::CONFIG['host_os'] =~ /linux/i
@@ -78,6 +86,9 @@ task :parse_build_options do
# Use in-VM proxy unless an external proxy is set
options += 'vmproxy ' unless EXTERNAL_HTTP_PROXY
+ # Default to fast compression on development branches
+ options += 'gzipcomp ' unless stable_branch?
+
# Default to the number of system CPUs when we can figure it out
cpus = system_cpus
options += "cpus=#{cpus} " if cpus