aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-07-28 21:56:56 +0200
committerKarel Kočí <cynerd@email.cz>2015-07-28 21:56:56 +0200
commit798da7f0a729c4c2d790b276e46b816bd53c8d47 (patch)
tree8222c0864b661306cf0078265a7756887ddced97
parent3642eed625296d4ad3b3b3c46a90914d34ad148c (diff)
downloadlinux-conf-perf-798da7f0a729c4c2d790b276e46b816bd53c8d47.tar.gz
linux-conf-perf-798da7f0a729c4c2d790b276e46b816bd53c8d47.tar.bz2
linux-conf-perf-798da7f0a729c4c2d790b276e46b816bd53c8d47.zip
Add generator identifier to configuration in database
This identifier is for recognition what generator generated specified configuration as first.
-rw-r--r--scripts/configurations.py6
-rw-r--r--scripts/database.py8
-rw-r--r--scripts/databaseinit.sql1
3 files changed, 8 insertions, 7 deletions
diff --git a/scripts/configurations.py b/scripts/configurations.py
index 313108a..5a04f38 100644
--- a/scripts/configurations.py
+++ b/scripts/configurations.py
@@ -143,7 +143,7 @@ def __calchash__(file):
hsh = hashlib.md5(bytes(cstr, 'UTF-8'))
return hsh.hexdigest()
-def __register_conf__(con, conf_num):
+def __register_conf__(con, conf_num, generator):
dtb = database.database()
# Solution to configuration
wfile = __write_temp_config_file__(con, conf_num)
@@ -158,7 +158,7 @@ def __register_conf__(con, conf_num):
# TODO this might have to be tweaked
raise Exception()
shutil.move(wfile, filen)
- dtb.add_configuration(hsh, hshf)
+ dtb.add_configuration(hsh, hshf, generator)
def __generate_single__(var_num, conf_num):
if os.path.isfile(sf(conf.single_generated_file)):
@@ -173,7 +173,7 @@ def __generate_single__(var_num, conf_num):
try:
confs = __exec_sat__(tfile, ['-i', '0'])
for con in confs:
- __register_conf__(con, conf_num)
+ __register_conf__(con, conf_num, 'single-sat')
except exceptions.NoSolution:
pass
finally:
diff --git a/scripts/database.py b/scripts/database.py
index 3db66fe..16556a8 100644
--- a/scripts/database.py
+++ b/scripts/database.py
@@ -78,17 +78,17 @@ class database:
ps(ds, cm)
return self.check_linuxgit()
- def add_configuration(self, hash, cfile):
+ def add_configuration(self, hash, cfile, generator):
"Add configuration to database."
ps = self.db.prepare("""INSERT INTO configurations
- (hash, cfile, gtime, toolgit, linuxgit)
+ (hash, cfile, gtime, toolgit, linuxgit, generator)
VALUES
- ($1, $2, $3, $4, $5);
+ ($1, $2, $3, $4, $5, $6);
""")
gt = self.check_toolsgit()
lgt = self.check_linuxgit()
tm = datetime.datetime.now()
- ps(hash, cfile, tm, gt, lgt)
+ ps(hash, cfile, tm, gt, lgt, generator)
def get_configration(self, hash):
"Return configration id for inserted hash."
diff --git a/scripts/databaseinit.sql b/scripts/databaseinit.sql
index fb765ca..1e34c75 100644
--- a/scripts/databaseinit.sql
+++ b/scripts/databaseinit.sql
@@ -16,6 +16,7 @@ CREATE TABLE linuxgit (
CREATE TABLE configurations (
id BIGSERIAL PRIMARY KEY, -- Id
hash char(32) NOT NULL, -- Hash of configuration
+ generator TEXT NOT NULL, -- Text identificator of configure generation method
cfile TEXT NOT NULL, -- File path with configuration
gtime timestamp NOT NULL, -- Time and date of generation
linuxgit BIGINT REFERENCES linuxgit (id), -- Reference to git version of Linux