From e9b7031c8a1114c0aea68fac97a80e895c8fdd85 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 12 May 2011 11:19:42 +0100 Subject: Quieten build & ensure API build scripts exit with non-zero status The current API build scripts will continue and exit with a zero status even if they find problems. This has been the cause of many build problems, or hidden build errors, in the past. Change the scripts so they always exit with a non-zero status for any problems they do not understand. Also turn off all debug output by default so they respect $(AM_V_GEN) * docs/Makefile.am: Use $(AM_V_GEN) for API/HTML scripts * docs/apibuild.py, python/generator.py: Exit with non-zero status if problems are found. Also be silent, not outputting any debug messages. * src/Makefile.am: Use $(AM_V_GEN) for ESX generator * python/Makefile.am: Tweak rule --- Makefile.am | 6 +++--- generator.py | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0edb3e4..a4c9a6b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,11 +53,11 @@ GENERATED= libvirt-export.c \ libvirt.h \ libvirt.py -generated.stamp: $(srcdir)/$(GENERATE) $(API_DESC) - $(PYTHON) $(srcdir)/$(GENERATE) $(PYTHON) +$(GENERATE).stamp: $(srcdir)/$(GENERATE) $(API_DESC) + $(AM_V_GEN)$(PYTHON) $(srcdir)/$(GENERATE) $(PYTHON) && \ touch $@ -$(GENERATED): generated.stamp +$(GENERATED): $(GENERATE).stamp $(libvirtmod_la_OBJECTS): $(GENERATED) diff --git a/generator.py b/generator.py index c27ff73..1cb82f5 100755 --- a/generator.py +++ b/generator.py @@ -11,6 +11,8 @@ import sys import string import re +quiet=True + if __name__ == "__main__": # launched as a script srcPref = os.path.dirname(sys.argv[0]) @@ -617,7 +619,8 @@ def buildStubs(): sys.exit(1) n = len(functions.keys()) - print "Found %d functions in libvirt-api.xml" % (n) + if not quiet: + print "Found %d functions in libvirt-api.xml" % (n) py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject") try: @@ -629,8 +632,8 @@ def buildStubs(): except IOError, msg: print file, ":", msg - - print "Found %d functions in libvirt-override-api.xml" % ( + if not quiet: + print "Found %d functions in libvirt-override-api.xml" % ( len(functions.keys()) - n) nb_wrap = 0 failed = 0 @@ -662,20 +665,21 @@ def buildStubs(): export.close() wrapper.close() - print "Generated %d wrapper functions" % nb_wrap + if not quiet: + print "Generated %d wrapper functions" % nb_wrap if unknown_types: print "Missing type converters: " for type in unknown_types.keys(): print "%s:%d " % (type, len(unknown_types[type])), - print - for f in functions_failed: print "ERROR: failed %s" % f if failed > 0: return -1 + if len(unknown_types) > 0: + return -1 return 0 ####################################################################### -- cgit