[Pkg-libvirt-commits] [libguestfs] 10/31: v2v: Add a <!-- generated by .. --> comment in output XML files.

Hilko Bengen bengen at moszumanska.debian.org
Sun Nov 1 17:13:05 UTC 2015


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

bengen pushed a commit to annotated tag upstream/1.29.46
in repository libguestfs.

commit 2e2f016ce9a808cc116e80c6125e52f38f19b4b0
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sun May 31 22:16:44 2015 +0100

    v2v: Add a <!-- generated by .. --> comment in output XML files.
---
 mllib/common_utils.ml  | 3 +++
 mllib/common_utils.mli | 3 +++
 v2v/OVF.ml             | 1 +
 v2v/output_libvirt.ml  | 1 +
 v2v/test-v2v-i-ova.sh  | 4 +++-
 v2v/test-v2v-i-ova.xml | 1 +
 6 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 8dcd41f..32e908d 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -368,6 +368,9 @@ let print_version_and_exit () =
   printf "%s %s\n%!" prog Config.package_version_full;
   exit 0
 
+let generated_by =
+  sprintf (f_"generated by %s %s") prog Config.package_version_full
+
 let read_whole_file path =
   let buf = Buffer.create 16384 in
   let chan = open_in path in
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 228ed9a..bf0cba6 100644
--- a/mllib/common_utils.mli
+++ b/mllib/common_utils.mli
@@ -94,6 +94,9 @@ val print_version_and_exit : unit -> unit
 (** Print the version number and exit.  Implements [--version] flag in
     the OCaml tools. *)
 
+val generated_by : string
+(** The string "generated by <prog> <version>". *)
+
 val read_whole_file : string -> string
 (** Read in the whole file as a string. *)
 
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
index 9bebea5..729120f 100644
--- a/v2v/OVF.ml
+++ b/v2v/OVF.ml
@@ -251,6 +251,7 @@ let rec create_ovf source targets guestcaps inspect
       "xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1/";
       "ovf:version", "0.9"
     ] [
+      Comment generated_by;
       e "References" [] [];
       e "Section" ["xsi:type", "ovf:NetworkSection_Type"] [
         e "Info" [] [PCData "List of networks"]
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index b540b47..cf99f7c 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -289,6 +289,7 @@ let create_libvirt_xml ?pool source targets guestcaps
     doc "domain" [
       "type", "kvm";                (* Always assume target is kvm? *)
     ] [
+      Comment generated_by;
       e "name" [] [PCData source.s_name];
       e "memory" ["unit", "KiB"] [PCData (Int64.to_string memory_k)];
       e "currentMemory" ["unit", "KiB"] [PCData (Int64.to_string memory_k)];
diff --git a/v2v/test-v2v-i-ova.sh b/v2v/test-v2v-i-ova.sh
index ec9f4de..5047eca 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -77,7 +77,9 @@ test -f $d/TestOva.xml
 
 # Normalize the XML output.
 mv $d/TestOva.xml $d/TestOva.xml.old
-sed "s,source file='.*TestOva-sda',source file='TestOva-sda'," \
+sed \
+    -e "s,source file='.*TestOva-sda',source file='TestOva-sda'," \
+    -e "s,generated by.*--,generated by --," \
     < $d/TestOva.xml.old > $d/TestOva.xml
 
 # Check the libvirt XML output.
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index f3ecdc6..994727b 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -1,5 +1,6 @@
 <?xml version='1.0' encoding='utf-8'?>
 <domain type='kvm'>
+  <!-- generated by -->
   <name>TestOva</name>
   <memory unit='KiB'>2097152</memory>
   <currentMemory unit='KiB'>2097152</currentMemory>

-- 
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