On Mon, Nov 24, 2014 at 03:52:27PM +0100, Pino Toscano wrote:
Just code motion, no functional change.
Looks like simple code refactoring, so ACK.
Rich.
src/rpm.ml | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/rpm.ml b/src/rpm.ml
index ce803e1..771022e 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -288,11 +288,7 @@ let rec fedora_download_all_packages pkgs dir =
* Use name.arch so it can download any version but only the specific
* architecture.
*)
- let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
- let rpms = List.map (
- fun { name = name; arch = arch } ->
- sprintf "%s.%s" name arch
- ) rpms in
+ let rpms = pkgs_as_NA_rpms pkgs in
let cmd =
sprintf "%s%s%s --destdir %s %s"
@@ -309,11 +305,7 @@ let rec fedora_download_all_packages pkgs dir =
(* dnf doesn't create the download directory. *)
mkdir tdir 0o700;
- let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
- let rpms = List.map (
- fun { name = name; arch = arch } ->
- sprintf "%s.%s" name arch
- ) rpms in
+ let rpms = pkgs_as_NA_rpms pkgs in
let cmd =
sprintf "%s download --destdir %s %s"
@@ -326,11 +318,7 @@ let rec fedora_download_all_packages pkgs dir =
and opensuse_download_all_packages pkgs dir =
let tdir = !settings.tmpdir // string_random8 () in
- let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
- let rpms = List.map (
- fun { name = name; arch = arch } ->
- sprintf "%s.%s" name arch
- ) rpms in
+ let rpms = pkgs_as_NA_rpms pkgs in
let is_zypper_1_9_14 =
!zypper_major > 1
@@ -399,6 +387,13 @@ and mageia_download_all_packages pkgs dir =
rpm_unpack tdir dir
+and pkgs_as_NA_rpms pkgs =
+ let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in
+ List.map (
+ fun { name = name; arch = arch } ->
+ sprintf "%s.%s" name arch
+ ) rpms
+
and rpm_unpack tdir dir =
(* Unpack each downloaded package.
*
--
1.9.3
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v