aboutsummaryrefslogtreecommitdiff
path: root/scripts/utils.py
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-05-14 17:37:18 +0200
committerKarel Kočí <cynerd@email.cz>2015-05-14 17:37:18 +0200
commit2edc1883b2b62327516d91f8cdaac939570c3384 (patch)
tree3b0027c5a704e8e259e2faeb1d0213ecdf93f03c /scripts/utils.py
parent530150b34aa7dd901fe64698e6de3345588a0390 (diff)
downloadlinux-conf-perf-2edc1883b2b62327516d91f8cdaac939570c3384.tar.gz
linux-conf-perf-2edc1883b2b62327516d91f8cdaac939570c3384.tar.bz2
linux-conf-perf-2edc1883b2b62327516d91f8cdaac939570c3384.zip
Fix booting process and test target
Test target wasn't working properly. Now it should work.
Diffstat (limited to 'scripts/utils.py')
-rw-r--r--scripts/utils.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/utils.py b/scripts/utils.py
index 0b6ac9c..060aa3e 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -114,3 +114,32 @@ def config_strtoint(str):
except ValueError:
pass
return rtn
+
+def get_config_from_hash(hash):
+ with open(sf(conf.config_map_file), "r") as f:
+ for line in f:
+ w = line.rstrip().split(sep=':')
+ if w[0] == hash:
+ return config_strtoint(w[1])
+ return None
+
+def get_last_configuration():
+ hsh = ""
+ try:
+ with open(sf(conf.config_solved_file), "r") as f:
+ for line in f:
+ sline = line.rstrip()
+ if sline != '':
+ hsh = sline
+ except FileNotFoundError:
+ try:
+ with open(sf(conf.config_map_file), "r") as f:
+ w = f.readline().split(sep=':')
+ hsh = w[0]
+ except FileNotFoundError:
+ pass
+
+ if hsh != '':
+ return hsh
+ else:
+ return 'NoConfig'