summaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-05-16 09:16:43 +0200
committerTails developers <amnesia@boum.org>2012-05-16 13:30:42 +0200
commit30d5e68e1868f3d3284ca7b8822b72bb0ab77af2 (patch)
tree5743dc945c4eb4455d4e50a3e78f38df0b66c53e /Rakefile
parent0aa86f7adfd9a48c26b2311e215f64fd9d6fc64a (diff)
vagrant: Prevent builds with uncommited changes
We also add a new 'ignorechanges' option that force a build to happen when there are uncommited changes. As the option name implies, they *will* be ignored.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile30
1 files changed, 29 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 81cd601..20f5ac5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -110,6 +110,34 @@ task :parse_build_options do
# Virtual CPUs settings
when /cpus=(\d+)/
ENV['TAILS_BUILD_CPUS'] = $1
+ # Git settings
+ when 'ignorechanges'
+ ENV['TAILS_BUILD_IGNORE_CHANGES'] = '1'
+ end
+ end
+end
+
+task :ensure_clean_repository do
+ unless `git status --porcelain`.empty?
+ if ENV['TAILS_BUILD_IGNORE_CHANGES']
+ $stderr.puts <<-END_OF_MESSAGE.gsub(/^ /, '')
+
+ You have uncommited changes in the Git repository. They will
+ be ignored for the upcoming build.
+
+ END_OF_MESSAGE
+ else
+ $stderr.puts <<-END_OF_MESSAGE.gsub(/^ /, '')
+
+ You have uncommited changes in the Git repository. Due to limitations
+ of the build system, you need to commit them before building Tails.
+
+ If you don't care about those changes and want to build Tails nonetheless,
+ please add `ignorechanges` to the TAILS_BUILD_OPTIONS environment
+ variable.
+
+ END_OF_MESSAGE
+ abort 'Uncommited changes. Aborting.'
end
end
end
@@ -135,7 +163,7 @@ task :validate_http_proxy do
end
desc 'Build Tails'
-task :build => ['parse_build_options', 'validate_http_proxy', 'vm:up'] do
+task :build => ['parse_build_options', 'ensure_clean_repository', 'validate_http_proxy', 'vm:up'] do
exported_env = EXPORTED_VARIABLES.select { |k| ENV[k] }.
collect { |k| "#{k}='#{ENV[k]}'" }.join(' ')