[Libguestfs] [PATCH] GuestOS: Fix error when checking for rpm which isn't installed
Richard W.M. Jones
rjones at redhat.com
Thu Apr 29 20:42:56 UTC 2010
On Thu, Apr 29, 2010 at 11:47:31AM +0100, Matthew Booth wrote:
> ---
> lib/Sys/VirtV2V/GuestOS/RedHat.pm | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> index a973c19..6dc4c95 100644
> --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> @@ -686,7 +686,7 @@ sub _get_installed
> error => $error)));
> }
>
> - my @installed;
> + my @installed = ();
> foreach my $installed (@output) {
> $installed =~ /^(\S+)\s+(\S+)\s+(\S+)$/
> or die("Unexpected return from rpm command: $installed");
> @@ -779,7 +779,8 @@ sub _get_deppaths
> my ($name, undef, undef, undef, $arch) =
> $self->_get_nevra($path);
>
> - if ($self->_get_installed($name, $arch) > 0) {
> + my @installed = $self->_get_installed($name, $arch);
> + if (@installed > 0) {
> $required{$path} = 1;
>
> foreach my $deppath ($self->_get_deppaths('i386', @$deps)) {
> --
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
More information about the Libguestfs
mailing list