diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/configurations.py | 15 | ||||
-rw-r--r-- | scripts/database.py | 6 | ||||
-rw-r--r-- | scripts/kernel.py | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/scripts/configurations.py b/scripts/configurations.py index 428e214..63c4016 100644 --- a/scripts/configurations.py +++ b/scripts/configurations.py @@ -84,26 +84,29 @@ def __exec_sat__(file, args, conf_num): return con def __txt_config__(con): - txt = '' + config = [] for key, val in con.items(): - txt += 'CONFIG_' + key + '=' + txt = 'CONFIG_' + key + '=' if val: txt += 'y' else: txt += 'n' - txt += '\n' - return txt + config.append(txt) + return config def __write_temp_config_file__(con): wfile = tempfile.NamedTemporaryFile(delete=False) txt = __txt_config__(con) - wfile.write(bytes(txt, sys.getdefaultencoding())) + for ln in txt: + wfile.write(bytes(ln + '\n', sys.getdefaultencoding())) wfile.close() return wfile.name def __load_config_text__(txt): rtn = dict() for ln in txt: + if not ln: + continue if ln[0] == '#' or not '=' in ln: continue indx = ln.index('=') @@ -160,7 +163,7 @@ def __register_conf__(con, conf_num, generator): cconf = dtb.get_configration(hsh) for cc in cconf: print('hash: ' + hsh) - if compare_text(cc, txtconfig): + if compare_text(cc.config, txtconfig): print("I: Generated existing configuration.") return False else: diff --git a/scripts/database.py b/scripts/database.py index df89a9a..8664393 100644 --- a/scripts/database.py +++ b/scripts/database.py @@ -88,7 +88,7 @@ class database: gt = self.check_toolsgit() lgt = self.check_linuxgit() tm = datetime.datetime.now() - ps(hash, txtconfig, tm, gt, lgt, generator) + ps(hash, '\n'.join(txtconfig), tm, gt, lgt, generator) def get_configration(self, hash): "Return configration id for inserted hash." @@ -96,7 +96,7 @@ class database: WHERE hash = $1""") rtn = [] for dt in ps(hash): - rtn.append(Config(dt[0], hash, dt[1])) + rtn.append(Config(dt[0], hash, dt[1].split('\n'))) return rtn def add_measure(self, output, conf_id, value = None): @@ -138,7 +138,7 @@ class database: """) rtn = [] for dt in ps(): - rtn.append(Config(dt[0], dt[1], dt[2])) + rtn.append(Config(dt[0], dt[1], dt[2].split('\n'))) return rtn def add_configsort(self, configopt): diff --git a/scripts/kernel.py b/scripts/kernel.py index 8bc147d..0b374c4 100644 --- a/scripts/kernel.py +++ b/scripts/kernel.py @@ -12,7 +12,8 @@ import utils def config(txtconfig): "Apply text configuration to kernel folder" infile = tempfile.NamedTemporaryFile() - infile.write(bytes(txtconfig, sys.getdefaultencoding())) + for ln in infile: + infile.write(bytes(ln + '\n', sys.getdefaultencoding())) wd = os.getcwd() os.chdir(sf(conf.linux_sources)) try: |