[Libguestfs] [PATCH] GuestOS: Fix error when checking for rpm which isn't installed

Matthew Booth mbooth at redhat.com
Thu Apr 29 10:47:31 UTC 2010


---
 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)) {
-- 
1.6.6.1




More information about the Libguestfs mailing list