mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
resize: Remove requirement for ocaml Pcre library.
This library is not available in RHEL 6, and in any case removing the dependency is a simple change.
This commit is contained in:
@@ -69,10 +69,7 @@ SUBDIRS += csharp
|
||||
|
||||
# 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.
|
||||
|
||||
4
README
4
README
@@ -101,10 +101,6 @@ To build FUSE support (guestmount):
|
||||
|
||||
- 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)
|
||||
|
||||
@@ -652,14 +652,9 @@ AS_IF([test "x$enable_ocaml" != "xno"],
|
||||
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"])
|
||||
|
||||
@@ -1088,7 +1083,7 @@ echo "guestfish and C virt tools .......... yes"
|
||||
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'"
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@@ -24,8 +24,6 @@ Build-Depends: debhelper (>= 7), dpkg-dev, devscripts, autotools-dev,
|
||||
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
|
||||
|
||||
@@ -25,7 +25,6 @@ EXTRA_DIST = \
|
||||
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-resize test.img
|
||||
|
||||
if HAVE_OCAML
|
||||
if HAVE_OCAML_PCRE
|
||||
|
||||
# Alphabetical order.
|
||||
SOURCES = \
|
||||
@@ -49,7 +48,7 @@ bin_SCRIPTS = virt-resize
|
||||
# -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)
|
||||
@@ -123,7 +122,6 @@ include .depend
|
||||
|
||||
.PHONY: depend docs
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
# Parallel builds don't obey dependencies for some reason we
|
||||
|
||||
@@ -102,23 +102,16 @@ let feature_available (g : Guestfs.guestfs) names =
|
||||
|
||||
(* 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.)
|
||||
|
||||
Reference in New Issue
Block a user