diff mbox series

[next,v3,3/3] utils/check-package: remove hard-coded list from lib_config:Indent

Message ID 20230903163509.614740-4-ricardo.martincoski@gmail.com
State New
Headers show
Series check-package: support inline flags v3 | expand

Commit Message

Ricardo Martincoski Sept. 3, 2023, 4:35 p.m. UTC
From: James Knight <james.d.knight@live.com>

Apply a special comment enabling the flag
Indent_ignore-menu-indent-below to all configuration files intree that
allow indentation, allowing these special files to removed from an
internal list hard-coded inside `checkpackagelib/lib_config.py`.

A great side effect of this new type of special comment is that it can
also be used in source files from br2-external trees.

Signed-off-by: James Knight <james.d.knight@live.com>
[Ricardo: update commit message after rebase]
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
---
Changes v1 -> v3:
  - rebase patch 4/4, update commit message
  - rename the flag

https://gitlab.com/RicardoMartincoski/buildroot/-/pipelines/990316889
---
 package/Config.in                   | 2 ++
 package/Config.in.host              | 2 ++
 package/kodi/Config.in              | 2 ++
 package/x11r7/Config.in             | 2 ++
 utils/checkpackagelib/lib_config.py | 8 +++-----
 5 files changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index b21a2f8c65..231e8101c9 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1,3 +1,5 @@ 
+# check-package Indent_ignore-menu-indent-below
+
 menu "Target packages"
 
 	source "package/busybox/Config.in"
diff --git a/package/Config.in.host b/package/Config.in.host
index 22e0dc64d4..2a96456db6 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -1,3 +1,5 @@ 
+# check-package Indent_ignore-menu-indent-below
+
 menu "Host utilities"
 
 	source "package/abootimg/Config.in.host"
diff --git a/package/kodi/Config.in b/package/kodi/Config.in
index 6b68e6d504..f6d5dbe4d8 100644
--- a/package/kodi/Config.in
+++ b/package/kodi/Config.in
@@ -1,3 +1,5 @@ 
+# check-package Indent_ignore-menu-indent-below
+
 config BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	bool
 	default y if BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS
diff --git a/package/x11r7/Config.in b/package/x11r7/Config.in
index b91f97bb34..9cb3596b24 100644
--- a/package/x11r7/Config.in
+++ b/package/x11r7/Config.in
@@ -1,3 +1,5 @@ 
+# check-package Indent_ignore-menu-indent-below
+
 menuconfig BR2_PACKAGE_XORG7
 	bool "X.org X Window System"
 	depends on BR2_USE_WCHAR
diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py
index f26ca0d898..e2f7302485 100644
--- a/utils/checkpackagelib/lib_config.py
+++ b/utils/checkpackagelib/lib_config.py
@@ -187,6 +187,7 @@  class HelpText(_CheckFunction):
 
 
 class Indent(_CheckFunction):
+    flags = ["ignore-menu-indent-below"]
     ENDS_WITH_BACKSLASH = re.compile(r"^[^#].*\\$")
     entries_that_should_be_indented = [
         "bool", "default", "depends", "help", "prompt", "select", "string"]
@@ -224,11 +225,8 @@  class Indent(_CheckFunction):
                         text]
         elif entry in entries_that_should_not_be_indented:
             if not text.startswith(entry):
-                # four Config.in files have a special but legitimate indentation rule
-                if self.filename in ["package/Config.in",
-                                     "package/Config.in.host",
-                                     "package/kodi/Config.in",
-                                     "package/x11r7/Config.in"]:
+                # some Config.in files have a special but legitimate indentation rule
+                if self.enabled_flags["ignore-menu-indent-below"]:
                     return
                 return ["{}:{}: should not be indented"
                         .format(self.filename, lineno),