Matthew Booth
2010-Apr-29 10:47 UTC
[Libguestfs] [PATCH] GuestOS: Fix error when checking for rpm which isn't installed
---
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
Richard W.M. Jones
2010-Apr-29 20:42 UTC
[Libguestfs] [PATCH] GuestOS: Fix error when checking for rpm which isn't installed
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/
Maybe Matching Threads
- [PATCH] Config: Change config to lookup dependencies by name
- [PATCH] List all missing dependencies at once
- [PATCH] GuestOS: Reload augeas after rpm installation and removal
- [PATCH] GuestOS: Delete blkid.tab if it's present
- [PATCH] GuestOS: Update XF86Config or xorg.conf as appropriate