mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0078-v2v-Don-t-use-epoch-prefix-on-RPM-command-line-for-R.patch

0d20ef
From e3bdd5ea6af8c44ec5338b43f91d49518f604d3a Mon Sep 17 00:00:00 2001
0d20ef
From: "Richard W.M. Jones" <rjones@redhat.com>
0d20ef
Date: Fri, 5 Dec 2014 13:09:10 +0000
0d20ef
Subject: [PATCH] v2v: Don't use epoch prefix on RPM command line for RHEL <= 4
0d20ef
 (RHBZ#1170685).
0d20ef
0d20ef
See the explanation here:
0d20ef
https://bugzilla.redhat.com/show_bug.cgi?id=1170685#c7
0d20ef
0d20ef
(cherry picked from commit 205a8c7ca1ed1d66bef56d75c3c244e726e3bbbf)
0d20ef
---
0d20ef
 v2v/linux.ml | 19 ++++++++++++++++---
0d20ef
 1 file changed, 16 insertions(+), 3 deletions(-)
0d20ef
0d20ef
diff --git a/v2v/linux.ml b/v2v/linux.ml
0d20ef
index 4287a4f..32a4a21 100644
0d20ef
--- a/v2v/linux.ml
0d20ef
+++ b/v2v/linux.ml
0d20ef
@@ -129,9 +129,22 @@ let file_list_of_package verbose (g : Guestfs.guestfs) inspect app =
0d20ef
       sprintf "%s-%s-%s" app.G.app2_name
0d20ef
         app.G.app2_version app.G.app2_release in
0d20ef
     let pkg_name =
0d20ef
-      if app.G.app2_epoch > 0_l then
0d20ef
-        sprintf "%ld:%s" app.G.app2_epoch pkg_name
0d20ef
-      else
0d20ef
+      if app.G.app2_epoch > 0_l then (
0d20ef
+        (* RHEL 3/4 'rpm' does not support using the epoch prefix.
0d20ef
+         * (RHBZ#1170685).
0d20ef
+         *)
0d20ef
+        let is_rhel_lt_5 =
0d20ef
+          match inspect with
0d20ef
+          | { i_type = "linux";
0d20ef
+              i_distro = "rhel" | "centos" | "scientificlinux" |
0d20ef
+                  "redhat-based";
0d20ef
+              i_major_version = v } when v < 5 -> true
0d20ef
+          | _ -> false in
0d20ef
+        if is_rhel_lt_5 then
0d20ef
+          pkg_name
0d20ef
+        else
0d20ef
+          sprintf "%ld:%s" app.G.app2_epoch pkg_name
0d20ef
+      ) else
0d20ef
         pkg_name in
0d20ef
     let cmd = [| "rpm"; "-ql"; pkg_name |] in
0d20ef
     if verbose then eprintf "%s\n%!" (String.concat " " (Array.to_list cmd));
0d20ef
-- 
0d20ef
1.8.3.1
0d20ef