From 9ca8696a489b5c16a2239213919c9e8b7f8c55d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 19 Aug 2015 21:44:16 +0200 Subject: Fix wrong input type to compare_text in register_conf --- scripts/configurations.py | 15 +++++++++------ scripts/database.py | 6 +++--- scripts/kernel.py | 3 ++- targets/ryuglab/conf.py | 2 +- 4 files changed, 15 insertions(+), 11 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: diff --git a/targets/ryuglab/conf.py b/targets/ryuglab/conf.py index 2ed474f..11d8a14 100644 --- a/targets/ryuglab/conf.py +++ b/targets/ryuglab/conf.py @@ -4,7 +4,7 @@ kernel_arch = 'powerpc' kernel_env = {'SRCARCH': kernel_arch, 'ARCH': kernel_arch, 'KERNELVERSION': kernel_arch} -build_command = ['make'] +build_command = ['make', 'uImage'] boot_command = ['targets/ryuglab/boot/boot'] parse_command = ['tests/cyclictest/parse'] -- cgit v1.2.3