By adding common CLEANFILES and DISTCLEANFILES variables to
common-rules.mk, we can remove these from most other Makefiles, and
also clean files more consistently.
Note that bin_PROGRAMS are already cleaned by 'make clean', so I
removed cases where these were unnecessarily added to CLEANFILES.
Add makefile variables to enable silent rules for simple command
invocations, such as ocamlc, ocamlopt, javac, and erlc.
This reduces the log output when building with silent rules, still
showing the full command lines otherwise.
For functions linked to virt tools, make sure the name of the function
actually matches the virt tool. Because of the history of moving
functions across tools, some names no longer matched.
For mllib, use `guestfs_int_mllib_' prefix.
For OCaml bindings, use `guestfs_int_ocaml_' prefix.
This commit is by no means complete. There are many other C functions
in other language bindings which could do with being more consistently
named.
There is no functional change, this is just refactoring.
Remove man pages and other pages which 'make clean' did not remove
before.
To evaluate which pages could be removed, I did a full build and
check, and then ran 'make clean' followed by 'git clean -xdf'. By
examining the output of the git clean command I could see which files
were being missed.
Files that are _not_ removed by make clean or make distclean:
- generator-built files
- Makefile, Makefile.in, .deps, .depend
- any ./configure output files (maybe they should be?)
Move the random set of HTML files we build from html/ into
the website/ directory.
Also in the website/ directory, put the index.html file from
http://libguestfs.org, which was previously not under version control.
It is generated from index.html.in so we can automatically add the
current version and release date.
Also in the website/ directory, put various CSS file, images, etc.
which are required by the website and were also previously not under
version control.
Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
'ocamlfind install' doesn't like to install the same package if it is
already installed. It will give errors like:
ocamlfind: Package guestfs is already installed
or:
ocamlfind: Conflict with file: /usr/lib64/ocaml/guestfs/mlguestfs.cmxa
Fix this by removing the old installed files before running
'ocamlfind install'. An alternative would be to use
'ocamlfind uninstall', but this seems more direct.
** NB: This is an API break for OCaml programs using Guestfs.event_callback. **
Because of the way I implemented Guestfs.event_callback which had the
Guestfs.t handle as the first parameter, we had to store the (OCaml)
Guestfs.t handle in the C handle's private data area. To do that, we
had to create a global root pointing to the handle.
This of course meant that the handle could not be garbage collected
(thanks Roman Kagan for spotting this).
This changes the API of Guestfs.event_callback so that a handle is no
longer passed. The OCaml handle can now be garbage collected again.
For programs that need the Guestfs.t handle in the callback function
(which turns out to be *none* of the OCaml programs we have written),
you can do:
g#set_event_callback (callback_fn g) [Guestfs.EVENT_FOO];
In this case, since the closure passed to Guestfs.set_event_callback
is still registered as a global root, that will capture a reference to
the handle, so the handle won't be able to be garbage collected until
you delete the callback.
These are considerably more efficient than ordinary global roots, but
with the caveat that the program is not allowed to modify them without
calling a special function. We don't modify them, so this change is
safe.
This requires OCaml >= 3.11, but we have that on RHEL 6
(since we dropped support for RHEL 5).
See also:
http://caml.inria.fr/pub/ml-archives/caml-list/2008/03/c3bf86990088236ceeb9a0f0f4c35390.en.html
Because of previous automated commits, such as changing 'guestfs___'
-> 'guestfs_int_', several function calls no longer lined up with
their parameters, and some lines were too long.
The bulk of this commit was done using emacs batch mode and the
technique described here:
http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html
The changes suggested by emacs were then reviewed by hand.
Commit f6a790b67d changed the Makefile
so it only builds the tests when you run 'make check'.
If you didn't run 'make check' then (in particular) bindtests won't be
built, and so when you install it cannot be removed.
The simple fix for this is to make the removal of bindtests.*
conditional.
This fixes commit f6a790b67d.
Using 'ocamlfind ocamldoc' is much faster than running 'ocamldoc'
directly, because ocamlfind will run the native code program
'ocamldoc.opt' if it is available.
This change approximately halves the time taken to compile the ocaml
bindings.
Put in a list the errnos to expose, filling the content of the
Guestfs.Errno submodule from that.
Also, generate a separate guestfs-c-errnos.c with the implementations of
the functions returning the errno codes.
Only code motion and refactoring, no actual changes on the content of
the ocaml Guestfs module.
Fix the 'make check-valgrind' rule in the ocaml subdirectory so it
doesn't run '$VG run-bindtests', effectively running valgrind on bash.
Bash in Fedora Rawhide has added a new memory leak, resulting in a
failure, but we don't want to test bash anyway.
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.
The first step is to replace all guestfs___* (3 underscores) with
guestfs_int_*. We've used guestfs_int_* elsewhere already as a prefix
for internal identifiers.
This is an entirely mechanical change done using:
git ls-files | xargs perl -pi.bak -e 's/guestfs___/guestfs_int_/g'
Reference: http://stackoverflow.com/a/228797
Commit fd70cdc3c5 passes the -annot flag
to the compiler, generating *.annot files (containing type information
used by emacs and IDEs). Remove these files when doing 'make clean'.
In v2v, 'stringMap.ml' has no corresponding *.mli file. ocamldep does
not generate a *.cmi dependency for such modules, and this can result
in parallel builds failing rarely because:
(1) stringMap.ml is built (which has the side-effect of generating
stringMap.cmi)
(2) at the same time, types.mli is compiled. types.mli depends on
stringMap.cmi, but it is half way through being created by (1).
There is no dependency to serialize (1) and (2).
The resulting error is:
File "types.mli", line 1:
Error: Corrupted compiled interface
stringMap.cmi
Using 'ocamldep -all' generates extra deps for the *.cmi files, and
otherwise appears to be safe, so use it.
There are currently a few upstream OCaml bugs with dependencies and
parallel builds:
http://caml.inria.fr/mantis/view.php?id=3190http://caml.inria.fr/mantis/view.php?id=4991http://caml.inria.fr/mantis/view.php?id=5000
It's not clear which of these apply here.
In OCaml 4.02, the 'string' type can be made immutable. All String.*
functions that are concerned with creating or mutating strings now
give a warning like this:
Warning 3: deprecated feature: String.unsafe_set
Disable this warning since we don't want to turn on immutable strings
yet.
Commit f75142c577 disabled parallel
builds in the ocaml subdirectory (which was the correct thing to do).
This made building the OCaml tests in particular very slow. Therefore
fix things so that parallel builds can be used again.
See also discussion here about different approaches:
https://www.redhat.com/archives/libguestfs/2014-March/thread.html#00223
This reintroduces commit dce94f3e26.
This changes podwrapper so that the input (POD) files should not
contain an =encoding directive. However they must be UTF-8.
Podwrapper then adds the '=encoding utf8' directive back during final
generation.
This in particular avoids problems with nested =encoding directives in
fragments. These break POD, and are undesirable anyway.
Replaces code such as:
fd = open "test1.img"
ftruncate fd, size
close fd
g.add_drive "test1.img"
with the shorter and simpler:
g.add_drive_scratch size
This file is mainly a central place to:
- include localenv if it exists, and
- define the RHEL 5 backwards compatibility macros, instead of
spreading them over every other file.