[Libguestfs] [PATCH 3/4] rpm: isolate actual mageia download in own function

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


Isolate the code downloading the packages with urpmi (for mageia) in an
own function, much like it was done already for the fedora case.

This is mostly code motion, no behaviour changes.
---
 src/rpm.ml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/rpm.ml b/src/rpm.ml
index 152a5c8..820d7c1 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -389,6 +389,11 @@ 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;
+
+  rpm_unpack tdir dir
+
+and mageia_download_all_packages_with_urpmi pkgs dir tdir =
   let rpms = List.map rpm_package_name (PackageSet.elements pkgs) in
 
   let cmd =
@@ -403,9 +408,7 @@ and mageia_download_all_packages pkgs dir =
       (if !settings.debug >= 1 then " --verbose" else " --quiet")
       (quote tdir)
       (quoted_list rpms) in
-  run_command cmd;
-
-  rpm_unpack tdir dir
+  run_command cmd
 
 and download_all_packages_with_dnf pkgs dir tdir =
   (* Old dnf didn't create the destdir directory, newer versions do. *)
-- 
2.7.4




More information about the Libguestfs mailing list