[Pkg-libvirt-commits] [libguestfs] 43/116: v2v: Fix kernel detection when multiple kernels are installed (RHBZ#1161250).
Hilko Bengen
bengen at moszumanska.debian.org
Wed Nov 26 22:05:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.
commit 377bc302f11db3da4263f894c76a7d280fb25dbd
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Thu Nov 6 18:47:34 2014 +0000
v2v: Fix kernel detection when multiple kernels are installed (RHBZ#1161250).
Previously we used to try to find the 'vmlinuz' file by running 'rpm
-ql kernel' and looking for any file called 'vmlinuz-*'.
If there were multiple 'kernel' packages installed, the rpm command
would list files from all of them, resulting in a random 'vmlinuz-*'
being chosen, not necessarily the one corresponding to the kernel
package we were looking at.
Use 'rpm -ql kernel-<VERSION>-<RELEASE>' instead so that we only look
for files in the right kernel package.
Thanks: James Mighion
---
v2v/convert_linux.ml | 2 +-
v2v/linux.ml | 17 +++++++++++++++--
v2v/linux.mli | 2 +-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 69e72d3..3451f27 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -148,7 +148,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
when name = "kernel" || string_prefix name "kernel-" ->
(try
(* For each kernel, list the files directly owned by the kernel. *)
- let files = Linux.file_list_of_package verbose g inspect name in
+ let files = Linux.file_list_of_package verbose g inspect app in
(* Which of these is the kernel itself? *)
let vmlinuz = List.find (
diff --git a/v2v/linux.ml b/v2v/linux.ml
index 2c743e3..4287a4f 100644
--- a/v2v/linux.ml
+++ b/v2v/linux.ml
@@ -24,6 +24,8 @@ open Common_utils
open Types
open Utils
+module G = Guestfs
+
(* Wrappers around aug_init & aug_load which can dump out full Augeas
* parsing problems when debugging is enabled.
*)
@@ -115,12 +117,23 @@ let remove verbose g inspect packages =
format (String.concat " " packages)
)
-let file_list_of_package verbose (g : Guestfs.guestfs) inspect name =
+let file_list_of_package verbose (g : Guestfs.guestfs) inspect app =
let package_format = inspect.i_package_format in
match package_format with
| "rpm" ->
- let cmd = [| "rpm"; "-ql"; name |] in
+ (* Since RPM allows multiple packages installed with the same
+ * name, always check the full ENVR here (RHBZ#1161250).
+ *)
+ let pkg_name =
+ sprintf "%s-%s-%s" app.G.app2_name
+ app.G.app2_version app.G.app2_release in
+ let pkg_name =
+ if app.G.app2_epoch > 0_l then
+ sprintf "%ld:%s" app.G.app2_epoch pkg_name
+ else
+ pkg_name in
+ let cmd = [| "rpm"; "-ql"; pkg_name |] in
if verbose then eprintf "%s\n%!" (String.concat " " (Array.to_list cmd));
let files = g#command_lines cmd in
let files = Array.to_list files in
diff --git a/v2v/linux.mli b/v2v/linux.mli
index e5a3025..14e757b 100644
--- a/v2v/linux.mli
+++ b/v2v/linux.mli
@@ -31,7 +31,7 @@ val install : bool -> Guestfs.guestfs -> Types.inspect -> string list -> unit
val remove : bool -> Guestfs.guestfs -> Types.inspect -> string list -> unit
(** Uninstall package(s). *)
-val file_list_of_package : bool -> Guestfs.guestfs -> Types.inspect -> string -> string list
+val file_list_of_package : bool -> Guestfs.guestfs -> Types.inspect -> Guestfs.application2 -> string list
(** Return list of files owned by package. *)
val file_owner : bool -> Guestfs.guestfs -> Types.inspect -> string -> string
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list