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]
31 def callsubprocess(process_name, process, show_output = True,
32 return_output = False, env=os.environ, allowed_exit_codes = [0],
33 allow_all_exit_codes = False, stdin = None):
34 sprc = subprocess.Popen(process, stdout = subprocess.PIPE,
35 stderr = subprocess.STDOUT, stdin = subprocess.PIPE, env = env)
38 os.mkdir(os.path.join(sf(conf.log_folder), process_name))
44 sprc.stdin.write(bytes(ln + '\n', sys.getdefaultencoding()))
49 with open(os.path.join(sf(conf.log_folder),
50 process_name, time.strftime("%y-%m-%d-%H-%M-%S") + ".log"),
52 f.write('::' + time.strftime("%y-%m-%d-%H-%M-%S-%f") + '::\n')
53 for linen in sprc.stdout:
54 line = linen.decode(sys.getdefaultencoding())
59 rtn.append(line.rstrip())
62 if rtncode not in allowed_exit_codes and not allow_all_exit_codes:
63 raise exceptions.ProcessFailed(process, rtncode)
67 env = dict(os.environ)
68 env.update(conf.kernel_env)
71 def __dirty_repo__(path):
73 os.chdir(conf.absroot)
74 out = subprocess.check_output(conf.git_describe_cmd)
75 if re.search('dirty', out.decode(sys.getdefaultencoding())):
76 raise exceptions.DirtyRepository(path)
79 __dirty_repo__(conf.absroot)
80 __dirty_repo__(conf.linux_sources)