Skip to content

Commit

Permalink
Merge pull request #22 from djs55/fixes
Browse files Browse the repository at this point in the history
Fix build issues
  • Loading branch information
djs55 committed Apr 27, 2015
2 parents 0bdafc5 + 895b989 commit a36a9f2
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ _build
*.swp
setup.data
setup.log
*.install
vhd-tool
sparse_dd
*.1
config.mk
30 changes: 0 additions & 30 deletions .travis-ci.sh

This file was deleted.

6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: c
script: bash -ex .travis-ci.sh
install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-opam.sh
script: bash -ex .travis-opam.sh
env:
- OCAML_VERSION=4.01.0 OPAM_VERSION=1.1.0
- PACKAGE="vhd-tool" OCAML_VERSION=4.01
- PACKAGE="vhd-tool" OCAML_VERSION=latest
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.7.7 (2015-04-27)
* opam: generate a $NAME.install file
* make: fix conditional compilation when --disable-xenserver set
* now compatible with tar-format.0.2.1 and tar-format.0.3.0
* travis: use new opam 1.2 workflow

0.7.6 (2014-11-04)
* Upgrade to cohttp 0.12.0 API

Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ include config.mk
build: setup.data
rm -f configure.cmo configure.cmi
ocaml setup.ml -build
rm -f vhd-tool
ln -s main.native vhd-tool
./vhd-tool --help=groff > vhd-tool.1
ifeq ($(ENABLE_XENSERVER), "--enable-xenserver")
rm -f sparse_dd
ln -s sparse_dd.native sparse_dd
./sparse_dd --help=groff > sparse_dd.1
endif

setup.data: setup.ml
rm -f configure.cmo configure.cmi
Expand All @@ -13,20 +21,26 @@ setup.data: setup.ml
clean: setup.data
rm -f configure.cmo configure.cmi
ocaml setup.ml -clean
rm -f vhd-tool
rm -f sparse_dd

install: build
mkdir -p ${BINDIR}
install -m 755 main.native ${BINDIR}/vhd-tool || echo "Failed to install vhd-tool"
ifeq ($(ENABLE_XENSERVER), "--enable-xenserver")
mkdir -p ${LIBEXECDIR}
install -m 755 sparse_dd.native ${LIBEXECDIR}/sparse_dd || echo "Failed to install sparse_dd"
mkdir -p ${ETCDIR}
install -m 644 src/sparse_dd.conf ${ETCDIR}/sparse_dd.conf || echo "Failed to install sparse_dd.conf"
endif

.PHONY: uninstall
uninstall:
rm -f ${BINDIR}/vhd-tool
ifeq ($(ENABLE_XENSERVER), "--enable-xenserver")
rm -f ${LIBEXECDIR}/sparse_dd
rm -f ${ETCDIR}/sparse_dd.conf
endif

config.mk:
@echo Running './configure' with the defaults
Expand Down
6 changes: 3 additions & 3 deletions _oasis
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
OASISFormat: 0.3
OASISFormat: 0.4
Name: vhd-tool
Version: 0.7.6
Version: 0.7.7
Synopsis: .vhd file manipulation
Authors: Jonathan Ludlam and David Scott
License: LGPL-2.1 with OCaml linking exception
Plugins: META (0.3)
Plugins: META (0.4)
BuildTools: ocamlbuild

Flag xenserver
Expand Down
20 changes: 18 additions & 2 deletions configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,31 @@ let configure bindir libexecdir etcdir =
let xenstore_transport = find_ocamlfind false "xenstore_transport" in
let xenstore = find_ocamlfind false "xenstore" in
let tapctl = find_ocamlfind false "tapctl" in
let enable_xenserver = xcp && xenstore_transport && xenstore && tapctl 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 "ENABLE_XENSERVER=--%sable-xenserver" (if xcp && xenstore_transport && xenstore && tapctl then "en" else "dis");
Printf.sprintf "ENABLE_XENSERVER=--%sable-xenserver" (if enable_xenserver then "en" else "dis");
] in
output_file config_mk lines
output_file config_mk lines;
let lines =
[ "bin: [";
" \"main.native\" { \"vhd-tool\" }";
] @ (if enable_xenserver
then [ " \"sparse_dd.native\" { \"sparse_dd\" }" ]
else []) @ [
"]";
"man: [";
" \"vhd-tool.1\" { \"vhd-tool.1\" }";
] @ (if enable_xenserver
then [ " \"sparse_dd.1\" { \"sparse_dd.1\" }" ]
else []) @ [
"]";
] in
output_file "vhd-tool.install" lines

let configure_t = Term.(pure configure $ bindir $ libexecdir $ etcdir )

Expand Down
4 changes: 1 addition & 3 deletions opam
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ tags: [
"org:xapi-project"
]
build: [
["./configure" "--bindir=%{bin}%"]
["./configure" "--bindir=%{bin}%" "--etcdir=%{etc}%" "--libexecdir=%{bin}%"]
[make]
[make "install"]
]
remove: [[make "uninstall"]]
depends: [
"ocamlfind"
"lwt" {>= "2.4.3"}
Expand Down
10 changes: 5 additions & 5 deletions setup.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.4.1 *)

(* OASIS_START *)
(* DO NOT EDIT (digest: 2c5236e7682df1e6a576d732359fbfa0) *)
(* DO NOT EDIT (digest: 56bfa57abfe75008626a0a44fdedbef4) *)
(*
Regenerated by OASIS v0.4.5
Visit http://oasis.forge.ocamlcore.org for more information and
Expand Down Expand Up @@ -6667,13 +6667,13 @@ let setup_t =
distclean_doc = [];
package =
{
oasis_version = "0.3";
oasis_version = "0.4";
ocaml_version = None;
findlib_version = None;
alpha_features = [];
beta_features = [];
name = "vhd-tool";
version = "0.7.6";
version = "0.7.7";
license =
OASISLicense.DEP5License
(OASISLicense.DEP5Unit
Expand Down Expand Up @@ -6833,14 +6833,14 @@ let setup_t =
},
{exec_custom = true; exec_main_is = "sparse_dd.ml"})
];
plugins = [(`Extra, "META", Some "0.3")];
plugins = [(`Extra, "META", Some "0.4")];
disable_oasis_section = [];
schema_data = PropList.Data.create ();
plugin_data = []
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.5";
oasis_digest = Some "®¿\030¹´f\159=a\004rf_êk8";
oasis_digest = Some "\012¤c&²{.\142\011ÉH×\"\153\140\016";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
Expand Down
15 changes: 5 additions & 10 deletions src/impl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,11 @@ module TarStream = struct
}

let make_tar_header prefix counter suffix file_size =
Tar.Header.({
file_name = Printf.sprintf "%s%08d%s" prefix counter suffix;
file_mode = 0o644;
user_id = 0;
group_id = 0;
file_size = Int64.of_int file_size;
mod_time = Int64.of_float (Unix.gettimeofday ());
link_indicator = Tar.Header.Link.Normal;
link_name = ""
})
Tar.Header.make
~mod_time:(Int64.of_float (Unix.gettimeofday ()))
~file_mode:0o0644
(Printf.sprintf "%s%08d%s" prefix counter suffix)
(Int64.of_int file_size)
end

let stream_tar common c s _ prefix ?(progress = no_progress_bar) () =
Expand Down

0 comments on commit a36a9f2

Please sign in to comment.