Commit Graph

128 Commits

Author SHA1 Message Date
Richard W.M. Jones
c4dc70f8c4 podwrapper: Remove =encoding from input files and add it back in podwrapper.
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.
2014-03-20 13:47:19 +00:00
Richard W.M. Jones
d60e6a23a6 examples: Update various examples to use new disk-create API. 2014-01-28 21:02:11 +00:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
ee4ce2a029 ruby: Fix .new method (RHBZ#1046509).
The .new method was unintentionally broken in
commit 9466060201.

This fixes the .new method and allows it to be called with multiple
parameters, so you can use:

  Guestfs::Guestfs.new
  Guestfs::Guestfs.new()
  Guestfs::Guestfs.new(:close_on_exit => false)
  etc.

For backwards compatibility, Guestfs::create may still be used.

This commit also adds regression tests:

 - Use .new method in regular tests.  (Because this was not done
   before, we didn't catch the breakage.)

 - Test that ::create still works.

 - Test that args can be passed to .new method.
2013-12-27 13:22:20 +00:00
Richard W.M. Jones
480bd3a6d8 RHEL 6: ruby: Fix fallback to rake/rdoctask for old rake. 2013-12-27 13:22:20 +00:00
Richard W.M. Jones
92e1864913 events: Add a warning event and direct all warning messages through it.
This also causes warnings to be printed even in non-verbose mode,
which is useful.
2013-10-11 15:34:23 +01:00
Richard W.M. Jones
14fabcd88e tests: Use new guestfs_add_drive_scratch API where possible in tests.
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
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
06f2c1ad70 golang: Add examples and guestfs-golang(3) man page. 2013-07-04 15:48:47 +01:00
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
3c43019f8d ruby: Standardize test names and numbering. 2013-04-30 17:47:11 +01:00
Richard W.M. Jones
2ea9d82a23 ruby: Fix optargs test. 2013-04-25 20:10:34 +01:00
Richard W.M. Jones
a1e51676fd Remove many uses of $(builddir).
"$(builddir)" is always "."

Therefore most uses of $(builddir) are suspect and should be
removed or replaced with "."
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
87c9ec881c ruby: Support 'make INSTALLDIRS=vendor install' for Ruby as well as Perl.
As with Perl, you can now set INSTALLDIRS to control where Ruby places
its files (ie. in the site dir, which is the default, or in the vendor
dir).

The difference in file layout between 'make install' and
'make INSTALLDIRS=vendor install' is shown below (for Fedora 18).

--- /tmp/site	2013-03-14 12:14:35.740015694 +0000
+++ /tmp/vendor	2013-03-14 12:14:13.668093944 +0000
@@ -119,21 +119,20 @@
 ./usr/lib64/ocaml/guestfs/mlguestfs.cmxa
 ./usr/lib64/ocaml/stublibs/dllmlguestfs.so
 ./usr/lib64/ocaml/stublibs/dllmlguestfs.so.owner
-./usr/lib64/perl5/auto/Sys/Guestfs/Guestfs.bs
-./usr/lib64/perl5/auto/Sys/Guestfs/Guestfs.so
-./usr/lib64/perl5/auto/Sys/Guestfs/.packlist
 ./usr/lib64/perl5/perllocal.pod
-./usr/lib64/perl5/Sys/bindtests.pl
-./usr/lib64/perl5/Sys/Guestfs/Lib.pm
-./usr/lib64/perl5/Sys/Guestfs.pm
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/Guestfs.bs
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/Guestfs.so
+./usr/lib64/perl5/vendor_perl/auto/Sys/Guestfs/.packlist
+./usr/lib64/perl5/vendor_perl/Sys/bindtests.pl
+./usr/lib64/perl5/vendor_perl/Sys/Guestfs/Lib.pm
+./usr/lib64/perl5/vendor_perl/Sys/Guestfs.pm
 ./usr/lib64/php/modules/guestfs_php.so
 ./usr/lib64/pkgconfig/libguestfs-gobject-1.0.pc
 ./usr/lib64/pkgconfig/libguestfs.pc
 ./usr/lib64/python2.7/site-packages/guestfs.py
 ./usr/lib64/python2.7/site-packages/libguestfsmod.la
 ./usr/lib64/python2.7/site-packages/libguestfsmod.so
-./usr/local/lib64/ruby/site_ruby/_guestfs.so
-./usr/local/share/ruby/site_ruby/guestfs.rb
+./usr/lib64/ruby/vendor_ruby/_guestfs.so
 ./usr/sbin/libguestfs-make-fixed-appliance
 ./usr/share/doc/libguestfs/example-debian-netinst-cd.xml
 ./usr/share/doc/libguestfs/example-debian.xml
@@ -406,3 +405,4 @@
 ./usr/share/man/uk/man3/guestfs-perl.3
 ./usr/share/man/uk/man3/guestfs-python.3
 ./usr/share/man/uk/man3/guestfs-ruby.3
+./usr/share/ruby/vendor_ruby/guestfs.rb

For prompting me to fix this, thanks: Hilko Bengen.
2013-03-14 12:19:22 +00:00
Hilko Bengen
0ee24ccf8a Move Ruby-related checks from autoconf to extconf.rb; add extra check for rb_alloc_func_t
Ruby ships its own config.h which may or may not define the same
relevant constants as our autoconf-generated config.h. Instead of
trying to specify the exact path to the wanted header file we may just
as well simply use Ruby's autoconf-inspired checks and macros.
2013-03-08 12:47:24 +00:00
Hilko Bengen
0a50e64435 out-of-tree build: don't distribute extconf.rb.in template, use generated exconf.rb
Apparently, the file will only be autogenerated in $(builddir) if it
is not already present in $(srcdir).
2013-03-07 21:14:11 +00:00
Richard W.M. Jones
70514c7f7e ruby: Add binding for guestfs_event_to_string. 2013-02-19 13:41:58 +00:00
Richard W.M. Jones
0d18a8b407 Update copyright dates for 2013. 2013-02-02 13:56:19 +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
a0e9d310d1 ruby: Use updated package names, but allow fallback to the old names (RHBZ#894545).
Thanks Dominic Cleal.
2013-01-16 14:33:49 +00:00
Richard W.M. Jones
448a02373d ruby: Enable C compiler warnings.
This has the desirable side effect that the correct CFLAGS get passed
to the C compiler when building the Ruby extension.
2012-12-15 19:42:02 +00:00
Richard W.M. Jones
ff8bfd3e92 Add Lua bindings.
These are relatively complete, although only lightly tested.  Missing:

 - events
 - last_errno
 - user_cancel
2012-11-17 20:02:42 +00:00
Richard W.M. Jones
2cac8d490e syntax: Remove trailing whitespace.
Found by 'make syntax-check'.
2012-09-15 13:36:02 +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
d67e6ea75d Replace mount-options with mount where appropriate.
Since our minimum supported version is now 1.16 and mount was fixed in
1.13.16, it is now safe to replace mount-options + empty options with
mount wherever it occurs.
2012-08-18 22:08:29 +01:00
Richard W.M. Jones
863168467f examples: Use add_drive_opts function in examples.
In libguestfs 1.20, you will be able to use 'add_drive'
instead of 'add_drive_opts' (except in the C bindings).

However until libguestfs 1.20 is the minimum stable version
people will still be using old versions where you have to use
'add_drive_opts'.  This makes the examples confusing.

Therefore continue to use 'add_drive_opts' in the examples
for now.
2012-08-02 17:21:47 +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
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
ffbf1475f7 New API: guestfs_shutdown: Cleanly shutdown the backend.
The new API splits orderly close into a two-step process:

  if (guestfs_shutdown (g) == -1) {
    /* handle the error, eg. qemu error */
  }
  guestfs_close (g);

Note that the explicit shutdown step is only necessary in the case
where you have made changes to the disk image and want to handle write
errors.  Read the documentation for further information.

This change also:

 - deprecates guestfs_kill_subprocess

 - turns guestfs_kill_subprocess into the same as guestfs_shutdown

 - changes guestfish and other tools to call shutdown + close
   where necessary (not for read-only tools)

 - updates documentation

 - updates examples
2012-07-03 21:27:29 +01:00
Richard W.M. Jones
27ebf517fa perl, python, ruby: Fix comments on call to close method.
Make the comments consistent.

Also make the Perl example call $g->close explicitly so it is
consistent with the other examples.
2012-07-03 14:45:42 +01:00
Richard W.M. Jones
917550a117 examples: In create_disk example, don't call set_autosync.
This is now set by default in all supported versions of libguestfs.
It's just confusing if the examples refer to it.
2012-07-03 14:45:42 +01:00
Richard W.M. Jones
e7d2d3cb89 ruby: Use run --tests for tests. 2012-06-28 13:41:40 +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
8098d062b4 ruby: Add a replacement rb_hash_lookup function for Ruby 1.8.5.
This function was first added to Ruby in 1.8.7.
2012-06-22 11:29:57 +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
88b5ee9d95 Revert "ruby: Replace deprecated rdoc/task and rake/gempackagetask."
This reverts commit fd7a5a8bbd.

This breaks Ruby 1.8.7 in Fedora 16.
2012-03-25 19:20:07 +01:00
Richard W.M. Jones
fd7a5a8bbd ruby: Replace deprecated rdoc/task and rake/gempackagetask. 2012-03-16 22:14:44 +00:00
Richard W.M. Jones
3b78b3a849 ruby: Use RbConfig instead of Config.
I have checked, and this works with Ruby 1.8 as well.
2012-03-03 18:40:42 +00:00
Jim Meyering
6edecdec59 maint: use $var notation rather than ${var} when possible
I noticed some uses of ${srcdir} in shell scripts.
That is almost always better written as $srcdir.
The patch below converts most such variable references.
Here are the few remaining candidates:

$ git grep -i -E '\$\{[a-zA-Z_0-9]+\}'|grep -v Makefile.in.in
configure.ac:        JAR_INSTALL_DIR=\${prefix}/share/java
configure.ac:        JNI_INSTALL_DIR=\${libdir}
debian/rules:   for TEST in ${DEBIAN_SKIP_TEST}; do \
debian/rules:#          mv $${mod} $$(dirname $${mod})/libguestfsmod.so; \
java/Makefile.am:libguestfs_jar_DATA = libguestfs-${VERSION}.jar
java/Makefile.am:libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
perl/lib/Sys/Guestfs/Lib.pm:                      "-f", '${Package} ${Version} ${Architecture} ${Status}\n',
perl/typemap:            croak (\"${Package}::$func_name(): called on a closed handle\");
perl/typemap:        croak (\"${Package}::$func_name(): $var is not a blessed HV reference\");
tests/data/Makefile.am:   echo "$${i}abcdefghijklmnopqrstuvwxyz"; \

We could change all of those, too, except the ones in configure.ac
and Makefile.am, since they refer to Make variables.  Even those
should be changed, but to use the preferred Makefile notation:
$(prefix), $(libdir), $(VERSION).

>From a86770ecd45666232a94d76c8725c8f9b1c76e3a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 23 Jan 2012 11:15:12 +0100
Subject: [PATCH libguestfs] maint: use $var notation rather than ${var} when
 possible

The only case to avoid in a shell script is when the byte after the
"}" is word-constituent, and concatenating it would thus change the
name of the variable.

These changes were induced by running this command:
  git grep -l -i -E '\$\{(srcdir|md)' \
    |xargs perl -pi -e 's/\$\{(srcdir|md)\}($|\w)/\$$1$2/gi'

The "g" was needed because there was one line with two instances.
The "i" is to handle ${SRCDIR}.  The ($|\w) ensures that concatenating
whatever follows the "}" won't change semantics.

* gobject/run-bindtests: Use "$srcdir", not "${srcdir}".
* haskell/run-bindtests: Likewise.
* java/run-bindtests: Likewise.
* ocaml/run-bindtests: Likewise.
* perl/run-bindtests: Likewise.
* python/run-bindtests: Likewise.
* ruby/run-bindtests: Likewise.
* tests/guests/guest-aux/make-debian-img.sh: Likewise, but $SRCDIR.
* tests/guests/guest-aux/make-ubuntu-img.sh: Likewise.
* tests/guests/guest-aux/make-windows-img.sh: Likewise.
* tests/md/test-mdadm.sh: Likewise, but $md.
2012-01-23 10:40:47 +00:00
Hilko Bengen
7004fafc69 Replace setting of environment variables with usage of local run script
(Includes fix by RWMJ)
2012-01-23 09:08:21 +00:00
Richard W.M. Jones
08840bab44 Tempus fugit.
Update all copyright dates to 2012.
2012-01-18 22:05:02 +00:00
Hilko Bengen
41a7a68cf3 let the user explicitly choose ruby and rake programs 2011-12-06 19:48:31 +00:00
Hilko Bengen
8bc6e9d6a8 out-of-tree build: ruby 2011-11-21 08:43:33 +00:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +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
84763d7fca Add Erlang bindings. 2011-09-21 15:21:58 +01:00
Hilko Bengen
ff101adf7e out-of-tree build: fix documentation generation 2011-08-15 14:50:33 +01:00
Richard W.M. Jones
44c3a30026 ruby: Fix typo in Ruby bindings file. 2011-08-14 22:07:54 +01:00
Richard W.M. Jones
f7d18c84dd build: Set TMPDIR for local testing.
This avoids conflicts with the globally installed libguestfs
appliance, or lets us build in multiple local directories at the same
time without conflicts.
2011-08-08 12:41:54 +01:00
Richard W.M. Jones
d025e91f67 java: Add guestfs-java(3) man page. 2011-07-19 17:54:35 +01:00