11 def build_symbol_map():
12 """Generates global variable smap from symbol_map_file.
13 When file not exists, MissingFile exception is raised.
19 # Check if symbol_map_file exist
20 if not os.path.isfile(sf(conf.symbol_map_file)):
21 raise exceptions.MissingFile(sf(conf.symbol_map_file),
22 "Run parse_kconfig to generate it.")
25 with open(sf(conf.symbol_map_file)) as f:
27 w = lnn.rstrip().split(sep=':')
28 smap[int(w[0])] = w[1]
32 """Generates global variable cmap from config_map_file and config_solved_file.
33 cmap is dictionary containing list ([configuration], bool solved)
34 cmap is rebuild every time this function is called.
38 if os.path.isfile(sf(conf.config_map_file)):
39 with open(sf(conf.config_map_file)) as f:
41 w = ln.rstrip().split(sep=':')
43 for vr in w[1].split(sep=" "):
45 cf.append(-1 * int(vf[1:]))
47 cmap[w[0]] = [w[1], False]
49 if os.path.isfile(sf(conf.config_solved_file)):
50 with open(sf(conf.config_solved_file)) as f:
53 cmap[ln.rstrip()][1] = True
58 def callsubprocess(process_name, process, show_output = True, regular = "",
61 os.mkdir(sf(conf.log_folder))
65 sprc = subprocess.Popen(process, stdout = subprocess.PIPE, env = env)
68 with open(os.path.join(sf(conf.log_folder), process_name + ".log"), "a") as f:
69 f.write("::" + time.strftime("%y-%m-%d-%H-%M-%S") + "::\n")
70 for linen in sprc.stdout:
71 line = linen.decode(sys.getdefaultencoding())
75 if re.search(regular, line):
80 raise exceptions.ProcessFailed(process, rtncode)
85 env = dict(os.environ)
86 env['SRCARCH'] = conf.SRCARCH
87 env['ARCH'] = conf.ARCH
88 env['KERNELVERSION'] = 'KERNELVERSION' # hides error
93 """Hashes configuration using MD5 hash.
105 hsh = hashlib.md5(bytes(str, sys.getdefaultencoding()))
106 return hsh.hexdigest()
108 def config_strtoint(str):
109 """Reads list of configured symbols from string
112 for s in str.split(sep=' '):