21 Commits

Author SHA1 Message Date
Richard W.M. Jones
49bdaabc7d 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.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
6d87aaefa0 php: Fix comment in run-php-tests.sh.
This updates commit cd40cf7139.
2013-05-17 11:53:45 +01:00
Richard W.M. Jones
0ec2726a52 php: Disallow separated builds.
As it stands, this will just break.  Until it is fixed, give a
diagnostic message.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
6e4f9be492 php: Pass all libvirt environment variables down to PHP test scripts.
Including LIBVIRTD_* and VIRTLOCKD_*.

This updates commit cd40cf7139.
2013-03-12 12:35:17 +00:00
Richard W.M. Jones
cd40cf7139 php: Fix tests.
- Use ./run script to run the tests.
- Set environment variables correctly, including $PATH.
- Test the locally built, not installed, copy of libguestfs.
2013-03-11 16:04:17 +00:00
Richard W.M. Jones
becc4fecf4 php: Revise README-PHP documentation. 2013-03-11 14:29:13 +00:00
Richard W.M. Jones
fe3798f366 php: Print libguestfs error string if test fails. 2013-03-11 13:44:50 +00:00
Richard W.M. Jones
d44752a110 php: Fix test, /dev/null format must be "raw". 2013-03-11 13:44:33 +00:00
Matthew Booth
27b995c841 Make internal-only functions and structures private
Certain functions are intended to be internal only, but we currently
export them anyway. This change moves them into a separate section of
guestfs.h protected by a GUESTFS_PRIVATE variable. This change also
enables private structs, but doesn't implement any.

This change only affects the C api. Language bindings aren't affected,
but probably should be in the future.
2013-01-30 17:27:01 +00:00
Richard W.M. Jones
7486fc6f43 generator: Rename 'add_drive_opts' API to 'add_drive'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers (except Haskell, PHP and GObject as discussed
in earlier commit).
2012-07-14 12:42:24 +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
4f868b84d6 php: Enable 'make clean' in extension subdirectory. 2012-01-22 14:38:07 +00:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
4fb3b23fb6 php: Fix bug in PHP tests.
We partitioned the disk, and then tried to create a PV on the whole
disk.  LVM gave the error:

  Device /dev/vda not found (or ignored by filtering).

It is unclear how this bug persisted for so long.  It might be due to
a change in LVM.
2011-08-23 20:21:32 +01:00
Richard W.M. Jones
b79e075d63 php: Combine tests to reduce number of launches. 2010-11-30 14:18:34 +00:00
Richard W.M. Jones
14490c3e1a generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).
This large commit changes the generator so that optional arguments
can be supported for functions.

The model for arguments (known as the "style") is changed from
(ret, args) to (ret, args, optargs) where optargs is a more limited
list of arguments.

One function has been added which takes optional arguments, it is
"add-drive-opts", modelled as:

  (RErr, [String "filename"], #required
         [Bool "readonly"; String "format"; String "iface"]) #optional

Note that this function is processed in the library (does not go over
the RPC protocol to the daemon).  This has allowed us to simplify
the current implementation by omitting changes related to RPC or the
daemon, although we plan to add these at some point in the future.

From C this function can be called in 3 different ways as in these
examples:

  guestfs_add_drive_opts (g, filename,
                          GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
			  GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
                          -1);

(the argument(s) between 'filename' and '-1' are the optional ones).

  guestfs_add_drive_opts_va (g, filename, args);

where 'args' is a va_list.  This works like the first version.

  struct guestfs_add_drive_opts_argv optargs = {
    .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
    .readonly = 1,
  }
  guestfs_add_drive_opts_argv (g, filename, &optargs);

This last form lets you construct lists of optional arguments, and
is used by guestfish and the language bindings.

In guestfish optional arguments are used like this:

  add-drive-opts filename readonly:true

In OCaml these are mapped naturally to OCaml optional arguments, eg:

  g#add_drive_opts ~readonly:true filename;

In Perl these are mapped to extra arguments, eg:

  $g->add_drive_opts ($filename, readonly => 1);

In Python these are mapped to optional arguments, eg:

  g.add_drive_opts ("file", readonly = 1, format = "qcow2")

In Ruby these are mapped to a final hash argument, eg:

  g.add_drive_opts("file", {})
  g.add_drive_opts("file", :readonly => 1)
  g.add_drive_opts("file", :readonly => 1, :iface => "virtio")

In PHP these are mapped to extra parameters.  This is not quite
accurate since you cannot omit arbitrary optional parameters, but
there's not much than can be done within the limitations of PHP
as a language.

Unimplemented in: Haskell, C#, Java.
2010-10-22 17:45:00 +01:00
Richard W.M. Jones
4460280960 php: Create test file properly before running test. 2010-10-21 18:47:44 +01:00
Richard W.M. Jones
c97d6c16bd php: Note that tests are testing the wrong thing. 2010-10-21 18:41:56 +01:00
Richard Jones
c1b6352677 syntax: Fully bracket m4 macro arguments. 2010-09-10 22:57:52 +01:00
Richard Jones
bd77c8d1b4 php: Remove 'make clean' rule in subdirectory. 2010-09-05 16:51:45 -04:00
Richard Jones
2c61e04c45 PHP bindings.
Note that these are not complete on 32 bit architectures.  PHP doesn't
offer any convenient 64 bit type (on 32 bit).  Therefore you should
always use these PHP bindings on 64 bit.
2010-09-04 13:38:03 +01:00