Switch from a rake-based build to a make-based build.

This commit beefs up the Makefile to do the build, instead of the
Rakefile.

It also removes from the Rakefile the dependency on rake_utils, which
should mean it's ok to build in a schroot.

The files are reorganised to make the Makefile rules more tractable,
although the reorganisation reveals a problem with our current code
organisation.

The problem is that the proxy-specific code transitively depends on the
server code via flexnbd.h, which has a circular dependency on the server
and client structs. This should be broken in a future commit by
separating the flexnbd struct into a shared config struct and
server-specific parts, so that the server code can be moved into
src/server to more accurately show the functional dependencies.
This commit is contained in:
Alex Young
2014-02-21 19:10:55 +00:00
parent 0baf93fd7b
commit 4f31bd9340
44 changed files with 143 additions and 303 deletions

View File

@@ -458,12 +458,18 @@ module FlexNBD
def maybe_timeout(cmd, timeout=nil )
stdout, stderr = "",""
stat = nil
run = Proc.new do
Open3.popen3( cmd ) do |io_in, io_out, io_err|
# Ruby 1.9 changed the popen3 api. instead of 3 args, the block
# gets 4. Not only that, but it no longer sets $?, so we have to
# go elsewhere for the process' exit status.
Open3.popen3( cmd ) do |io_in, io_out, io_err, maybe_thr|
io_in.close
stdout.replace io_out.read
stderr.replace io_err.read
stat = maybe_thr.value if maybe_thr
end
stat ||= $?
end
if timeout
@@ -472,13 +478,13 @@ module FlexNBD
run.call
end
[stdout, stderr]
[stdout, stderr, stat]
end
def mirror(dest_ip, dest_port, bandwidth=nil, action=nil)
stdout, stderr = mirror_unchecked( dest_ip, dest_port, bandwidth, action )
raise IOError.new( "Migrate command failed\n" + stderr) unless $?.success?
stdout, stderr, status = mirror_unchecked( dest_ip, dest_port, bandwidth, action )
raise IOError.new( "Migrate command failed\n" + stderr) unless status.success?
stdout
end