From: Andrea Righi Date: Tue, 15 Nov 2022 09:47:08 +0000 (+0100) Subject: annotations: allow to import/resync single config option X-Git-Tag: v0.1~64 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=9d8fe884a1936108be6b1d4e67b683eacab0274c;p=annotations.git annotations: allow to import/resync single config option Signed-off-by: Andrea Righi --- diff --git a/annotations b/annotations index e5aac6f..5673565 100755 --- a/annotations +++ b/annotations @@ -66,7 +66,7 @@ def do_import(args): # Merge with the current annotations c = KConfig(args.import_file) a = Annotation(args.file) - a.update(c, args.arch, args.flavour) + a.update(c, arch=args.arch, flavour=args.flavour, config=args.config) # Save back to annotations a.save(args.file) @@ -102,6 +102,8 @@ def do_check(args): value = c.config[conf] if conf in c.config else '-' if value != expected: policy = a.config[conf] if conf in a.config else 'undefined' + if 'policy' in policy: + policy = f"policy<{policy['policy']}>" print(f"check-config: FAIL: ({value} != {expected}): {conf} {policy})") ret = 1 else: diff --git a/kconfig/annotations.py b/kconfig/annotations.py index d9acb93..1b2a791 100644 --- a/kconfig/annotations.py +++ b/kconfig/annotations.py @@ -110,11 +110,15 @@ class Annotation(Config): raise Exception(str(e) + f', line = {line}') return config - def update(self, c: KConfig, arch: str, flavour: str = None): + def update(self, c: KConfig, arch: str, flavour: str = None, config: str = None): """ Merge configs from a Kconfig object into Annotation object """ - a_configs = self.search_config(arch=arch, flavour=flavour).keys() - c_configs = c.config.keys() + # Determine if we need to import all configs or a single config + if config is None: + a_configs = self.search_config(arch=arch, flavour=flavour).keys() + c_configs = c.config.keys() + else: + a_configs = c_configs = {config} # Import configs from the Kconfig object into Annotations if flavour is not None: