From 45c31d42add9ea5849e47523f6e8bb402fc8198d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 2 Oct 2020 12:45:24 +0200 Subject: store project name in dtree model --- lib/loader.py | 3 +++ lib/model.py | 7 +++++-- 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, -- cgit v1.2.3