163 Commits

Author SHA1 Message Date
Richard W.M. Jones
efb83c4ab3 build: Add common-rules.mk, common rules for all Makefiles.
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.

(cherry picked from commit 49bdaabc7d)
(cherry picked from commit 7bc67024f0)
2013-06-14 13:14:25 +01:00
Richard W.M. Jones
70cf91edd6 Remove many uses of $(builddir).
"$(builddir)" is always "."

Therefore most uses of $(builddir) are suspect and should be
removed or replaced with "."

(cherry picked from commit a1e51676fd)
2013-05-28 18:48:52 +01:00
Richard W.M. Jones
d241876bd1 Remove use of gnulib progname module.
It's simpler to use the glibc 'program_invocation_short_name(3)'
feature, and fall back to a generic solution.  Also remove risky
assignments to argv[0].

(cherry picked from commit 142b874ce8)
2013-05-28 18:48:50 +01:00
Richard W.M. Jones
f46e3303f3 lib: Check calls to xmlXPathEvalExpression for nodesetval == NULL.
libxml2 xmlXPathEvalExpression can return an unusual nodeset:

  $1 = {type = XPATH_NODESET, nodesetval = 0x0, boolval = 0, floatval = 0,
    stringval = 0x0, user = 0x0, index = 0, user2 = 0x0, index2 = 0}

Note that the nodeset is non-NULL, but the nodesetval is NULL.

Check every call site and fix those that don't deal with this
correctly.

(cherry picked from commit 7f5bedd53b)
2013-03-05 18:49:02 +00:00
Richard W.M. Jones
c839ae2cb8 Use guestfs___count_strings instead of custom versions in various places.
(cherry picked from commit 9d6aa8b537)
2013-03-05 18:40:15 +00:00
Richard W.M. Jones
40668b1adc lib: Create libutils convenience library.
The libutils convenience library is a place for code shared between
the main library, language bindings and virt tools.  Note that the
code is statically linked into both the library, each binding and each
tool, but this is an improvement because (a) the source is shared and
(b) libguestfs.so can export fewer private functions.

Currently it contains the cleanup functions, and the functions
guestfs___free_string_list function and guestfs___for_each_disk.

guestfs___for_each_disk has changed so that it no longer
unconditionally sets the error in the guestfs handle.  Instead callers
can control error handling.
(cherry picked from commit 04723b4dd1)
2013-03-05 18:39:24 +00:00
Richard W.M. Jones
deea334e23 examples: Rename example programs, replacing '_' with '-'.
(cherry picked from commit e84d6e6102)
2013-02-14 16:23:29 +00:00
Richard W.M. Jones
64e3974fad build: Separate out *_CPPFLAGS from *_CFLAGS.
This is pretty pointless.
(cherry picked from commit 09c4f94c9d)
2013-02-14 16:22:16 +00:00
Richard W.M. Jones
0c6bdd858e tools: Use CLEANUP_* macros in several C tools.
(cherry picked from commit 4255db65e5)
2013-02-14 16:20:02 +00:00
Richard W.M. Jones
290bc85041 Update copyright dates for 2013.
(cherry picked from commit 0d18a8b407)
2013-02-14 16:13:29 +00:00
Richard W.M. Jones
79acc354f3 Remove all occurrences of the bad_cast (lowercase) function.
Not to be confused with the libxml2 macro 'BAD_CAST' which converts
from 'signed char *' to 'unsigned char *'.

The 'bad_cast' function was defined and used all over the place as a
replacement for a '(char *)' cast.  I think it is better to make these
casts explicit, instead of hiding them in an obscure function.
(cherry picked from commit 42bffcd00a)
2013-02-14 16:12:30 +00:00
Hilko Bengen
b1fdd1a76e inspector: Fix tests for out-of-tree builds
(cherry picked from commit 111f444d69)
2013-02-14 15:05:48 +00:00
Richard W.M. Jones
8af4732eac tests: Skip windows.img tests if it is zero-sized.
If ntfs-3g is not installed, then tests/guests creates a 'windows.img'
file which is zero-sized.

This is problematical because other tests which use this image will
fail at best, or hit RHBZ#847549 (qemu/virtio-scsi bug) at worst.

Change the tests which use windows.img so they skip if 'windows.img'
has zero size.
(cherry picked from commit d1ad89520e)
2012-12-20 15:44:44 +00:00
Richard W.M. Jones
5a2e320ec9 configure: Add --enable-code-profiling and --enable-code-coverage flags.
These configure flags enable code profiling (with gprof) and code
coverage (with gcov) respectively.

Although this is a nice idea, it's not currently very useful.

Libtool mangles filenames in such a way that gcov cannot locate its
datafiles.

Profiling is of dubious utility with libguestfs which is not CPU-bound
and relies extensively on running external programs (oprofile-like
system profiling that took into account libguestfs + qemu or
libguestfs + qemu + the appliance + filesystem tools *would* be
useful).

Also neither flag will help in capturing data from the appliance.
2012-12-04 14:11:14 +00:00
Richard W.M. Jones
3636c5fcff tests: Replace 'make extra-tests' with individual tests.
'make extra-tests' was a monolithic set of tests that did all sorts of
things: valgrind, tests over local guests, tests with upstream qemu,
tests with upstream libvirt, tests with the appliance attach method.

This made it hard to perform individual tests, eg. just valgrind
testing.  It was also hard to maintain because the tests were not
located in the same directories as the programs and sometimes
duplicated tests that were run elsewhere.

This commit splits up 'make extra-tests' into 5 separate targets:

 make check-valgrind              # run a subset of tests under valgrind
 make check-valgrind-local-guests # test under valgrind with local guests
 make check-with-appliance        # test with attach-method == appliance
 make check-with-upstream-qemu    # test with an alternate/upstream qemu
 make check-with-upstream-libvirt # test with an alternate/upstream libvirt

(You can also still run 'make extra-tests' which is now simply
a rule that runs the above 5 targets in order).

This replaces everything that was in the tests/extra directory,
so that has now gone.
2012-11-13 15:26:29 +00:00
Richard W.M. Jones
73631705cf inspector: Add some real virt-inspector tests. 2012-11-13 15:26:29 +00:00
Richard W.M. Jones
2d220f5da2 tools: Modify existing tools to use guestfs_{push,pop}_error_handler.
This is a shorter and more convenient way to disable errors
temporarily across calls.
2012-11-09 19:51:09 +00:00
John Eckersberg
dd9bbeb060 inspect: Use new inspect_list_applications2 API call
RWMJ:
 - Update virt-inspector.rng.
2012-11-01 18:22:08 +00:00
Wanlong Gao
f7f746a98e remove the useless "h" option
"h" option is not enabled in virt-cat, remove it.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-09-26 10:26:01 +01:00
Richard W.M. Jones
9fce75aa13 syntax: Remove gnulib c-ctype.h in files that don't use it.
Found by 'make syntax-check'.
2012-09-15 12:34:41 +01:00
Richard W.M. Jones
2f97bf873b podwrapper: Add --license parameter, which is required.
This adds standard LICENSE and BUGS sections to all of the man pages
that are processed by podwrapper.

Modify all the calls to $(PODWRAPPER) to add the right --license
parameter according to the content.  Note that this relaxes the
license on some code example pages, making them effectively BSD-style
licensed.
2012-08-21 20:33:21 +01:00
Richard W.M. Jones
f1d98bbc79 man pages: Ensure consistent copyright/author sections, remove license
section.

Ensure each man page contains consistent COPYRIGHT and AUTHOR
sections.

Remove the LICENSE section.  We will add that back in podwrapper in a
later commit.
2012-08-21 20:16:29 +01:00
Richard W.M. Jones
590774ed9e build: Use $(top_builddir)/run in Makefile.am's.
Not necessary, but this makes all invocations of 'run' consistent.
There is no functional change.
2012-07-26 21:58:17 +01:00
Richard W.M. Jones
6054051a9d fish: Rename fish/virt.c to fish/domain.c
This file handles the -d option for guestfish and other C command line
utilities.  Renaming this file makes it less confusing.
2012-07-19 16:11:26 +01:00
Richard W.M. Jones
f2ea617e22 build: Change calls to podwrapper.sh to use $(PODWRAPPER).
This will allow us to easily change the location of this
script in future.
2012-07-16 18:56:57 +01:00
Richard W.M. Jones
05d4e07918 tests: Add ./run --test option.
This option, when added via
  TESTS_ENVIRONMENT = [...] $(top_builddir)/run --test
allows us to run the tests and only print the full output (including
debugging etc) when the test fails.
2012-06-26 23:34:30 +01:00
Richard W.M. Jones
50aa9533e4 build: Define builddir and abs_srcdir when they are missing.
RHEL 5-era autoconf did not define these, so define them manually
when they are missing.

Define builddir as '.'  The scripts require this.  It won't work
in the srcdir != builddir case, but we don't care about that for
RHEL 5.

This commit also moves the builddir / abs_srcdir variable setting
above the include of subdir-rules.mk, in case that include uses
these variables.

Useful script:

  for f in $(find -name Makefile.am | xargs fgrep '$(abs_srcdir)' -l) ; do
    if ! grep -q '^abs_srcdir' $f; then
      echo missing in $f
    fi
  done
2012-06-18 15:32:47 +01:00
Richard W.M. Jones
46ed232dc2 New API: guestfs_canonical_device_name.
This API makes device names canonical, eg. /dev/vda1 -> /dev/sda1.
2012-06-13 23:07:26 +01:00
Richard W.M. Jones
681377f1b2 inspector: Update example XML. 2012-04-12 10:21:15 +01:00
Richard W.M. Jones
a996f0d370 inspector: Fix incorrect arch in example-ubuntu.xml. 2012-04-12 10:21:15 +01:00
Richard W.M. Jones
2bc922dd8e inspector: Update man page to describe how to access inspection info from other languages and guestfish. 2012-03-14 23:13:41 +00:00
Richard W.M. Jones
f76a88011a Replace 'int' with 'size_t' passim.
Analyze all uses of 'int' in the code, and replace with 'size_t' where
appropriate.
2012-03-13 08:23:56 +00:00
Richard W.M. Jones
08840bab44 Tempus fugit.
Update all copyright dates to 2012.
2012-01-18 22:05:02 +00:00
Richard W.M. Jones
dd0707be5f fish options parsing: Allow add_drives to be called multiple times.
Ensure that the drv structure is always zeroed on allocation.

Don't leak old drv->device when add_drives is called multiple times.
2012-01-18 16:28:10 +00:00
Richard W.M. Jones
cd077b8229 tests: Split images -> tests/data + tests/guests 2011-12-22 15:48:11 +00:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
d1ee71782a Add virt-inspector --xpath to run XPath queries directly.
xmlstarlet is good, but not available in Red Hat Enterprise Linux.

Build a simple but sane XPath query parser into virt-inspector
directly so that we don't need any external tools.
2011-11-03 13:06:25 +00:00
Hilko Bengen
e7ea6d06ab out-of-tree build: fixed bindtests and inspector 2011-10-21 16:42:06 +01:00
Richard W.M. Jones
baefb8225c inspector: Use xmlstarlet instead of xpath in examples. 2011-08-27 17:53:03 +01:00
Richard W.M. Jones
f0f3e16211 man pages: Add a standard EXIT STATUS section to most pages. 2011-08-27 17:47:10 +01:00
Hilko Bengen
ff101adf7e out-of-tree build: fix documentation generation 2011-08-15 14:50:33 +01:00
Richard W.M. Jones
76bd81820f inspector: Update documentation to cover <icon> element.
This updates commit 7f16c346bb.
2011-06-30 11:36:38 +01:00
Richard W.M. Jones
7f16c346bb New API: inspect-get-icon returns the guest icon.
This API returns the guest's favicon if found, else an icon
representing the guest operating system.  Currently supported by this
patch: Fedora, RHEL and derivatives, Debian (but not Ubuntu),
Windows XP, Windows 7.

This also updates virt-inspector to include an <icon> element
containing the icon in base64 encoding.
2011-06-28 18:41:54 +01:00
Richard W.M. Jones
ea96c7acf7 inspector: Fix comment in virt-inspector.rng.
The comment referred to the command line syntax of the old
virt-inspector.
2011-06-28 17:03:08 +01:00
Richard W.M. Jones
34acb80a28 Enable deprecation warnings on all C programs. 2011-05-17 17:05:12 +01:00
Richard W.M. Jones
87fb6d852d fish: Allow -d UUID (specify libvirt domains by UUID).
This applies in all the commands which use the common C option parsing
code, ie:

* guestfish
* guestmount
* virt-cat
* virt-df
* virt-filesystems
* virt-inspector
* virt-ls
* virt-rescue
2011-05-06 13:04:19 -04:00
Richard W.M. Jones
34d9fed24a inspector: Refresh the virt-inspector(1) manpage. 2011-04-16 21:15:10 +01:00
Richard W.M. Jones
5790f5bfaf Remove ad-hoc run*locally scripts, replace with './run'
Remove all the run*locally scripts and replace with a single top level
./run shell script.
2011-04-16 08:32:44 +01:00
Richard W.M. Jones
0108d7861d inspector: Handle write failures when creating example-*.xml. 2011-04-14 18:20:30 +01:00
Richard W.M. Jones
36d3a4ce53 inspector: Include <hostname> in output. 2011-04-14 18:20:26 +01:00