diff --git a/.gitignore b/.gitignore index 2bfa44e..7ea67ab 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,8 @@ _build *.swp setup.data setup.log +*.install +vhd-tool +sparse_dd +*.1 +config.mk diff --git a/.travis-ci.sh b/.travis-ci.sh deleted file mode 100755 index d61f395..0000000 --- a/.travis-ci.sh +++ /dev/null @@ -1,30 +0,0 @@ -# OPAM packages needed to build tests. -OPAM_PACKAGES="vhd-format lwt cstruct uuidm cmdliner nbd cohttp xenstore xenstore_transport uri ssl sha tar-format" - - -case "$OCAML_VERSION,$OPAM_VERSION" in -3.12.1,1.0.0) ppa=avsm/ocaml312+opam10 ;; -3.12.1,1.1.0) ppa=avsm/ocaml312+opam11 ;; -4.00.1,1.0.0) ppa=avsm/ocaml40+opam10 ;; -4.00.1,1.1.0) ppa=avsm/ocaml40+opam11 ;; -4.01.0,1.0.0) ppa=avsm/ocaml41+opam10 ;; -4.01.0,1.1.0) ppa=avsm/ocaml41+opam11 ;; -*) echo Unknown $OCAML_VERSION,$OPAM_VERSION; exit 1 ;; -esac - -echo "yes" | sudo add-apt-repository ppa:$ppa -sudo apt-get update -qq -sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam -export OPAMYES=1 -export OPAMVERBOSE=1 -echo OCaml version -ocaml -version -echo OPAM versions -opam --version -opam --git-version - -opam init -opam install ${OPAM_PACKAGES} - -eval `opam config -env` -make diff --git a/.travis.yml b/.travis.yml index 1957db9..62c92a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGES b/CHANGES index 225c081..438a2ad 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/Makefile b/Makefile index 58fc047..e6a46d9 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 diff --git a/_oasis b/_oasis index 1e7a46c..40f0c0f 100644 --- a/_oasis +++ b/_oasis @@ -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 diff --git a/configure.ml b/configure.ml index 61fee33..2e559e5 100644 --- a/configure.ml +++ b/configure.ml @@ -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 ) diff --git a/opam b/opam index e437325..953f3cb 100644 --- a/opam +++ b/opam @@ -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"} diff --git a/setup.ml b/setup.ml index 72a7c09..c3d3910 100644 --- a/setup.ml +++ b/setup.ml @@ -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 @@ -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 @@ -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 diff --git a/src/impl.ml b/src/impl.ml index 2f94477..2882629 100644 --- a/src/impl.ml +++ b/src/impl.ml @@ -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) () =