diff options
| author | Richard W.M. Jones <rjones@redhat.com> | 2010-11-15 12:26:36 +0000 |
|---|---|---|
| committer | Richard W.M. Jones <rjones@redhat.com> | 2010-11-15 22:25:16 +0000 |
| commit | 163be3d72a3f3dc902bcd0856d8aec448bc7907f (patch) | |
| tree | e01c98b370419b3db5422ffa0203000e867064a6 /generator | |
| parent | 8a3a4c25d3bb63674c9ccf8483d9bfd89085fe47 (diff) | |
New API: inspect-list-applications.
This converts the current Perl code in virt-inspector for
listing applications, into C, making it a part of the core API.
This is also capable of fetching the list of Windows applications
from the registry.
Diffstat (limited to 'generator')
| -rw-r--r-- | generator/generator_actions.ml | 99 | ||||
| -rw-r--r-- | generator/generator_structs.ml | 17 |
2 files changed, 116 insertions, 0 deletions
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index d62ca82c..34a82bda 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -1177,6 +1177,105 @@ Future versions of libguestfs may return other strings. Please read L<guestfs(3)/INSPECTION> for more details."); + ("inspect_list_applications", (RStructList ("applications", "application"), [Device "root"], []), -1, [], + [], + "get list of applications installed in the operating system", + "\ +This function should only be called with a root device string +as returned by C<guestfs_inspect_os>. + +Return the list of applications installed in the operating system. + +I<Note:> This call works differently from other parts of the +inspection API. You have to call C<guestfs_inspect_os>, then +C<guestfs_inspect_get_mountpoints>, then mount up the disks, +before calling this. Listing applications is a significantly +more difficult operation which requires access to the full +filesystem. Also note that unlike the other +C<guestfs_inspect_get_*> calls which are just returning +data cached in the libguestfs handle, this call actually reads +parts of the mounted filesystems during the call. + +This returns an empty list if the inspection code was not able +to determine the list of applications. + +The application structure contains the following fields: + +=over 4 + +=item C<app_name> + +The name of the application. For Red Hat-derived and Debian-derived +Linux guests, this is the package name. + +=item C<app_display_name> + +The display name of the application, sometimes localized to the +install language of the guest operating system. + +If unavailable this is returned as an empty string C<\"\">. +Callers needing to display something can use C<app_name> instead. + +=item C<app_epoch> + +For package managers which use epochs, this contains the epoch of +the package (an integer). If unavailable, this is returned as C<0>. + +=item C<app_version> + +The version string of the application or package. If unavailable +this is returned as an empty string C<\"\">. + +=item C<app_release> + +The release string of the application or package, for package +managers that use this. If unavailable this is returned as an +empty string C<\"\">. + +=item C<app_install_path> + +The installation path of the application (on operating systems +such as Windows which use installation paths). This path is +in the format used by the guest operating system, it is not +a libguestfs path. + +If unavailable this is returned as an empty string C<\"\">. + +=item C<app_trans_path> + +The install path translated into a libguestfs path. +If unavailable this is returned as an empty string C<\"\">. + +=item C<app_publisher> + +The name of the publisher of the application, for package +managers that use this. If unavailable this is returned +as an empty string C<\"\">. + +=item C<app_url> + +The URL (eg. upstream URL) of the application. +If unavailable this is returned as an empty string C<\"\">. + +=item C<app_source_package> + +For packaging systems which support this, the name of the source +package. If unavailable this is returned as an empty string C<\"\">. + +=item C<app_summary> + +A short (usually one line) description of the application or package. +If unavailable this is returned as an empty string C<\"\">. + +=item C<app_description> + +A longer description of the application or package. +If unavailable this is returned as an empty string C<\"\">. + +=back + +Please read L<guestfs(3)/INSPECTION> for more details."); + ] (* daemon_functions are any functions which cause some action diff --git a/generator/generator_structs.ml b/generator/generator_structs.ml index 9cd585b3..8fd12e4e 100644 --- a/generator/generator_structs.ml +++ b/generator/generator_structs.ml @@ -175,6 +175,22 @@ let structs = [ "part_end", FBytes; "part_size", FBytes; ]; + + (* Application. *) + "application", [ + "app_name", FString; + "app_display_name", FString; + "app_epoch", FInt32; + "app_version", FString; + "app_release", FString; + "app_install_path", FString; + "app_trans_path", FString; + "app_publisher", FString; + "app_url", FString; + "app_source_package", FString; + "app_summary", FString; + "app_description", FString; + ]; ] (* end of structs *) (* Ugh, Java has to be different .. @@ -192,6 +208,7 @@ let java_structs = [ "xattr", "XAttr"; "inotify_event", "INotifyEvent"; "partition", "Partition"; + "application", "Application"; ] let java_name_of_struct typ = |
