From: Sapan Bhatia Date: Fri, 24 Jul 2009 19:03:08 +0000 (+0000) Subject: Interesting bug. If you call a previously invoked function with a missing argument... X-Git-Tag: 4.3-rc11~56 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2e8e478639720ebb8f599eabf1470a8f4b2af735;p=build.git Interesting bug. If you call a previously invoked function with a missing argument, then instead of using the default value provided in the def, it uses the last value bound to the variable. --- diff --git a/run-nightlies.py b/run-nightlies.py index 3e742ec3..e1e635df 100755 --- a/run-nightlies.py +++ b/run-nightlies.py @@ -5,7 +5,8 @@ import os import re # Assemble a list of builds from a single build spec -def interpret_build(build, param_names, current_concrete_build={}, concrete_build_list=[]): +def interpret_build(concrete_build_list, build, param_names, current_concrete_build={}, concrete_build_list=[]): + if (param_names==[]): concrete_build_list.extend([current_concrete_build]) else: @@ -70,12 +71,15 @@ def reduce_dependencies(concrete_build): # Turn build parameter dicts into commandlines and execute them def process_builds (builds, build_names, default_build): for build_name in build_names: + import pdb + pdb.set_trace() build = complete_build_spec_with_defaults (builds[build_name], default_build) - concrete_builds_without_deps = interpret_build (build, build.keys()) - concrete_builds = map(lambda cb: reduce_dependencies(cb), concrete_builds_without_deps) - for concrete_build in concrete_builds: - build_commandline = concrete_build_to_commandline(concrete_build) - os.system(build_commandline) + concrete_builds_without_deps = interpret_build (build, build.keys(), {}, []) + concrete_builds = map(reduce_dependencies, concrete_builds_without_deps) + commandlines = map(concrete_build_to_commandline, concrete_builds) + print "Number of builds for %s = %d\n"%(build_name,len(commandlines)) + for commandline in commandlines: + print commandline def main(): config_file = '/etc/build-conf-planetlab.py'