aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf.py2
-rw-r--r--scripts/initialize.py27
-rw-r--r--scripts/solution.py4
3 files changed, 19 insertions, 14 deletions
diff --git a/conf.py b/conf.py
index 19dfe35..e78e427 100644
--- a/conf.py
+++ b/conf.py
@@ -20,13 +20,13 @@ linux_make_args = ['-j8']
linux_sources = pf('linux')
linux_kconfig_head = 'Kconfig'
-required = pf('required')
build_folder = pf('build/')
phase_file = build_folder + '/phase'
symbol_map_file = build_folder + '/symbol_map' # Also defined in kconfig_parser
rules_file = build_folder + '/rules' # Also defined in kconfig_parser
solved_file = build_folder + '/solved'
required_file = build_folder + '/required'
+dot_config_file = build_folder + '/dot_config'
solution_file = build_folder + '/solution'
iteration_file = build_folder + '/iteration'
diff --git a/scripts/initialize.py b/scripts/initialize.py
index 87a98b4..2fc7d54 100644
--- a/scripts/initialize.py
+++ b/scripts/initialize.py
@@ -25,22 +25,23 @@ 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)
+ os.remove(conf.dot_config_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")
-
+ with open(conf.linux_sources + '/.config', 'r') as f:
+ with open(conf.required_file, 'w') as freq:
+ with open(conf.dot_config_file, 'w') as fconf:
+ for line in f:
+ if (line[0] == '#') or (not '=' in line):
+ continue
+ indx = line.index('=')
+ if (line[indx + 1] == 'y' or line[indx + 1] == 'm'):
+ freq.write(srmap[line[7:indx]] + "\n")
+ elif (line[indx + 1] == 'n'):
+ freq.write("-" + srmap[line[7:indx]] + "\n")
+ else:
+ fconf.write(line);
diff --git a/scripts/solution.py b/scripts/solution.py
index 969219e..fd6aa23 100644
--- a/scripts/solution.py
+++ b/scripts/solution.py
@@ -90,6 +90,10 @@ def apply():
# Write solution to .config file in linux source folder
with open(conf.linux_sources + '/.config', 'w') as f:
+ with open(conf.dot_config_file, 'r') as fconf:
+ for line in fconf:
+ f.write(line)
+
for txt in solut:
if txt[0] == '-':
nt = True