diff options
author | Karel Kočí <cynerd@email.cz> | 2015-03-24 22:42:56 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-03-24 22:42:56 +0100 |
commit | 158653da512d7ace39e3cacc796e95ad8a4bbaab (patch) | |
tree | 163e3069d7ee8461d0082cc1782c2b4d50846a6c /scripts | |
parent | a00843349ff803bc6a9aca8424cdf9843178e12b (diff) | |
download | linux-conf-perf-158653da512d7ace39e3cacc796e95ad8a4bbaab.tar.gz linux-conf-perf-158653da512d7ace39e3cacc796e95ad8a4bbaab.tar.bz2 linux-conf-perf-158653da512d7ace39e3cacc796e95ad8a4bbaab.zip |
Implement requirement generation from kernel .config
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/initialize.py | 27 | ||||
-rw-r--r-- | scripts/solution.py | 4 |
2 files changed, 18 insertions, 13 deletions
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 |