Skip to content

Commit

Permalink
Merge pull request #7 from djs55/separate-sparse_dd
Browse files Browse the repository at this point in the history
Separate sparse dd
  • Loading branch information
djs55 committed Nov 21, 2013
2 parents c6878df + d9616a4 commit 69c7d45
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
trunk (unreleased)
0.6.5 (2013-11-21)
* vhd-tool: add machine-parsable progress reporting
* vhd-tool: stream/serve support for SHA1/tar/chunked XenServer import/export encoding
* conditionally compile sparse_dd

0.6.4 (2013-11-05)
* vhd-tool serve: support receiving data as raw (no chunked or NBD)
Expand Down
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@

include config.mk

.PHONY: build
build: dist/setup
obuild build
.PHONY: build_vhd_tool
build_vhd_tool:
(cd vhd-tool && make)

dist/setup: vhd-tool.obuild
obuild configure
.PHONY: build_sparse_dd
build_sparse_dd:
(cd sparse_dd && make)

.PHONY: install
install: build
install -D -m 755 dist/build/vhd-tool/vhd-tool ${BINDIR}/vhd-tool
install -D -m 755 dist/build/sparse_dd/sparse_dd ${LIBEXECDIR}/sparse_dd
.PHONY: install_vhd_tool
install_vhd_tool:
install -D -m 755 vhd-tool/dist/build/vhd-tool/vhd-tool ${BINDIR}/vhd-tool

.PHONY: install_sparse_dd
install_sparse_dd:
install -D -m 755 sparse_dd/dist/build/sparse_dd/sparse_dd ${LIBEXECDIR}/sparse_dd
install -D -m 644 src/sparse_dd.conf ${ETCDIR}/sparse_dd.conf

config.mk:
Expand All @@ -21,7 +25,7 @@ config.mk:

.PHONY: clean
clean:
rm -rf dist
rm -rf vhd-tool/dist sparse_dd/dist
rm -f configure.cmo configure.cmi

.PHONY: distclean
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

trap "rm -f /tmp/configure.$$" EXIT

ocamlfind ocamlc -package cmdliner -linkpkg -o /tmp/configure.$$ configure.ml
ocamlfind ocamlc -package findlib,cmdliner -linkpkg -o /tmp/configure.$$ configure.ml
/tmp/configure.$$ $*

23 changes: 22 additions & 1 deletion configure.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
let config_mk = "config.mk"

let find_ocamlfind verbose name =
let found =
try
let (_: string) = Findlib.package_property [] name "requires" in
true
with
| Not_found ->
(* property within the package could not be found *)
true
| Findlib.No_such_package(_,_ ) ->
false in
if verbose then Printf.fprintf stderr "querying for ocamlfind package %s: %s" name (if found then "ok" else "missing");
found

(* Configure script *)
open Cmdliner

Expand Down Expand Up @@ -29,13 +43,20 @@ let configure bindir libexecdir etcdir =

Printf.printf "Configuring with:\n\tbindir=%s\n\tlibexecdir=%s\n\tetcdir=%s\n" bindir libexecdir etcdir;

(* Write config.mk *)
let xcp = find_ocamlfind false "xcp" in
let xenstore_transport = find_ocamlfind false "xenstore_transport" in
let xenstore = find_ocamlfind false "xenstore" in
let tapctl = find_ocamlfind false "tapctl" in
(* sparse_dd needs all 4 of these unreleased packages *)
let targets = "vhd_tool" :: (if xcp && xenstore_transport && xenstore && tapctl then [ "sparse_dd" ] else []) in
let lines =
[ "# Warning - this file is autogenerated by the configure script";
"# Do not edit";
Printf.sprintf "BINDIR=%s" bindir;
Printf.sprintf "LIBEXECDIR=%s" libexecdir;
Printf.sprintf "ETCDIR=%s" etcdir;
Printf.sprintf "build: %s" (String.concat " " (List.map (fun x -> "build_" ^ x) targets));
Printf.sprintf "install: %s" (String.concat " " (List.map (fun x -> "install_" ^ x) targets));
] in
output_file config_mk lines

Expand Down
10 changes: 10 additions & 0 deletions sparse_dd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: build
build: dist/setup
obuild build

dist/setup: sparse_dd.obuild
obuild configure

.PHONY: clean
clean:
rm -rf dist
8 changes: 1 addition & 7 deletions vhd-tool.obuild → sparse_dd/sparse_dd.obuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ version: 0.6.0
synopsis: Tools for streaming and manipulating vhd format data
obuild-ver: 1

executable vhd-tool
main: main.ml
src-dir: src
build-deps: lwt, lwt.unix, vhd-format, vhd-format.lwt, cmdliner, nbd, nbd.lwt, uri, cohttp, cohttp.lwt, tar, sha, sha.sha1
pp: camlp4o

executable sparse_dd
main: sparse_dd.ml
src-dir: src
src-dir: ../src
build-deps: lwt, lwt.unix, vhd-format, vhd-format.lwt, cmdliner, nbd, nbd.lwt, uri, cohttp, cohttp.lwt, xenstore, xenstore.client, xenstore.unix, xenstore_transport, xenstore_transport.unix, threads, tapctl, xcp, sha, sha.sha1, tar
pp: camlp4o
10 changes: 10 additions & 0 deletions vhd-tool/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: build
build: dist/setup
obuild build

dist/setup: vhd-tool.obuild
obuild configure

.PHONY: clean
clean:
rm -rf dist
11 changes: 11 additions & 0 deletions vhd-tool/vhd-tool.obuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: vhd-tool
version: 0.6.0
synopsis: Tools for streaming and manipulating vhd format data
obuild-ver: 1

executable vhd-tool
main: main.ml
src-dir: ../src
build-deps: lwt, lwt.unix, vhd-format, vhd-format.lwt, cmdliner, nbd, nbd.lwt, uri, cohttp, cohttp.lwt, tar, sha, sha.sha1
pp: camlp4o

0 comments on commit 69c7d45

Please sign in to comment.