From: Andrea Righi Date: Fri, 20 Oct 2023 07:42:57 +0000 (+0200) Subject: annotations: update: update note when config is changing X-Git-Tag: v0.2~19 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=1f99516dc0cc0e3243e6c870b141b6a613b81d7a;p=annotations.git annotations: update: update note when config is changing When a new .config is imported some values may change, but the corresponding note is not always updated to reflect the new value. This is wrong and it can lead to errors and incorrect information in the annotations file. To prevent this from happening automatically add a TODO note when any config with a note is changing to force the reviewer to update the note. Signed-off-by: Andrea Righi --- diff --git a/kconfig/annotations.py b/kconfig/annotations.py index 7a23d2b..145523c 100644 --- a/kconfig/annotations.py +++ b/kconfig/annotations.py @@ -238,6 +238,14 @@ class Annotation(Config): val = "-" if conf in self.config: if "policy" in self.config[conf]: + # Add a TODO if a config with a note is changing and print + # a warning + old_val = self.search_config(config=conf, arch=arch, flavour=flavour) + if old_val: + old_val = old_val[conf] + if val != old_val and "note" in self.config[conf]: + self.config[conf]['note'] = "TODO: update note" + print(f"WARNING: {conf} changed from {old_val} to {val}, updating note") self.config[conf]["policy"][flavour] = val else: self.config[conf]["policy"] = {flavour: val}