]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Implement requirement generation from kernel .config
authorKarel Kočí <cynerd@email.cz>
Tue, 24 Mar 2015 21:42:56 +0000 (22:42 +0100)
committerKarel Kočí <cynerd@email.cz>
Tue, 24 Mar 2015 21:42:56 +0000 (22:42 +0100)
conf.py
scripts/initialize.py
scripts/solution.py

diff --git a/conf.py b/conf.py
index 19dfe35030c24e56a99e67503496a672405f08f5..e78e427a2085865a43ea1494c47585127d791045 100644 (file)
--- 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'
 
index 87a98b46962fea47b4e883a059615db13f01c325..2fc7d54bd65763446ad316f5d3f45bd1bf3c2169 100644 (file)
@@ -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);
index 969219e65771fe64a82c53db9e83a0340c5c61d9..fd6aa239ab4c1913a755414ab9e49c50f18ee9ef 100644 (file)
@@ -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