This identifier is for recognition what generator generated specified configuration as first.
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)
# 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)):
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:
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."
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