[Libguestfs] [PATCH v3 13/22] v2v: linux: Properly ignore rpm/dpkg-move-aside kernels.

Richard W.M. Jones rjones at redhat.com
Fri Sep 22 07:36:14 UTC 2017


The old virt-v2v code ignored boot kernels with names like
"/boot/vmlinuz-*.rpmsave".  The transscribed code did not because the
Str module requires ‘|’ to be escaped as ‘\|’.

This changes the code to use PCRE and fixes it.
---
 v2v/linux_bootloaders.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index 210cce762..00cb5cd19 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -319,9 +319,9 @@ object (self)
         Array.to_list (g#glob_expand "/boot/kernel-*") @
         Array.to_list (g#glob_expand "/boot/vmlinuz-*") @
         Array.to_list (g#glob_expand "/vmlinuz-*") in
-    let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in
+    let rex = PCRE.compile "\\.(?:dpkg-.*|rpmsave|rpmnew)$" in
     let vmlinuzes = List.filter (
-      fun file -> not (Str.string_match rex file 0)
+      fun file -> not (PCRE.matches rex file)
     ) vmlinuzes in
     vmlinuzes
 
-- 
2.13.2




More information about the Libguestfs mailing list