[Libguestfs] [PATCH 2/4] rpm: move fedora_download_all_packages_with_dnf around

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


Move it after mageia_download_all_packages, and remove the "fedora_"
prefix from its name (as it will be soon used also for a distribution
different than fedora).

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

diff --git a/src/rpm.ml b/src/rpm.ml
index 0c7aae2..152a5c8 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -306,29 +306,12 @@ let rec fedora_download_all_packages pkgs dir =
   let tdir = !settings.tmpdir // string_random8 () in
 
   if Config.dnf <> "no" then
-    fedora_download_all_packages_with_dnf pkgs dir tdir
+    download_all_packages_with_dnf pkgs dir tdir
   else (* Config.yumdownloader <> "no" *)
     fedora_download_all_packages_with_yum pkgs dir tdir;
 
   rpm_unpack tdir dir
 
-and fedora_download_all_packages_with_dnf pkgs dir tdir =
-  (* Old dnf didn't create the destdir directory, newer versions do. *)
-  mkdir tdir 0o700;
-
-  let rpms = pkgs_as_NA_rpms pkgs in
-
-  let cmd =
-    sprintf "%s download%s%s --destdir=%s --disableexcludes=all %s"
-      Config.dnf
-      (if !settings.debug >= 1 then " -v" else " -q")
-      (match !settings.packager_config with
-      | None -> ""
-      | Some filename -> sprintf " -c %s" (quote filename))
-      (quote tdir)
-      (quoted_list rpms) in
-  run_command cmd
-
 and fedora_download_all_packages_with_yum pkgs dir tdir =
   (* It's quite complex to get yumdownloader to download specific
    * RPMs.  If we use the full NVR, then it will refuse if an installed
@@ -424,6 +407,23 @@ and mageia_download_all_packages pkgs dir =
 
   rpm_unpack tdir dir
 
+and download_all_packages_with_dnf pkgs dir tdir =
+  (* Old dnf didn't create the destdir directory, newer versions do. *)
+  mkdir tdir 0o700;
+
+  let rpms = pkgs_as_NA_rpms pkgs in
+
+  let cmd =
+    sprintf "%s download%s%s --destdir=%s --disableexcludes=all %s"
+      Config.dnf
+      (if !settings.debug >= 1 then " -v" else " -q")
+      (match !settings.packager_config with
+      | None -> ""
+      | Some filename -> sprintf " -c %s" (quote filename))
+      (quote tdir)
+      (quoted_list rpms) in
+  run_command cmd
+
 and pkgs_as_NA_rpms pkgs =
   let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
   List.map (
-- 
2.7.4




More information about the Libguestfs mailing list