2014-02-21 19:10:55 +00:00
|
|
|
# encoding: utf-8
|
2012-05-30 17:35:07 +01:00
|
|
|
|
2014-02-21 19:10:55 +00:00
|
|
|
def make(*targets)
|
|
|
|
sh "make #{targets.map{|t| t.to_s}.join(" ")}"
|
2014-01-22 11:42:00 +00:00
|
|
|
end
|
2012-05-20 14:38:46 +01:00
|
|
|
|
2014-02-21 19:10:55 +00:00
|
|
|
def maketask( opts )
|
|
|
|
case opts
|
|
|
|
when Symbol
|
|
|
|
maketask opts => opts
|
|
|
|
else
|
|
|
|
opts.each do |name, targets|
|
|
|
|
task( name ){make *[*targets]}
|
|
|
|
end
|
|
|
|
end
|
2012-05-16 01:27:14 +01:00
|
|
|
end
|
|
|
|
|
2014-02-21 19:10:55 +00:00
|
|
|
|
2012-07-14 18:47:25 +01:00
|
|
|
desc "Build the binary and man page"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :build => [:all, :doc]
|
2012-07-14 18:47:25 +01:00
|
|
|
|
2013-03-19 13:13:37 +00:00
|
|
|
desc "Build just the flexnbd binary"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :flexnbd => [:server]
|
|
|
|
file "build/flexnbd" => :flexnbd
|
2012-05-16 01:27:14 +01:00
|
|
|
|
2013-03-19 13:13:37 +00:00
|
|
|
desc "Build just the flexnbd-proxy binary"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :flexnbd_proxy => [:proxy]
|
|
|
|
file "build/flexnbd-proxy" => :flexnbd_proxy
|
2012-07-14 18:36:02 +01:00
|
|
|
|
2012-07-14 18:47:25 +01:00
|
|
|
desc "Build just the man page"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :man => :doc
|
2012-07-14 18:47:25 +01:00
|
|
|
|
2012-07-11 09:43:16 +01:00
|
|
|
|
2012-05-20 14:38:46 +01:00
|
|
|
namespace "test" do
|
2012-05-27 14:40:16 +01:00
|
|
|
desc "Run all tests"
|
2012-05-24 01:39:35 +01:00
|
|
|
task 'run' => ["unit", "scenarios"]
|
2012-05-30 09:51:20 +01:00
|
|
|
|
2012-05-27 14:40:16 +01:00
|
|
|
desc "Build C tests"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :build => :check_bins
|
2012-05-30 09:51:20 +01:00
|
|
|
|
2012-05-27 14:40:16 +01:00
|
|
|
desc "Run C tests"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :unit => :check
|
2012-05-30 09:51:20 +01:00
|
|
|
|
2012-05-27 14:40:16 +01:00
|
|
|
desc "Run NBD test scenarios"
|
2014-02-21 19:10:55 +00:00
|
|
|
task 'scenarios' => ["build/flexnbd", "build/flexnbd-proxy"] do
|
|
|
|
sh "cd tests/acceptance && RUBYOPT='-I.' ruby nbd_scenarios -v"
|
2012-05-24 01:39:35 +01:00
|
|
|
end
|
2012-05-20 14:38:46 +01:00
|
|
|
end
|
|
|
|
|
2012-05-30 09:51:20 +01:00
|
|
|
|
2012-05-27 14:40:16 +01:00
|
|
|
desc "Remove all build targets, binaries and temporary files"
|
2014-02-21 19:10:55 +00:00
|
|
|
maketask :clean
|
2014-02-21 19:58:02 +00:00
|
|
|
|
2014-02-25 17:24:25 +00:00
|
|
|
file "debian/changelog" do
|
|
|
|
FileUtils.mkdir_p "debian"
|
|
|
|
sh "hg log --style=changelog.template > debian/changelog"
|
2014-02-21 19:58:02 +00:00
|
|
|
end
|
|
|
|
|
2014-02-25 17:24:25 +00:00
|
|
|
desc "Generate the changelog"
|
|
|
|
task :changelog => "debian/changelog"
|