diff -r 3683d7c533f9 indra/cmake/TemplateCheck.cmake --- a/indra/cmake/TemplateCheck.cmake Fri Sep 24 15:44:26 2010 +0100 +++ b/indra/cmake/TemplateCheck.cmake Thu Mar 03 13:36:15 2011 -0800 @@ -5,10 +5,10 @@ macro (check_message_template _target) add_custom_command( TARGET ${_target} - POST_BUILD + PRE_LINK COMMAND ${PYTHON_EXECUTABLE} ARGS ${SCRIPTS_DIR}/template_verifier.py - --mode=development --cache_master - COMMENT "Verifying message template" + --mode=development --cache_master ${TEMPLATE_VERIFIER_OPTIONS} + COMMENT "Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py" ) endmacro (check_message_template) diff -r 3683d7c533f9 indra/newview/CMakeLists.txt --- a/indra/newview/CMakeLists.txt Fri Sep 24 15:44:26 2010 +0100 +++ b/indra/newview/CMakeLists.txt Thu Mar 03 13:36:15 2011 -0800 @@ -1631,8 +1631,6 @@ # sorted out on the parabuild cluster... #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2) - check_message_template(package) - endif (PACKAGE) endif (WINDOWS) @@ -1711,7 +1709,6 @@ add_custom_target(package ALL DEPENDS ${product}.tar.bz2) add_dependencies(package linux-crash-logger-target) add_dependencies(package linux-updater-target) - check_message_template(package) endif (PACKAGE) add_custom_command( @@ -1774,7 +1771,6 @@ if (PACKAGE) add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME}) - check_message_template(package) add_custom_command( TARGET package POST_BUILD @@ -1935,4 +1931,5 @@ endif (LL_TESTS) +check_message_template(${VIEWER_BINARY_NAME}) diff -r 3683d7c533f9 scripts/messages/message_template.msg.sha1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/messages/message_template.msg.sha1 Thu Mar 03 13:36:15 2011 -0800 @@ -0,0 +1,1 @@ +a7f6fe7e34c9c92b7315c6fb56ad32b8f651d4fb \ No newline at end of file diff -r 3683d7c533f9 scripts/template_verifier.py --- a/scripts/template_verifier.py Fri Sep 24 15:44:26 2010 +0100 +++ b/scripts/template_verifier.py Thu Mar 03 13:36:15 2011 -0800 @@ -66,6 +66,7 @@ import optparse import os import urllib +import hashlib from indra.ipc import compatibility from indra.ipc import tokenstream @@ -233,6 +234,9 @@ parser.add_option( '-c', '--cache_master', action='store_true', dest='cache_master', default=False, help="""Set to true to attempt use local cached copy of the master template.""") + parser.add_option( + '-f', '--force', action='store_true', dest='force_verification', + default=False, help="""Set to true to skip the sha_1 check and force template verification.""") options, args = parser.parse_args(sysargs) @@ -269,8 +273,18 @@ print "current:", current_filename current_url = 'file://%s' % current_filename - # retrieve the contents of the local template and check for syntax + # retrieve the contents of the local template current = fetch(current_url) + hexdigest = hashlib.sha1(current).hexdigest() + if not options.force_verification: + # Early exist if the template hasn't changed. + sha_url = "%s.sha1" % current_url + current_sha = fetch(sha_url) + if hexdigest == current_sha: + print "Message template SHA_1 has not changed." + sys.exit(0) + + # and check for syntax current_parsed = llmessage.parseTemplateString(current) if options.cache_master: @@ -301,6 +315,12 @@ if acceptable: explain("--- PASS ---", compat) + if options.force_verification == False: + print "Updating sha1 to %s" % hexdigest + sha_filename = "%s.sha1" % current_filename + sha_file = open(sha_filename, 'w') + sha_file.write(hexdigest) + sha_file.close() else: explain("*** FAIL ***", compat) return 1