summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-10-02 12:45:24 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-10-02 12:45:24 +0200
commit45c31d42add9ea5849e47523f6e8bb402fc8198d (patch)
treec243c46c53120e19fd8c50e36966efe634ef1f25
parent03f4400a5c11d1567524a20d8d033d0ea3ad8f03 (diff)
store project name in dtree modelkconfig-modeling
-rw-r--r--lib/loader.py3
-rw-r--r--lib/model.py7
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/loader.py b/lib/loader.py
index 7835b18..dab8357 100644
--- a/lib/loader.py
+++ b/lib/loader.py
@@ -1962,6 +1962,9 @@ class KConfigAttributes:
self.kconf = kconf
self.kconfig_hash = self.file_hash(kconfig_path)
+ self.kconfig_dir = "unknown"
+ if "/" in kconfig_path:
+ self.kconfig_dir = kconfig_path.split("/")[-2]
self.symbol_names = sorted(
map(
diff --git a/lib/model.py b/lib/model.py
index 7298fc4..3ee8f8f 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -1314,6 +1314,7 @@ class KConfigModel:
for i in indices:
self.data.append(kconfig_benchmark.data[i])
self.kconfig_hash = kconfig_benchmark.kconfig_hash
+ self.project_name = kconfig_benchmark.kconfig_dir
self.symbols = kconfig_benchmark.symbol_names
self.choices = kconfig_benchmark.choice_names
self.symbol = kconfig_benchmark.symbol
@@ -1339,6 +1340,7 @@ class KConfigModel:
assert json_input["model_type"] == "kconfig-dtree"
self.attribute = json_input["attribute"]
self.kconfig_hash = json_input["kconfig_hash"]
+ self.project_name = json_input["project"]
self.symbols = json_input["symbols"]
self.choices = json_input["choices"]
self.model = self._node_from_json(json_input["model"])
@@ -1383,8 +1385,9 @@ class KConfigModel:
def to_json(self):
output = {
"model": self.model.to_json(),
- "model_type": "kconfig-dtree",
- "kconfig_hash": self.kconfig_hash,
+ "modelType": "kconfig-dtree",
+ "kconfigHash": self.kconfig_hash,
+ "project": self.project_name,
"symbols": self.symbols,
"choices": self.choices,
"attribute": self.attribute,