From ef85245f159402fd948ff045b56ad9095d22b39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 3 Feb 2015 20:57:20 +0100 Subject: Implementing main loop These new scripts are part of main loop. kernel is not finished!! Divides kconfig_parser, sat_solution to better named modules. Phasing and iteration is implemented for loop watching. --- scripts/initialize.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 scripts/initialize.py (limited to 'scripts/initialize.py') diff --git a/scripts/initialize.py b/scripts/initialize.py new file mode 100644 index 0000000..2895444 --- /dev/null +++ b/scripts/initialize.py @@ -0,0 +1,42 @@ +import os +import sys +import subprocess + +import utils +from conf import conf +from exceptions import MissingFile + +def kconfig_parser(): + "Execute kconfig_parser in linux_sources directory and parsed output is placed to build_folder." + env = dict(os.environ) + env['SRCARCH'] = conf.SRCARCH + env['ARCH'] = conf.ARCH + env['KERNELVERSION'] = 'KERNELVERSION' # hides error + wd = os.getcwd() + os.chdir(conf.linux_sources) + subprocess.call([conf.kconfig_parser, conf.linux_kconfig_head, conf.build_folder], env=env) + os.chdir(wd) + +def gen_requred(): + "Generates required depenpency from required file." + utils.build_symbol_map() + srmap = {value:key for key, value in utils.smap.items()} + + if not os.path.isfile(conf.required): + raise MissingFile(conf.required, None) + + try: + os.remove(conf.required_file) + except OSError: + pass + + with open(conf.required_file, 'w') as fout: + with open(conf.required, 'r') as f: + for line in f: + for word in line.rstrip().split(): + if word[0] == '-': + fout.write('-') + word = word[1:] + fout.write(srmap[word] + " ") + fout.write("\n") + -- cgit v1.2.3