# virt-resize (new version) and virt-sparsify are written in OCaml.
if HAVE_OCAML
-if HAVE_OCAML_PCRE
-SUBDIRS += resize
-endif
-SUBDIRS += sparsify
+SUBDIRS += resize sparsify
endif
# Perl tools.
- FUSE libraries and kernel module (optional)
-To build virt-resize:
-
-- OCaml PCRE bindings (ocaml-pcre) (optional)
-
To build language bindings:
- Perl if you want to build the perl bindings (optional)
OCAMLFIND=
AC_PROG_OCAML
AC_PROG_FINDLIB
-
- AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"],
- [AC_CHECK_OCAML_PKG([pcre])])
])
AM_CONDITIONAL([HAVE_OCAML],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
-AM_CONDITIONAL([HAVE_OCAML_PCRE],
- [test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_pcre" != "xno"])
AM_CONDITIONAL([HAVE_OCAMLDOC],
[test "x$OCAMLDOC" != "xno"])
echo -n "Perl virt tools ..................... "
if test "x$HAVE_TOOLS_TRUE" = "x"; then echo "yes"; else echo "no"; fi
echo -n "virt-resize ......................... "
-if test "x$HAVE_OCAML_TRUE" = "x" && test "x$HAVE_OCAML_PCRE_TRUE" = "x"; then echo "yes"; else echo "no"; fi
+if test "x$HAVE_OCAML_TRUE" = "x"; then echo "yes"; else echo "no"; fi
echo "FUSE filesystem ..................... $enable_fuse"
echo
echo "If any optional component is configured 'no' when you expected 'yes'"
libsys-virt-perl, libwin-hivex-perl,
# FUSE
libfuse-dev, fuse-utils,
-# virt-resize
- libpcre-ocaml-dev,
# Debian OCaml
dh-ocaml,
# to create images in the test suite
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-resize test.img
if HAVE_OCAML
-if HAVE_OCAML_PCRE
# Alphabetical order.
SOURCES = \
# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
# option to be passed to gcc, so we don't try linking against an
# installed copy of libguestfs.
-OCAMLPACKAGES = -package pcre -I $(top_builddir)/src/.libs -I ../ocaml
+OCAMLPACKAGES = -package str -I $(top_builddir)/src/.libs -I ../ocaml
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
.PHONY: depend docs
endif
-endif
# Parallel builds don't obey dependencies for some reason we
# don't understand.
(* Parse the size field from --resize and --resize-force options. *)
let parse_size =
- let const_re = Pcre.regexp "^([.\\d]+)([bKMG])$"
- and plus_const_re = Pcre.regexp "^\\+([.\\d]+)([bKMG])$"
- and minus_const_re = Pcre.regexp "^-([.\\d]+)([bKMG])$"
- and percent_re = Pcre.regexp "^([.\\d]+)%$"
- and plus_percent_re = Pcre.regexp "^\\+([.\\d]+)%$"
- and minus_percent_re = Pcre.regexp "^-([.\\d]+)%$"
+ let const_re = Str.regexp "^\\([.0-9]+\\)\\([bKMG]\\)$"
+ and plus_const_re = Str.regexp "^\\+\\([.0-9]+\\)\\([bKMG]\\)$"
+ and minus_const_re = Str.regexp "^-\\([.0-9]+\\)\\([bKMG]\\)$"
+ and percent_re = Str.regexp "^\\([.0-9]+\\)%$"
+ and plus_percent_re = Str.regexp "^\\+\\([.0-9]+\\)%$"
+ and minus_percent_re = Str.regexp "^-\\([.0-9]+\\)%$"
in
fun oldsize field ->
- let subs = ref None in
- let matches rex =
- try subs := Some (Pcre.exec ~rex field); true
- with Not_found -> false
- in
- let sub i =
- match !subs with None -> assert false
- | Some subs -> Pcre.get_substring subs i
- in
+ let matches rex = Str.string_match rex field 0 in
+ let sub i = Str.matched_group i field in
let size_scaled f = function
| "b" -> Int64.of_float f
| "K" -> Int64.of_float (f *. 1024.)