summaryrefslogtreecommitdiffstats
path: root/perl
Commit message (Collapse)AuthorAgeFilesLines
* perl: Add test of multiple independent handles.Richard W.M. Jones2012-11-221-0/+37
| | | | (cherry picked from commit d14557d434de5cb1c9754ae0f3e8e820e0a46694)
* perl: Clean up and update the tests.Richard W.M. Jones2012-11-223-4/+3
| | | | (cherry picked from commit 4a2e8e89577ad4031aba1b2e5afb65ca58c2c39d)
* perl: Small test of create with flags.Richard W.M. Jones2012-11-221-0/+25
| | | | (cherry picked from commit 3d0e937b84b4d028d80b66afb960903b7bc10b97)
* inspection: Fix calls to case_sensitive_path (RHBZ#858126).Richard W.M. Jones2012-10-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Don't assume that if guestfs_case_sensitive_path returns NULL, that it means the file does not exist. The (previously undefined) behaviour of case_sensitive_path was that a NULL return meant "either the file doesn't exist or some other error". However in commit 973581780d8a006f336684fef6762801402d775d this was changed so that if the last element of the path didn't exist, it was assumed to be a new file and the (non-NULL) path of the new file is returned. This change breaks code (including in libguestfs) which tries to use case_sensitive_path as a dual-purpose call to fix-up a path for Windows and test if the file exists. Such code should be rewritten so that it explicitly tests for file existence after calling case_sensitive_path. I examined all the calls to case_sensitive_path in libguestfs and modified them where necessary. Cherry picked from commit 9ea6e9701461e594033999150f930cc4fafec4d2.
* perl: bindtests: Fix 64 bit integers on input on 32 bit Perl interpreter.Richard W.M. Jones2012-08-301-1/+4
| | | | (cherry picked from commit 15cd9dde5e0e4a7d510de71ef8991750971cf6d1)
* podwrapper: Add --license parameter, which is required.Richard W.M. Jones2012-08-301-0/+1
| | | | | | | | | | | | 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. (cherry picked from commit 2f97bf873b64384835f257f8916bf1ebb2af62b4)
* man pages: Ensure consistent copyright/author sections, remove licenseRichard W.M. Jones2012-08-301-18/+1
| | | | | | | | | | | | 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. (cherry picked from commit f1d98bbc79496947210ee0305f80440ed8557ec1)
* perl: In examples, call $g->shutdown, $g->close.Richard W.M. Jones2012-08-051-1/+2
| | | | (cherry picked from commit f6846d74c947bd8b711ef0b29148fa1e90580354)
* perl: Use $g instead of $h in documentation.Richard W.M. Jones2012-08-057-61/+61
| | | | | | $g is the "standard" name for libguestfs handles. (cherry picked from commit a99ea198b24745c49cdb42645c3497ac3b0e6a2f)
* build: Change calls to podwrapper.sh to use $(PODWRAPPER).Richard W.M. Jones2012-08-051-1/+1
| | | | | | This will allow us to easily change the location of this script in future. (cherry picked from commit f2ea617e224cd82496e56a41b5878063d6f02e3d)
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit ffbf1475f7ae7c462db289ad4834391469e72edd)
* perl, python, ruby: Fix comments on call to close method.Richard W.M. Jones2012-07-061-1/+4
| | | | | | | | Make the comments consistent. Also make the Perl example call $g->close explicitly so it is consistent with the other examples. (cherry picked from commit 27ebf517fae972eee49ae5911a03fabe5f4b6e54)
* examples: In create_disk example, don't call set_autosync.Richard W.M. Jones2012-07-061-7/+0
| | | | | | This is now set by default in all supported versions of libguestfs. It's just confusing if the examples refer to it. (cherry picked from commit 917550a117904ec1a06b77a7870a147014d71adb)
* tests: Fix a few tests where /dev/null was being used with format=qcow2.Richard W.M. Jones2012-06-281-1/+1
| | | | | | | This was always incorrect behaviour, but qemu appears to tolerate it. This cherry picks just the test fixes from commit 729bb9c6b5ae0c0e7c68dc802b1617936062f966.
* perl: Don't fail if 'type' (disk format) attribute is missing in libvirt XML ↵Richard W.M. Jones2012-05-031-1/+5
| | | | | | | | | | | | | | | | | | | | (RHBZ#701814). Old versions of libvirt allowed you to define disks like this: <disk type='file' device='disk'> <driver name='qemu'/> ... Since the <driver> element does not have a 'type' attribute (which defines the format), we are supposed to do autodetection, so the format should be undefined. However what actually happened was that the code in Sys::Guestfs::Lib::open_guest received format as an empty string from the xpath query, causing libguestfs to give an error. If the xpath query returns the format as an empty string, undefine it.
* lib: Remove the BUSY state.Richard W.M. Jones2012-04-261-3/+6
| | | | | | | | | | | | | | | Originally this state was intended so that in some way you could find out if the appliance was running a command. However there was never a thread-safe way to access the state of the handle, so in effect you could never do anything useful safely with this information. This commit completely removes the BUSY state. The only visible change is to the guestfs_is_busy API. Previously you could never call this safely from another thread. If you called it from the same thread it would always return false (since the current thread can't be running a libguestfs command at that point by definition). Now it always returns false.
* maint: use $var notation rather than ${var} when possibleJim Meyering2012-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Do not run appliance-related checks if not building applianceHilko Bengen2012-01-231-2/+8
|
* Replace setting of environment variables with usage of local run scriptHilko Bengen2012-01-231-3/+1
| | | | (Includes fix by RWMJ)
* Tempus fugit.Richard W.M. Jones2012-01-182-3/+3
| | | | Update all copyright dates to 2012.
* build: Fix automake warningsMatthew Booth2012-01-041-2/+2
|
* tests: Split images -> tests/data + tests/guestsRichard W.M. Jones2011-12-221-1/+1
|
* Update FSF address.Matthew Booth2011-11-0818-18/+18
|
* perl: Add %guestfs_introspection hash with introspection information.Richard W.M. Jones2011-10-281-0/+42
| | | | | Because this is a useful introspection API, it is a candidate for being backported into older stable branches.
* out-of-tree build: fixed bindtests and inspectorHilko Bengen2011-10-211-1/+1
|
* Add Erlang bindings.Richard W.M. Jones2011-09-211-0/+1
|
* out-of-tree build: fix documentation generationHilko Bengen2011-08-151-3/+3
|
* Fix 'unknown filesystem' warnings in old inspection code (RHBZ#678231 ↵Richard W.M. Jones2011-08-111-14/+20
| | | | | | | | | | RHBZ#666578). This is a comprehensive fix for the warnings from the old (and obsolete) Perl inspection code. For a full description and reproducer, see: https://bugzilla.redhat.com/show_bug.cgi?id=678231#c5
* build: Set TMPDIR for local testing.Richard W.M. Jones2011-08-081-1/+2
| | | | | | This avoids conflicts with the globally installed libguestfs appliance, or lets us build in multiple local directories at the same time without conflicts.
* perl: Fix another place where qw() was used as parentheses.Richard W.M. Jones2011-07-271-4/+4
| | | | | | This is a fix for Perl 5.14. See previous commit 5c3c7e8825341e18c9449976f8a321a04cc78d79.
* perl: Fix CCFLAGS for Perl 5.14.Richard W.M. Jones2011-07-221-2/+3
| | | | | | | | | | | | | | | | | | A change to ExtUtils::CBuilder in Perl 5.14 causes CCFLAGS to completely replace, rather than appending, the C flags. The unfortunate consequence of this is that vital flags such as -D_FILE_OFFSET_BITS=64 are missing. For 32 bit code, this means you get binary-incompatible code that completely fails to load. For further analysis see: http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171535.html This commit changes CCFLAGS so that it appends to the existing $Config{ccflags} instead of replacing it. On earlier versions of Perl this means we get two copies of the flags, which is unfortunate but should be safe.
* java: Add guestfs-java(3) man page.Richard W.M. Jones2011-07-191-0/+1
|
* Revert "Lib.pm: unknown filesystem label SWAP-sda2 (RHBZ#666578)"Richard W.M. Jones2011-06-281-1/+1
| | | | This reverts commit 5cab0d6c807d8a3bf9690375c663d11a10e21656.
* perl: Don't use qw() as parentheses.Richard W.M. Jones2011-06-181-1/+1
| | | | | | In Perl 5.14: Use of qw(...) as parentheses is deprecated at perl/blib/lib/Sys/Guestfs/Lib.pm line 1111.
* Add new guestfs-rescue(1) man page with recipes.Richard W.M. Jones2011-05-181-0/+1
|
* perl: Canonicalize /dev/vd* paths in old inspection code (RHBZ#691724).Richard W.M. Jones2011-03-291-0/+3
|
* perl: Binding and test for guestfs_last_errno (RHBZ#672491).Richard W.M. Jones2011-03-151-0/+76
|
* New event API - Perl bindings (RHBZ#664558).Richard W.M. Jones2011-03-151-0/+72
| | | | | | | | The methods $h->set_progress_callback and $h->clear_progress_callback have been removed, and replaced with a complete mechanism for setting and deleting general-purpose events. This also updates virt-resize to use the new API.
* Detect Red Hat Desktop as 'rhel' distro (RHBZ#682979).Richard W.M. Jones2011-03-081-2/+2
| | | | | | | | | | | | | /etc/redhat-release on Red Hat Desktop contains the following string: Red Hat Desktop release 4 (Nahant Update 8) Previously we matched against the string "Red Hat Enterprise Linux" but since this does not contain that string, this distro wasn't being detected correctly. Note this also changes the obsolete Perl code, for the benefit of virt-v2v.
* guestfs-perl: Fix missing \nRichard W.M. Jones2011-01-311-1/+1
| | | | This updates commit 477eebc83dcd33d00d34398692692dae6af04f22.
* perl: Translate C examples into Perl and include a manual page.Richard W.M. Jones2011-01-305-28/+242
|
* perl: Ignore internal_* functions in POD coverage test.Richard W.M. Jones2011-01-291-1/+2
| | | | This updates commit 1d999540bddd7aea7c2d0fef8b15223d4acc645f.
* Lib.pm: unknown filesystem /dev/hd{x} (cdrom) (RHBZ#666577)Douglas Schilling Landgraf2011-01-021-1/+3
| | | | | | | | | | | | | This a purpose patch to avoid the message "unknown filesystem /dev/hdc". Where /dev/hdc is an entry in fstab for CDROM. Example of fstab: /dev/hdc /media/cdrom auto pamconsole,exec,noauto,managed 0 0 https://bugzilla.redhat.com/show_bug.cgi?id=666577 Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
* Lib.pm: unknown filesystem label SWAP-sda2 (RHBZ#666578)Douglas Schilling Landgraf2011-01-021-1/+1
| | | | | | | | | | | | | | Hi, This is a purpose patch to avoid the message: unknown filesystem label SWAP-sda2. Instead of validate the label with 'eq', use '=~' and /$label/i. https://bugzilla.redhat.com/show_bug.cgi?id=666578 Thanks Douglas
* Lib.pm: avoid message "unknown filesystem /dev/fd0" (RHBZ#666577)Douglas Schilling Landgraf2011-01-021-0/+1
| | | | | | | | | | This patch to avoid the message "unknown filesystem /dev/fd0". https://bugzilla.redhat.com/show_bug.cgi?id=666577 Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Thanks Douglas
* perl: Ignore debug functions in Test::Pod::Coverage.Richard W.M. Jones2010-11-111-1/+4
|
* Sys::Guestfs::Lib: deprecate get_partitions (RHBZ#642933).Richard W.M. Jones2010-10-281-10/+3
| | | | | However the code is left since this function is used by virt-v2v amongst others.
* Sys::Guestfs::Lib: deprecate inspection functions (RHBZ#642930).Richard W.M. Jones2010-10-281-390/+29
| | | | | | | | Deprecate the guest inspection functions in this module, remove documentation, and point users at the core API functions instead. However we will keep the code here since it is used by virt-v2v and virt-inspector.
* tools: Specify format of disks (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-221-24/+37
| | | | | | | | | | Sys::Guestfs::Lib is changed in two ways: firstly we take the format string from libvirt and pass it to add_drive_opts. Secondly we allow an extra format => parameter to open_guest which allows the format to be specified for disk images. All the tools are changed to add an extra --format parameter allowing the format to be specified for direct disk images.
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-222-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.