[PATCH] build: Add a common script for generating OCaml dependencies correctly.
by Richard W.M. Jones
These are generated in many different ways in the various
subdirectories, and sometimes not generated correctly. Introduce a
script to do this in one place, and hopefully correctly.
This is mostly simple refactoring, but I got rid of a couple of
things:
(1) The ‘make depend’ rule doesn't appear to be needed. automake (or
make?) seems to rebuild the ‘.depend’ file automatically just because
it is included.
(2) I got rid of the hairy path rewriting sed expression. Possibly
that is needed for srcdir != builddir.
---
.gitignore | 1 +
builder/Makefile.am | 17 +++---------
common/mlpcre/Makefile.am | 15 ++--------
common/mlprogress/Makefile.am | 17 +++---------
common/mlstdutils/Makefile.am | 17 +++---------
common/mlutils/Makefile.am | 15 ++--------
common/mlvisit/Makefile.am | 17 +++---------
common/mlxml/Makefile.am | 15 ++--------
configure.ac | 2 ++
customize/Makefile.am | 17 +++---------
daemon/Makefile.am | 15 ++--------
dib/Makefile.am | 17 +++---------
generator/Makefile.am | 15 ++--------
get-kernel/Makefile.am | 17 ++----------
mllib/Makefile.am | 15 ++--------
ocaml-dep.sh.in | 64 +++++++++++++++++++++++++++++++++++++++++++
ocaml/Makefile.am | 13 ++-------
resize/Makefile.am | 15 ++--------
sparsify/Makefile.am | 17 +++---------
sysprep/Makefile.am | 17 +++---------
v2v/Makefile.am | 15 ++--------
v2v/test-harness/Makefile.am | 15 ++--------
22 files changed, 131 insertions(+), 237 deletions(-)
diff --git a/.gitignore b/.gitignore
index 0e7a649f8..4d738d10f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -380,6 +380,7 @@ Makefile.in
/mllib/getopt_tests
/mllib/JSON_tests
/mllib/oUnit-*
+/ocaml-dep.sh
/ocaml/bindtests.bc
/ocaml/bindtests.opt
/ocaml/bindtests.ml
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 1b51376be..e1c7bd016 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -310,23 +310,14 @@ CLEANFILES += \
console-*.img \
console-*.out
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/common/mlpcre -I $(abs_top_builddir)/mllib -I $(abs_top_builddir)/customize $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
# virt-builder's default repository
diff --git a/common/mlpcre/Makefile.am b/common/mlpcre/Makefile.am
index aa638cd94..fd4027a1f 100644
--- a/common/mlpcre/Makefile.am
+++ b/common/mlpcre/Makefile.am
@@ -124,19 +124,10 @@ check-valgrind:
$(MAKE) VG="@VG@" check
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlprogress/Makefile.am b/common/mlprogress/Makefile.am
index d4a229451..189aa5453 100644
--- a/common/mlprogress/Makefile.am
+++ b/common/mlprogress/Makefile.am
@@ -92,20 +92,11 @@ $(MLPROGRESS_CMA): $(OBJECTS) libmlprogress.a
-cclib -lprogress \
-o mlprogress
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index ccf7c6884..5208e491f 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -147,18 +147,9 @@ endif
check-valgrind:
$(MAKE) VG="@VG@" check
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlutils/Makefile.am b/common/mlutils/Makefile.am
index f29ffc062..ab92424d5 100644
--- a/common/mlutils/Makefile.am
+++ b/common/mlutils/Makefile.am
@@ -135,17 +135,8 @@ c_utils_unit_tests_LINK = \
$(c_utils_unit_tests_THEOBJECTS) -o $@
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlvisit/Makefile.am b/common/mlvisit/Makefile.am
index 2019efd75..fcf3bc0be 100644
--- a/common/mlvisit/Makefile.am
+++ b/common/mlvisit/Makefile.am
@@ -134,20 +134,11 @@ endif
check-valgrind:
$(MAKE) VG="@VG@" check
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/common/mlxml/Makefile.am b/common/mlxml/Makefile.am
index 1a989949f..87d3f67c5 100644
--- a/common/mlxml/Makefile.am
+++ b/common/mlxml/Makefile.am
@@ -89,19 +89,10 @@ $(MLXML_CMA): $(OBJECTS) libmlxml.a
-o mlxml
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/configure.ac b/configure.ac
index 7f9c1dac0..254200cc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,8 @@ AC_CONFIG_FILES([inspector/test-virt-inspector.sh],
[chmod +x,-w inspector/test-virt-inspector.sh])
AC_CONFIG_FILES([installcheck.sh],
[chmod +x,-w installcheck.sh])
+AC_CONFIG_FILES([ocaml-dep.sh],
+ [chmod +x,-w ocaml-dep.sh])
AC_CONFIG_FILES([p2v/virt-p2v-make-disk],
[chmod +x,-w p2v/virt-p2v-make-disk])
AC_CONFIG_FILES([p2v/virt-p2v-make-kickstart],
diff --git a/customize/Makefile.am b/customize/Makefile.am
index f660346f6..9e82039b5 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -303,20 +303,11 @@ CLEANFILES += \
password-*.log \
settings-*.img
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 63b28f52d..b26c43ed2 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -329,17 +329,8 @@ camldaemon.o: $(OBJECTS)
$(OBJECTS)
# OCaml dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/common/mlpcre $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
# Tests.
@@ -420,4 +411,4 @@ stamp-guestfsd.pod: guestfsd.pod
$<
touch $@
-.PHONY: depend force
+.PHONY: force
diff --git a/dib/Makefile.am b/dib/Makefile.am
index cc1287b35..d3a40b9b0 100644
--- a/dib/Makefile.am
+++ b/dib/Makefile.am
@@ -142,20 +142,11 @@ stamp-virt-dib.pod: virt-dib.pod
$<
touch $@
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/generator/Makefile.am b/generator/Makefile.am
index 1936d0898..35b7a4209 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -182,18 +182,9 @@ generator: $(objects)
$(OCAMLPACKAGES) -linkpkg mlstdutils.cma \
$^ -o $@
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml) $(wildcard $(abs_srcdir)/common/mlstdutils/*.mli) $(wildcard $(abs_srcdir)/common/mlstdutils/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../common/mlstdutils -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
noinst_DATA = stamp-generator
diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am
index 6cc7ec2fb..022678a2a 100644
--- a/get-kernel/Makefile.am
+++ b/get-kernel/Makefile.am
@@ -125,20 +125,9 @@ stamp-virt-get-kernel.pod: virt-get-kernel.pod
$<
touch $@
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-
-.PHONY: depend
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 49bd5e7fb..82b9482d9 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -240,19 +240,10 @@ check-valgrind:
$(MAKE) VG="@VG@" check
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in
new file mode 100755
index 000000000..8f48fdb64
--- /dev/null
+++ b/ocaml-dep.sh.in
@@ -0,0 +1,64 @@
+#!/bin/bash -
+# (C) Copyright 2009-2017 Red Hat Inc.
+# @configure_input@
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# This is a smarter wrapper around ocamldep(1) which is used to create
+# the .depend files which are present in each subdirectory that builds
+# OCaml code.
+#
+# Usage:
+# .depend: *.mli *.ml
+# $(top_builddir)/ocaml-dep.sh $^
+# -include .depend
+
+set -e
+
+# List of directories that contain common OCaml libraries. If it
+# contains OCaml code that can be included from another directory,
+# then it should go here. Note that OCaml modules in these
+# directories must have unique names (eg. not ‘Utils’) else
+# dependencies don't get built right.
+include_dirs="
+common/mlpcre
+common/mlprogress
+common/mlstdutils
+common/mlutils
+common/mlvisit
+common/mlxml
+customize
+mllib
+ocaml
+"
+
+# Output file is always created in the current directory.
+output=.depend
+
+includes=""
+for i in $include_dirs; do
+ includes="$includes -I @abs_top_srcdir@/$i -I @abs_top_builddir@/$i"
+done
+
+rm -f $output $output-t
+
+echo " OCAMLDEP $output"
+
+@OCAMLFIND@ ocamldep $includes "$@" |
+ @SED@ 's/ *$//' |
+ @SED@ -e :a -e '/ *\\$/N; s/ *\\\n */ /; ta' |
+ sort > $output-t
+
+mv $output-t $output
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 91be080bf..c6a458a2a 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -185,17 +185,8 @@ guestfs.cmx: guestfs.ml
$(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -package unix -c $< -o $@
endif
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml) $(wildcard $(abs_srcdir)/t/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
diff --git a/resize/Makefile.am b/resize/Makefile.am
index af65acbf5..e39f9da35 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -137,19 +137,10 @@ check-valgrind:
$(MAKE) VG="@VG@" check
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index c8062f353..5c57e8aa5 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -143,20 +143,11 @@ endif ENABLE_APPLIANCE
check-valgrind:
$(MAKE) VG="@VG@" check
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index f42722453..ee0b3e5dc 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -216,20 +216,11 @@ check-valgrind-local-guests:
$(top_builddir)/run --test @VG@ virt-sysprep -n -c "$(libvirt_ro_uri)" -d "$$g" || exit $$?; \
done
-# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/mllib -I $(abs_top_builddir)/customize $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+# OCaml dependencies.
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index f1f8fb824..7f260e3c0 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -515,19 +515,10 @@ v2v_unit_tests_LINK = \
$(v2v_unit_tests_THEOBJECTS) -o $@
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlutils -I $(abs_top_builddir)/common/mlxml -I $(abs_top_builddir)/mllib -I $(abs_top_builddir)/customize $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
-.PHONY: depend docs
+.PHONY: docs
diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am
index bcfcdf21d..8691c57c3 100644
--- a/v2v/test-harness/Makefile.am
+++ b/v2v/test-harness/Makefile.am
@@ -126,20 +126,11 @@ stamp-virt-v2v-test-harness.pod: virt-v2v-test-harness.pod
touch $@
# Dependencies.
-depend: .depend
-
-.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml)
- rm -f $@ $@-t
- $(OCAMLFIND) ocamldep -I ../../ocaml -I $(abs_srcdir) -I $(abs_top_builddir)/common/mlstdutils -I $(abs_top_builddir)/common/mlxml -I $(abs_top_builddir)/mllib -I $(abs_top_builddir)/customize -I $(abs_top_builddir)/v2v $^ | \
- $(SED) 's/ *$$//' | \
- $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
- $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
- sort > $@-t
- mv $@-t $@
-
+.depend: *.mli *.ml
+ $(top_builddir)/ocaml-dep.sh -I .. $^
-include .depend
endif
endif
-.PHONY: depend docs
+.PHONY: docs
--
2.13.1
7 years, 2 months
[PATCH 1/2] configure: visually split the blocks of checks
by Pino Toscano
Add sort of "headers" to split most of the logical sections of the
configure, so it is easier to get feedback on the progress of configure.
---
configure.ac | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/configure.ac b/configure.ac
index 7f9c1dac0..5ccf6f821 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,11 +76,15 @@ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_FULL],["$PACKAGE_VERSION_FULL"],[Full versio
AC_SUBST([PACKAGE_VERSION_FULL])
dnl Early gnulib initialization.
+AS_ECHO
+AS_ECHO(["Configuring Gnulib:"])
gl_EARLY
gl_INIT
dnl Check for external programs required to either build or run
dnl libguestfs.
+AS_ECHO
+AS_ECHO(["Checking for external programs:"])
m4_include([m4/guestfs_progs.m4])
dnl Find the release date for this version. This is used in
@@ -99,43 +103,83 @@ AS_IF([test "x$RELEASE_DATE" != "x"],[
AC_SUBST([RELEASE_DATE])
dnl The C compiler environment.
+AS_ECHO
+AS_ECHO(["Checking for the C compiler environment:"])
m4_include([m4/guestfs_c.m4])
dnl Any C libraries required by the libguestfs C library (not the daemon).
+AS_ECHO
+AS_ECHO(["Checking for libraries used by libguestfs:"])
m4_include([m4/guestfs_libraries.m4])
dnl Check for FUSE.
+AS_ECHO
+AS_ECHO(["Checking for FUSE:"])
m4_include([m4/guestfs_fuse.m4])
dnl The daemon and any dependencies.
+AS_ECHO
+AS_ECHO(["Checking the daemon and its dependencies:"])
m4_include([m4/guestfs_daemon.m4])
dnl The appliance and any dependencies.
+AS_ECHO
+AS_ECHO(["Checking the appliance and its dependencies:"])
m4_include([m4/guestfs_appliance.m4])
dnl Check for QEMU.
+AS_ECHO
+AS_ECHO(["Checking for QEMU:"])
m4_include([m4/guestfs_qemu.m4])
dnl Miscellaneous libraries used by other programs.
+AS_ECHO
+AS_ECHO(["Checking for other libraries:"])
m4_include([m4/guestfs_misc_libraries.m4])
dnl Check for language bindings.
+AS_ECHO
+AS_ECHO(["Checking for OCaml:"])
m4_include([m4/guestfs_ocaml.m4])
+AS_ECHO
+AS_ECHO(["Checking for Perl:"])
m4_include([m4/guestfs_perl.m4])
+AS_ECHO
+AS_ECHO(["Checking for Python:"])
m4_include([m4/guestfs_python.m4])
+AS_ECHO
+AS_ECHO(["Checking for Ruby:"])
m4_include([m4/guestfs_ruby.m4])
+AS_ECHO
+AS_ECHO(["Checking for Java:"])
m4_include([m4/guestfs_java.m4])
+AS_ECHO
+AS_ECHO(["Checking for Haskell:"])
m4_include([m4/guestfs_haskell.m4])
+AS_ECHO
+AS_ECHO(["Checking for PHP:"])
m4_include([m4/guestfs_php.m4])
+AS_ECHO
+AS_ECHO(["Checking for Erlang:"])
m4_include([m4/guestfs_erlang.m4])
+AS_ECHO
+AS_ECHO(["Checking for Lua:"])
m4_include([m4/guestfs_lua.m4])
+AS_ECHO
+AS_ECHO(["Checking for Go:"])
m4_include([m4/guestfs_golang.m4])
+AS_ECHO
+AS_ECHO(["Checking for GObject Introspection:"])
m4_include([m4/guestfs_gobject.m4])
dnl Bash completion.
+AS_ECHO
+AS_ECHO(["Checking for bash completion:"])
m4_include([m4/guestfs_bash_completion.m4])
dnl Miscellaneous configuration that doesn't fit anywhere else.
+AS_ECHO
+AS_ECHO(["Performing additional configuration:"])
m4_include([m4/guestfs_misc.m4])
dnl Work around autoconf's lack of expanded variables.
@@ -145,6 +189,8 @@ SYSCONFDIR="${my_sysconfdir}"
AC_SUBST(SYSCONFDIR)
dnl Produce output files.
+AS_ECHO
+AS_ECHO(["Generating output files:"])
AC_CONFIG_HEADERS([config.h])
--
2.13.4
7 years, 2 months
[PATCH 0/6] tests: Fix handling of device API parameters (RHBZ#1477623).
by Richard W.M. Jones
https://bugzilla.redhat.com/show_bug.cgi?id=1477623
The first two patches are cleanups.
The third patch changes the way that we handle Device and Dev_or_Path
parameters so that a parameter marked as such can really only contain
a block device name (and not, for instance, a chardev). Using a
chardev here caused hangs in the API.
The next two patches fix API usage to conform to this new stricter
checking. I removed the ability to use "/dev/urandom" (and similar)
non-block devices in place of block devices in such APIs as
guestfs_copy_device_to_device.
Last patch adds a regression test.
Rich.
7 years, 2 months
[PATCH supermin 0/9] kernel: Multiple fixes to handling of kernels (RHBZ#1477758).
by Richard W.M. Jones
This patch series fixes several problems in the way that supermin
handles kernels. The most pressing problem is that supermin doesn't
handle bogus vmlinuz files which aren't actual kernels. Along the way
there is a lot of clean up.
The patches look much better if you view them with ‘-w’.
This series will require plenty of time to be tested in Fedora,
especially on non-x86 arches.
Rich.
7 years, 2 months
Re: [Libguestfs] Ocamlfind can't find hivex
by Richard W.M. Jones
On Mon, Aug 07, 2017 at 08:10:55AM -0500, Chris McIntosh wrote:
> Hey Thanks Rich.
>
> > What distro?
> Solus
>
> > Are the OCaml bindings for hivex actually installed?
> I don't think so at this point, though make install runs this command:
>
> ocamlfind install \
> -ldconf ignore -destdir /home/chris/.opam/4.05.0/lib/ocaml \
> hivex \
> META *.so *.a *.cma *.cmi ./*.mli *.cmx *.cmxa
Oh I see you're using opam to install locally.
I think you'll need to set up an environment variable before running
./configure. I'm not much of an opam user myself, but it's probably:
export OCAMLPATH=/home/chris/.opam/4.05.0/lib/ocaml
or maybe:
export OCAMLPATH=/home/chris/.opam/4.05.0/lib/ocaml:/usr/lib/ocaml
or similar.
You might also want to check /etc/ocamlfind.conf and the opam
documentation.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
7 years, 2 months
Ocamlfind can't find hivex
by Chris McIntosh
<https://github.com/Chocrates>
Apologies if this is the wrong list, I initially opened a github ticket
before reading that github isn't the right spot.
Trying to compile libguestfs and in the process need to get hivex compiled
and installed.
Hivex compiles and installs fine (I think), but ocamlfind doesn't seem to
pick up hivex after the install causing the autogen.sh script in libguestfs
to fail.
Installation steps:
./bootstrap
./autogen.sh
make
sudo make install
No issues with any of the above commands that I can see, and I noticed that
autogen returned "OCaml bindings ........ yes" so I would expect ocamlfind
to be able to pick it up. Ocaml is pretty much a black box to me so not
sure how to debug this from here.
Thanks,
Chris
7 years, 2 months
[PATCH 0/2] Add lightweight bindings for PCRE.
by Richard W.M. Jones
We'd like to use PCRE instead of the awful Str module. However I
don't necessarily want to pull in the extra dependency of ocaml-pcre,
and in any case ocaml-pcre is rather difficult to use.
This introduces very simplified and lightweight bindings for PCRE.
They work rather like Str in that there is some global state (actually
thread-local in this implementation) between the matching and the
getting the substring, so you can write code like this:
let re = PCRE.compile "(a+)b"
...
if PCRE.matches re "ccaaaabb" then (
let whole = PCRE.sub 0 in (* returns "aaaab" *)
let first = PCRE.sub 1 in (* returns "aaaa" *)
...
I also introduced the switch from Str -> PCRE in virt-builder to show
that it simplifies code while allowing you to use the much more
powerful PCRE regular expressions.
Rich.
7 years, 2 months
read/write performance through mount point by guestmount
by lampahome
I create a *4x256GB-SSD RAID0(/dev/md1)* and I test the performance through
fio.
fio config:
ioengine=libaiodirect=1time_basedruntime=120ramp_time=30size=100g
The sequential read/write performance is:
>
> *read: 2000MB/swrite: 1800MB/s*
Now I make a ext4 on the RAID0(/dev/md1) and mount on /home/.
ANd I create a 100G-disk.qcow2 by guestfish.
> $guestfish
> ><fish>: disk-create disk.qcow2 qcow2 100*1024*1024*1024
> ><fish>: run
> ><fish>: mkfs ext4 /dev/sda
> ><fish>: shutdown
> ><fish>: quit
No errors showed.
I mount the disk.qcow2 on the /home/test/, and create a 50GB file.
> $dd if=/dev/zero of=/home/test/file bs=1M count=51280
Test sequential read/write again through fio and config almost the same:
ioengine=libaiodirect=1time_basedruntime=120ramp_time=30size=50g
and the testing filename is /home/test/file
and the performance is :
>
> *read: 86MB/swrite: 43MB/s*
how come the performance is so bad? almost down 95%.
My machine is: 4.4.0-83-generic, Ubuntu 16.04, x86_64 GNU/Linux
7 years, 2 months
Re: [Libguestfs] check-release FAILED (was: Re: [PATCH v2 3/3] daemon: Restore PCRE regular expressions in OCaml code.)
by Richard W.M. Jones
On Tue, Aug 01, 2017 at 12:32:09PM -0400, Richard Jones wrote:
> File "/var/tmp/tmpaukMIy/libguestfs/common/mlpcre/PCRE.ml", line 1:
> Error: Could not find the .cmi file for interface
> /var/tmp/tmpaukMIy/libguestfs/common/mlpcre/PCRE.mli.
> OCAMLCMI file.cmi
This is an actual bug. The order of calling the subdirs in
Makefile.am is wrong.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
7 years, 2 months