[Pkg-libvirt-commits] [libguestfs] 11/17: v2v: -o qemu: Refactor end of line handling.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:48:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.55-1
in repository libguestfs.

commit 630ab4c22afb91c69e1cc3ee0b6dba6f39a47dbe
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Sep 26 14:03:21 2014 +0100

    v2v: -o qemu: Refactor end of line handling.
---
 v2v/output_qemu.ml | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
index fafc9b8..3b3e865 100644
--- a/v2v/output_qemu.ml
+++ b/v2v/output_qemu.ml
@@ -45,15 +45,16 @@ object
     let chan = open_out file in
 
     let fpf fs = fprintf chan fs in
+    let nl = " \\\n\t" in
     fpf "#!/bin/sh -\n";
     fpf "\n";
-    fpf "qemu-system-%s \\\n" guestcaps.gcaps_arch;
-    fpf "\t-no-user-config -nodefaults \\\n";
-    fpf "\t-name %s \\\n" (quote source.s_name);
-    fpf "\t-machine accel=kvm:tcg \\\n";
-    fpf "\t-m %Ld \\\n" (source.s_memory /^ 1024L /^ 1024L);
+    fpf "qemu-system-%s" guestcaps.gcaps_arch;
+    fpf "%s-no-user-config -nodefaults" nl;
+    fpf "%s-name %s" nl (quote source.s_name);
+    fpf "%s-machine accel=kvm:tcg" nl;
+    fpf "%s-m %Ld" nl (source.s_memory /^ 1024L /^ 1024L);
     if source.s_vcpu > 1 then
-      fpf "\t-smp %d \\\n" source.s_vcpu;
+      fpf "%s-smp %d" nl source.s_vcpu;
 
     let block_bus =
       match guestcaps.gcaps_block_bus with
@@ -65,7 +66,7 @@ object
         let drive_param =
           sprintf "file=%s,format=%s,if=%s"
             qemu_quoted_filename t.target_format block_bus in
-        fpf "\t-drive %s\\\n" (quote drive_param)
+        fpf "%s-drive %s" nl (quote drive_param)
     ) targets;
 
     let net_bus =
@@ -75,19 +76,21 @@ object
       | RTL8139 -> "rtl8139" in
     List.iteri (
       fun i nic ->
-        fpf "\t-netdev user,id=net%d \\\n" i;
-        fpf "\t-device %s,netdev=net%d%s \\\n"
+        fpf "%s-netdev user,id=net%d" nl i;
+        fpf "%s-device %s,netdev=net%d%s" nl
           net_bus i (match nic.s_mac with None -> "" | Some mac -> ",mac=" ^ mac)
     ) source.s_nics;
 
     (* Add a serial console. *)
-    fpf "\t-serial stdio\n";
+    fpf "%s-serial stdio" nl;
 
     (* XXX Missing:
      * - removable devices
      * - display
      *)
 
+    fpf "\n";
+
     close_out chan;
 
     Unix.chmod file 0o755;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list