[master] ecbdb32 Make output file prefix configurable.

Lasse Karstensen lkarsten at varnish-software.com
Thu Feb 11 13:01:09 CET 2016


commit ecbdb32a61ca0fc1ad54f5d329d937bc636cd5a1
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Thu Feb 11 12:56:40 2016 +0100

    Make output file prefix configurable.
    
    When building multiple vmods from the same source directory,
    vmodtool would trample on other concurrent jobs' vcc_if.[ch].

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index e8f890f..7662557 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -840,7 +840,7 @@ class SimpleTestCase(unittest.TestCase):
 
 
 #######################################################################
-def runmain(inputvcc, outputname="vcc_if"):
+def runmain(inputvcc, outputprefix="vcc_if"):
 	# Read the file in
 	lines = []
 	with open(inputvcc, "r") as fp:
@@ -904,8 +904,8 @@ def runmain(inputvcc, outputname="vcc_if"):
 	# Parsing done, now process
 	#
 
-	fc = open("%s.c" % outputname, "w")
-	fh = open("%s.h" % outputname, "w")
+	fc = open("%s.c" % outputprefix, "w")
+	fh = open("%s.h" % outputprefix, "w")
 
 	write_c_file_warning(fc)
 	write_c_file_warning(fh)
@@ -951,6 +951,8 @@ if __name__ == "__main__":
 
 	oparser.add_option('-N', '--strict', action='store_true', default=False,
 	    help="Be strict when parsing input file. (vmod.vcc)")
+	oparser.add_option('-o', metavar="prefix", default='vcc_if',
+	    help='Output file prefix. (default: "vcc_if")')
 	oparser.add_option('', '--runtests', action='store_true', default=False,
 	    dest="runtests", help=optparse.SUPPRESS_HELP)
 	(opts, args) = oparser.parse_args()
@@ -973,4 +975,4 @@ if __name__ == "__main__":
 		oparser.print_help()
 		exit(-1)
 
-	runmain(i_vcc)
+	runmain(i_vcc, outputprefix=opts.o)



More information about the varnish-commit mailing list