>> I agree that there should be no way one could make an unsigned build by >> mistake. I think dazo's suggestion about having a command-line switch >> ("force unsigned build") is a good one. The SIGNTOOL variable could then >> be used to just locate signtool.exe and nothing else. This would make it >> behave the same way as most other variables in "settings.in" and allow >> making signed and unsigned builds using the same configuration file. >> > > Acked-by: Peter Stuge <pe...@stuge.se> > Ok, here's the next version of the patch; see commit message for details. Applies on top of original code, not my earlier patches. Tested on WinXP and everything seems to work ok. No changes to files using the SIGNTOOL variable from "settings.in" were necessary at this point., although "win/tap_span.py" may need fixing later.
-- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
From a4ca1e8d783364cd58ff370b21708ccd3d687efa Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Samuli=20Sepp=C3=A4nen?= <sam...@openvpn.net> Date: Tue, 16 Nov 2010 17:28:54 +0200 Subject: [PATCH] Added command-line option parser and an unsigned build option to build_all.py Modified win/build_all.py so that it parses command-line options using getopt. Added option "-u / --unsigned" which allows forcing unsigned builds and a "-h / --help" option. By default a signed build is generated, provided that the Python SignTool module is installed. If not, the build is interrupted. --- win/build_all.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/win/build_all.py b/win/build_all.py index 92d2bf4..6d1d956 100644 --- a/win/build_all.py +++ b/win/build_all.py @@ -1,15 +1,59 @@ +import getopt, sys from config_all import main as config_all from build import main as build_openvpn from build_ddk import main as build_ddk -from sign import main as sign from make_dist import main as make_dist +def Usage(): + '''Show usage information''' + print "Usage: build_all.py [OPTIONS]..." + print "Build OpenVPN using Visual Studio tools" + print + print " -h, --help Show this help" + print " -u, --unsigned Do not sign the TAP drivers" + sys.exit(1) + def main(config): + + # Do a signed build by default + unsignedBuild=False + + # Parse the command line argument(s) + try: + # Arguments that are followed by a : require a value from user + opts, args = getopt.getopt(sys.argv[1:], "hu", ["help", "unsigned"]) + except getopt.GetoptError: + Usage() + sys.exit(1) + + for o, a in opts: + if o in ("-h","--help"): + Usage() + if o in ("-u", "--unsigned"): + unsignedBuild=True + + + # Check if the SignTool module is present. This avoids ImportErrors popping + # up annoyingly _after_ the build. + if unsignedBuild == False: + try: + from signtool import SignTool + except (ImportError): + print "ERROR: SignTool python module not found! Can't do a signed build." + sys.exit(1) + + if unsignedBuild == True: + print "Doing an unsigned build as requested" + + # Start the build config_all(config) build_openvpn() build_ddk(config, 'tap', 'all') build_ddk(config, 'tapinstall', 'all') - sign(config, 'all') + + if unsignedBuild == False: + sign(config, 'all') + make_dist(config) # if we are run directly, and not loaded as a module -- 1.6.3.3