[Libguestfs] [PATCH] virt-v2v: Add use augeas_error to GrubLegacy, plus typo fixup

Mike Latimer mlatimer at suse.com
Thu Oct 31 19:41:14 UTC 2013


The following patch adds augeas_error to the Sys::VirtConvert::Util use
statement for GrubLegacy (matching what is used in the Grub2 package).
This is required to prevent an undefined subroutine error for the
augeas_error call in list_kernels().

There are also a few minor typo fixups:

 - A message string in _configure_kernel was missing the $ before a variable
 - In _install_capability, the expression that filters out 'xen' should
   actually filter out '-xen'
 - Two typos in comments were irritating me  ;)

---
 lib/Sys/VirtConvert/Converter/RedHat.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/Sys/VirtConvert/Converter/RedHat.pm b/lib/Sys/VirtConvert/Converter/RedHat.pm
index 612ab2e..f3926e8 100644
--- a/lib/Sys/VirtConvert/Converter/RedHat.pm
+++ b/lib/Sys/VirtConvert/Converter/RedHat.pm
@@ -63,7 +63,7 @@ sub check_efi
 # Methods for inspecting and manipulating grub legacy
 package Sys::VirtConvert::Converter::RedHat::GrubLegacy;
 
-use Sys::VirtConvert::Util;
+use Sys::VirtConvert::Util qw(:DEFAULT augeas_error);
 
 use File::Basename;
 use Locale::TextDomain 'virt-v2v';
@@ -1055,7 +1055,7 @@ sub _configure_kernel
                     unless defined($boot_kernel);
             } else {
                 v2vdie __x('Failed to find a {name} package to install',
-                           name => "kernel_pkg.$kernel_arch");
+                           name => "$kernel_pkg.$kernel_arch");
             }
         }
     }
@@ -1512,7 +1512,7 @@ sub _install_capability
                         _get_replacement_kernel_name($g, $root, $kernel_arch,
                                                      $meta);
 
-                    # Check if we've got already got an appropriate kernel
+                    # Check if we've already got an appropriate kernel
                     my ($inst) =
                         _get_installed("$kernel_pkg.$kernel_arch", $g);
 
@@ -1523,7 +1523,7 @@ sub _install_capability
                     {
                         # filter out xen/xenU from release field
                         if (defined($kernel_release) &&
-                            $kernel_release =~ /^(\S+?)(xen)?(U)?$/)
+                            $kernel_release =~ /^(\S+?)(-xen)?(U)?$/)
                         {
                             $kernel_release = $1;
                         }
@@ -2076,7 +2076,7 @@ sub _get_installed
             or die("Unexpected return from rpm command: $installed");
         my ($epoch, $version, $release) = ($1, $2, $3);
 
-        # Ensure iepoch is always numeric
+        # Ensure epoch is always numeric
         $epoch = 0 if('(none)' eq $epoch);
 
         push(@installed, [$epoch, $version, $release]);
-- 
1.8.1.4




More information about the Libguestfs mailing list