[Libguestfs] [PATCH 4/4] rpm: mageia: prefer dnf over urpmi

Pino Toscano ptoscano at redhat.com
Mon Oct 31 14:36:30 UTC 2016


Mageia introduced dnf as alternative package manager for the next
version 6, with the possibility to replace urpmi as primary in the
future.

As such, prefer dnf over urpmi+fakeroot to download rpm packages.

Thanks to Neal Gompa for his heads-up.
---
 README     | 3 +--
 src/rpm.ml | 8 +++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 79fcfd8..679bf70 100644
--- a/README
+++ b/README
@@ -81,8 +81,7 @@ For Mageia:
 
   rpm
   librpm
-  urpmi
-  fakeroot
+  urpmi & fakeroot, or 'dnf download' plugin
 
 For Arch Linux:
 
diff --git a/src/rpm.ml b/src/rpm.ml
index 820d7c1..b0a5eb2 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -45,8 +45,7 @@ let opensuse_detect () =
 
 let mageia_detect () =
   Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () &&
-    Config.urpmi <> "no" &&
-    Config.fakeroot <> "no" &&
+    ((Config.urpmi <> "no" && Config.fakeroot <> "no") || Config.dnf <> "no") &&
     (Os_release.get_id () = "mageia" ||
      try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ -> false)
 
@@ -389,7 +388,10 @@ and opensuse_download_all_packages pkgs dir =
 and mageia_download_all_packages pkgs dir =
   let tdir = !settings.tmpdir // string_random8 () in
 
-  mageia_download_all_packages_with_urpmi pkgs dir tdir;
+  if Config.dnf <> "no" then
+    download_all_packages_with_dnf pkgs dir tdir
+  else (* Config.urpmi <> "no" && Config.fakeroot <> "no" *)
+    mageia_download_all_packages_with_urpmi pkgs dir tdir;
 
   rpm_unpack tdir dir
 
-- 
2.7.4




More information about the Libguestfs mailing list