Juan Hernandez has uploaded a new change for review.

Change subject: codegen: Check version of generateDS.py
......................................................................

codegen: Check version of generateDS.py

Currently we don't check the version of the generateDS.py, as a
consecuence the generated code can be different depending on the machine
where the code generator is executed. This patch adds a check of the
version of generateDS.py, so if isn't the correct one the generation
will fail.

Change-Id: Iddd3cb4a814db111dc125fbfdf6481d276354517
Related: https://bugzilla.redhat.com/1091688
Signed-off-by: Juan Hernandez <[email protected]>
---
M src/codegen/xsd/genparams.py
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/67/27667/1

diff --git a/src/codegen/xsd/genparams.py b/src/codegen/xsd/genparams.py
index 94db8b1..3ee5530 100755
--- a/src/codegen/xsd/genparams.py
+++ b/src/codegen/xsd/genparams.py
@@ -45,6 +45,8 @@
           'error': logging.ERROR,
           'critical': logging.CRITICAL}
 
+GENERATE_DS_VERSION = "2.9a"
+
 
 class helpAction(argparse.Action):
     def __call__(self, parser, namespace, values, option_string=None):
@@ -136,6 +138,15 @@
     except OSError, e:
         print >> sys.stderr, "Execution failed:", e
     return rc
+
+
+def _eval(args):
+    cmd = " ".join(args)
+    try:
+        out = subprocess.check_output(cmd, shell=True)
+    except OSError, e:
+        print >> sys.stderr, "Execution failed:", e
+    return out
 
 
 class symbolInterpret(object):
@@ -364,6 +375,11 @@
             logging.error('[ERROR] generateDS.py is not found, '
                           'please installed it')
             exit(1)
+        version = _eval(["generateDS.py", "--version"])
+        if version != "generateDS.py version %s\n" % GENERATE_DS_VERSION:
+            sys.stderr.write("The version of generateDS.py isn't correct, "
+                             "it should be %s.\n" % GENERATE_DS_VERSION)
+            exit(1)
         if not os.path.exists(self.files["schema"]):
             logging.error('[ERROR] can not find the file %s',
                           (self.files["schema"]))


-- 
To view, visit http://gerrit.ovirt.org/27667
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddd3cb4a814db111dc125fbfdf6481d276354517
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to