annotations: make the output of config-check more user-friendly
authorAndrea Righi <andrea.righi@canonical.com>
Fri, 7 Jul 2023 08:29:59 +0000 (10:29 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 11 Dec 2023 10:00:49 +0000 (11:00 +0100)
In case of a config change we shouldn't print an error, but a nicer
message instead explaining that the option simply changed.

Hopefully this will help to avoid all the misunderstanding that usually
happens by priting a normal change as an error.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
kconfig/run.py

index 440dcda5fa9e5a540cb348ed01060c95495a97c9..fc7485e06efb6c06bcf062db1754bf8cccbe7702 100644 (file)
@@ -268,13 +268,20 @@ def do_check(args):
             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})")
+            print(f"check-config: {conf} changed from {expected} to {value}: {policy})")
             ret = 1
         else:
             good += 1
         total += 1
 
-    print(f"check-config: {good}/{total} checks passed -- exit {ret}")
+    num = total - good
+    if ret:
+        if os.path.exists('.git'):
+            print(f"check-config: {num} config options have been changed, review them with `git diff`")
+        else:
+            print(f"check-config: {num} config options have changed")
+    else:
+        print("check-config: all good")
     sys.exit(ret)