Skip to contentSkip to conversation

check-package: support inline flags v3

PATCH New Ricardo Martincoski 4 participants 22 messages Sep 3, 2023 – Nov 10

lore
Share & tools
lore
#0 lore raw

v3 cover check-package: support inline flags v3

Hello,

This small series tries to make easier to support a new type of special comment in source files, recognized by check-package.
It is a v3 for:
- v1, 4 patches: support ignore-indent for check-package configs [1]
- v2, patch 1 Accepted in 'next': utils/check-package: cleanup line reading [2]

Patch 1 prepares the code.
Patch 2 do the equivalent to v1 patches 2 and 3.
Patch 3 do the equivalent to v1 patch 4.

Cc James Knight <[email protected]>
Cc Thomas Petazzoni <[email protected]>

James, Thomas,

Please feel free to rework or even completely drop this v2. It is an attempt to make easier to the new code to arrive in the code base. It is NOT a way to say 'I dislike v1'.

Regards,
Ricardo

[1] http://patchwork.ozlabs.org/project/buildroot/list/?series=352915&state=*&q=&archive=&delegate=
[2] http://patchwork.ozlabs.org/project/buildroot/patch/CYYP221MB114006AE3D1C77F421E44B43A0EBA@CYYP221MB1140.NAMP221.PROD.OUTLOOK.COM/

James Knight (1):
utils/check-package: remove hard-coded list from lib_config:Indent

Ricardo Martincoski (2):
utils/check-package: factor-out check_disabled() utils/check-package: support inline flags

 package/Config.in                   |   2 +
 package/Config.in.host              |   2 +
 package/kodi/Config.in              |   2 +
 package/x11r7/Config.in             |   2 +
 utils/check-package                 |   2 +-
 utils/checkpackagelib/base.py       |  21 ++++-
 utils/checkpackagelib/lib_config.py |   8 +-
 utils/checkpackagelib/test_base.py  | 131 ++++++++++++++++++++++++++++
 utils/checkpackagelib/test_util.py  |   5 +-
 9 files changed, 167 insertions(+), 8 deletions(-)
 create mode 100644 utils/checkpackagelib/test_base.py
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v3 1/3 utils/check-package: factor-out check_disabled()

Currently source files analysed by check-package can use a special comment to hint the script to completely ignore a CheckFunction for the next line of the source file:

    # check-package Indent

Currently the logic that implements this is at the main check-package script. But the main package script is not covered by unit tests.

In preparation to support not only
'ignore this CheckFunction for the next source line'
but also
'use special rules for this CheckFunction when testing this file' move the logic that parses such special comments into the base class _CheckFunction.

At same time, create unit tests that exercise such code.

Cc James Knight <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v3:
- new patch, implementing a code improvement detected while reviewing v1 of this series

https://gitlab.com/RicardoMartincoski/buildroot/-/pipelines/990306862

---
 utils/check-package                |  2 +-
 utils/checkpackagelib/base.py      |  5 +++
 utils/checkpackagelib/test_base.py | 49 ++++++++++++++++++++++++++++++
 utils/checkpackagelib/test_util.py |  5 ++-
 4 files changed, 59 insertions(+), 2 deletions(-)
 create mode 100644 utils/checkpackagelib/test_base.py
utils/check-package +1 -1
index 105902303e..23d250d4a1 100755
@@ -237,7 +237,7 @@ def check_file_using_lib(fname):
         for lineno, text in enumerate(f):
             nlines += 1
             for name, cf in objects:
-                if cf.disable.search(lastline):
+                if cf.check_disabled(lastline):
                     continue
                 line_sts = cf.check_line(lineno + 1, text)
                 warn, fail = print_warnings(line_sts, name in xfail)
utils/checkpackagelib/base.py +5 -0
index f666e4110b..15a304acf3 100644
@@ -8,6 +8,11 @@ class _CheckFunction(object):
         self.url_to_manual = url_to_manual
         self.disable = re.compile(r"^\s*# check-package .*\b{}\b".format(self.__class__.__name__))
 
+    def check_disabled(self, line_before):
+        if self.disable.search(line_before):
+            return True
+        return False
+
     def before(self):
         pass
 
utils/checkpackagelib/test_base.py new file +49 -0

49 lines not on this page · raw message

utils/checkpackagelib/test_util.py +4 -1
index 23f2995e27..b06e218498 100644
@@ -2,7 +2,10 @@ def check_file(check_function, filename, string):
     obj = check_function(filename, 'url')
     result = []
     result.append(obj.before())
+    lastline = ""
     for i, line in enumerate(string.splitlines(True)):
-        result.append(obj.check_line(i + 1, line))
+        if not obj.check_disabled(lastline):
+            result.append(obj.check_line(i + 1, line))
+        lastline = line
     result.append(obj.after())
     return [r for r in result if r is not None]
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v3 2/3 utils/check-package: support inline flags

In reply to Ricardo Martincoski

Currently source files analysed by check-package can use a special comment to hint the script to completely ignore a CheckFunction for the next line of the source file:

    # check-package Indent

Extend that functionality to also support flags that will trigger special behaviour.
For instance, by adding the line to a Config.in file:

    # check-package Indent_ignore-menu-indent-below

makes the CheckFunction named Indent to set a flag named ignore-menu-indent-below and use it until the end of the source file under test.

One example of use for this new special comment is Indent() from lib_config.py, that currently keeps a list of 4 intree Config.in files that have a special but legitimate indentation rule. Instead of keeping the list inside the code, now a special comment can be used in each of these 4 Config.in files.

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.

Concept reused from James Knight's work in [1] and [2].
[1] http://patchwork.ozlabs.org/project/buildroot/patch/SN4P221MB0682AE13FB1ACA5A755024F1A0689@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM/
[2] http://patchwork.ozlabs.org/project/buildroot/patch/SN4P221MB06823B0F7326D27ECD5E0FAEA0689@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM/

Cc James Knight <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v3:
- rewrite the code from scratch for patches 2/4 and 3/4, moving it to the base class
- add unit tests

https://gitlab.com/RicardoMartincoski/buildroot/-/pipelines/990309342

---
 utils/checkpackagelib/base.py      | 20 ++++++--
 utils/checkpackagelib/test_base.py | 82 ++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 3 deletions(-)
utils/checkpackagelib/base.py +17 -3
index 15a304acf3..d17b9d899f 100644
@@ -3,14 +3,28 @@ import re
 
 
 class _CheckFunction(object):
+    flags = []
+
     def __init__(self, filename, url_to_manual):
         self.filename = filename
         self.url_to_manual = url_to_manual
-        self.disable = re.compile(r"^\s*# check-package .*\b{}\b".format(self.__class__.__name__))
+        if self.flags:
+            flags_pattern = '|_' + '|_'.join(self.flags)
+        else:
+            flags_pattern = ''
+        self.disable = re.compile(r"^\s*# check-package .*\b{}({})\b".format(self.__class__.__name__, flags_pattern))
+        self.enabled_flags = {f: False for f in self.flags}
 
     def check_disabled(self, line_before):
-        if self.disable.search(line_before):
-            return True
+        found = self.disable.findall(line_before)
+        if found:
+            # catch flags to be used by CheckFunction for a source file, for all lines below
+            flags_found = [f[1:] for f in found if (f != '' and f[0] == '_')]
+            for f in flags_found:
+                self.enabled_flags[f] = True
+
+            ignore_this_line = '' in found
+            return ignore_this_line
         return False
 
     def before(self):
utils/checkpackagelib/test_base.py +82 -0

85 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH v3 3/3 utils/check-package: remove hard-coded list from lib_config:Indent

In reply to Ricardo Martincoski

From: James Knight <[email protected]>

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.

[Ricardo: update commit message after rebase]
Cc Thomas Petazzoni <[email protected]>

---
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(-)
package/Config.in +2 -0
index b21a2f8c65..231e8101c9 100644
@@ -1,3 +1,5 @@
+# check-package Indent_ignore-menu-indent-below
+
 menu "Target packages"
 
 	source "package/busybox/Config.in"
package/Config.in.host +2 -0
index 22e0dc64d4..2a96456db6 100644
@@ -1,3 +1,5 @@
+# check-package Indent_ignore-menu-indent-below
+
 menu "Host utilities"
 
 	source "package/abootimg/Config.in.host"
package/kodi/Config.in +2 -0
index 6b68e6d504..f6d5dbe4d8 100644
@@ -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
package/x11r7/Config.in +2 -0
index b91f97bb34..9cb3596b24 100644
@@ -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
utils/checkpackagelib/lib_config.py +3 -5
index f26ca0d898..e2f7302485 100644
@@ -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),
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

v4 cover check-package: warn about symbols not recognized by a package infra, support inline flags

In reply to Ricardo Martincoski

This series resurrects two check-package series sent by Ricardo Martincoski in 2023, which never got a review and have been sitting on patchwork since then:

- "check-package: warn about symbols not recognized by a package infra" (January 2023): the fixes of the tree and patch 29 were applied, but the two new checks, patches 27 and 28, were not;
- "check-package: support inline flags" v3 (September 2023), which lets a file enable special rules of a check with a comment, and removes the list of Config.in files hard-coded in lib_config:Indent.

Both are rebased on current master and sent together, since they touch the same code. This is v4 after the inline flags series; the two checks were only sent once, as v1.

Patches 1 to 3 are the inline flags series, with only a conflict solved in the first one.

Patches 14 and 15 are the two checks: TypoInVariableSuffix warns about variables that the package infra used in the file does not know and that nothing else uses, DisabledInstall about install hooks that never run because the installation step is disabled. After almost four years, the lists of variables known by each infra were outdated, and the checks gave about 250 warnings on the current tree, so they are updated in patch 14 with the variables added to the infras in the meantime.

The remaining warnings are all real problems: variables misspelled or left behind by conversions to another infra. Rather than adding these files to .checkpackageignore, patches 4 to 13 fix them, as the original series did with its first 24 patches, so that the checks can go in with no new entry in the ignore list but one:

- the license file of andes-spi-burn was never saved nor checked;
- the configure options of usbip were never passed;
- linux-pam has not been linked with libintl and libatomic since its move to meson, which breaks the build with an external libintl, as seen by the autobuilders (also in 2026.02.x);
- fbv, postgresql, libselinux, zfs, mesa3d, nxp-mwifiex and libglib2-bootstrap only had dead variables, removed with no change in the build.

The one entry left in .checkpackageignore is gcc-final: its m68k ColdFire libgcc fixup hook is registered under a wrong name since 2023, so it never runs, but fixing it changes the ColdFire internal toolchain and deserves its own patch and test.

This series supersedes the following patches, which can be marked as superseded on patchwork:

- [27/29] utils/check-package: warn about symbols not recognized by a package infra (patch 14 of this series)
https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
- [28/29] utils/check-package: warn about disabled install (patch 15)
https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
- [next,v3,1/3] utils/check-package: factor-out check_disabled() (patch 1)
https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
- [next,v3,2/3] utils/check-package: support inline flags (patch 2)
https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
- [next,v3,3/3] utils/check-package: remove hard-coded list from lib_config:Indent (patch 3)
https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/

Each patch has its own "Changes" notes.

Angelo Compagnucci (10):
package/andes-spi-burn: fix the license files variable package/fbv: drop the unused configure options package/usbip: fix the configure options variable package/postgresql: drop the unused install-world options package/libselinux: drop the unused make environment package/zfs: drop the unused module subdirectories package/mesa3d: drop the unused host Vulkan drivers package/nxp-mwifiex: drop the unused make options package/libglib2/libglib2-bootstrap: drop unused variables package/linux-pam: fix linking with the NLS and atomic libraries

James Knight (1):
utils/check-package: remove hard-coded list from lib_config:Indent

Ricardo Martincoski (4):
utils/check-package: factor-out check_disabled() utils/check-package: support inline flags utils/check-package: warn about symbols not recognized by a package
infra
utils/check-package: warn about disabled install

 .checkpackageignore                           |   1 +
 fs/initramfs/initramfs.mk                     |   1 +
 linux/linux-ext-xenomai.mk                    |   2 +-
 package/Config.in                             |   2 +
 package/Config.in.host                        |   2 +
 package/andes-spi-burn/andes-spi-burn.hash    |   2 +-
 package/andes-spi-burn/andes-spi-burn.mk      |   2 +-
 package/fbv/fbv.mk                            |  13 +-
 package/kodi/Config.in                        |   2 +
 .../libglib2-bootstrap/libglib2-bootstrap.mk  |   3 -
 package/libselinux/libselinux.mk              |   3 -
 package/linux-pam/linux-pam.mk                |   2 +-
 package/luarocks/luarocks.mk                  |   2 +
 package/mesa3d/mesa3d.mk                      |   1 -
 package/nxp-mwifiex/nxp-mwifiex.mk            |   2 -
 package/postgresql/postgresql.mk              |   2 -
 package/usbip/usbip.mk                        |   2 +-
 package/x11r7/Config.in                       |   2 +
 package/zfs/zfs.mk                            |  12 -
 toolchain/toolchain.mk                        |   2 +
 utils/check-package                           |  21 +-
 utils/checkpackagelib/base.py                 |  21 +-
 utils/checkpackagelib/lib_config.py           |   8 +-
 utils/checkpackagelib/lib_mk.py               | 209 +++++++
 utils/checkpackagelib/pkg_infra.py            | 322 ++++++++++
 utils/checkpackagelib/test_base.py            | 131 +++++
 utils/checkpackagelib/test_lib_mk.py          | 555 ++++++++++++++++++
 utils/checkpackagelib/test_util.py            |   5 +-
 28 files changed, 1279 insertions(+), 53 deletions(-)
 create mode 100644 utils/checkpackagelib/pkg_infra.py
 create mode 100644 utils/checkpackagelib/test_base.py
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v4 1/15 utils/check-package: factor-out check_disabled()

From: Ricardo Martincoski <[email protected]>

Currently source files analysed by check-package can use a special comment to hint the script to completely ignore a CheckFunction for the next line of the source file:

    # check-package Indent

Currently the logic that implements this is at the main check-package script. But the main package script is not covered by unit tests.

In preparation to support not only
'ignore this CheckFunction for the next source line'
but also
'use special rules for this CheckFunction when testing this file' move the logic that parses such special comments into the base class _CheckFunction.

At same time, create unit tests that exercise such code.

---
Changes v3 -> v4:
- rebase on current master: check_file_using_lib() now reads the file in a try/except and also skips the after() check of a disabled function; use check_disabled() there too;
- send together with the package infra checks of the "warn about symbols not recognized by a package infra" series and the fixes they need.

 utils/check-package                |  4 +--
 utils/checkpackagelib/base.py      |  5 +++
 utils/checkpackagelib/test_base.py | 49 ++++++++++++++++++++++++++++++
 utils/checkpackagelib/test_util.py |  5 ++-
 4 files changed, 60 insertions(+), 3 deletions(-)
 create mode 100644 utils/checkpackagelib/test_base.py
utils/check-package +2 -2
index aa10280f4d..f9978adef4 100755
@@ -262,7 +262,7 @@ def check_file_using_lib(fname):
             for lineno, text in enumerate(f):
                 nlines += 1
                 for name, cf in objects:
-                    if cf.disable.search(lastline):
+                    if cf.check_disabled(lastline):
                         continue
                     line_sts = cf.check_line(lineno + 1, text)
                     warn, fail = print_warnings(line_sts, name in xfail)
@@ -276,7 +276,7 @@ def check_file_using_lib(fname):
         return nwarnings, nlines
 
     for name, cf in objects:
-        if cf.disable.search(lastline):
+        if cf.check_disabled(lastline):
             continue
         warn, fail = print_warnings(cf.after(), name in xfail)
         if fail > 0:
utils/checkpackagelib/base.py +5 -0
index 0ab6eba9f6..4636eca3a6 100644
@@ -9,6 +9,11 @@ class _CheckFunction(object):
         self.url_to_manual = url_to_manual
         self.disable = re.compile(r"^\s*# check-package .*\b{}\b".format(self.__class__.__name__))
 
+    def check_disabled(self, line_before):
+        if self.disable.search(line_before):
+            return True
+        return False
+
     def before(self):
         pass
 
utils/checkpackagelib/test_base.py new file +49 -0

49 lines not on this page · raw message

utils/checkpackagelib/test_util.py +4 -1
index 23f2995e27..b06e218498 100644
@@ -2,7 +2,10 @@ def check_file(check_function, filename, string):
     obj = check_function(filename, 'url')
     result = []
     result.append(obj.before())
+    lastline = ""
     for i, line in enumerate(string.splitlines(True)):
-        result.append(obj.check_line(i + 1, line))
+        if not obj.check_disabled(lastline):
+            result.append(obj.check_line(i + 1, line))
+        lastline = line
     result.append(obj.after())
     return [r for r in result if r is not None]
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH v4 2/15 utils/check-package: support inline flags

In reply to Angelo Compagnucci

From: Ricardo Martincoski <[email protected]>

Currently source files analysed by check-package can use a special comment to hint the script to completely ignore a CheckFunction for the next line of the source file:

    # check-package Indent

Extend that functionality to also support flags that will trigger special behaviour.
For instance, by adding the line to a Config.in file:

    # check-package Indent_ignore-menu-indent-below

makes the CheckFunction named Indent to set a flag named ignore-menu-indent-below and use it until the end of the source file under test.

One example of use for this new special comment is Indent() from lib_config.py, that currently keeps a list of 4 intree Config.in files that have a special but legitimate indentation rule. Instead of keeping the list inside the code, now a special comment can be used in each of these 4 Config.in files.

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.

Concept reused from James Knight's work in [1] and [2].
[1] http://patchwork.ozlabs.org/project/buildroot/patch/SN4P221MB0682AE13FB1ACA5A755024F1A0689@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM/
[2] http://patchwork.ozlabs.org/project/buildroot/patch/SN4P221MB06823B0F7326D27ECD5E0FAEA0689@SN4P221MB0682.NAMP221.PROD.OUTLOOK.COM/

Cc James Knight <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v3 -> v4:
- none (rebased on current master).

 utils/checkpackagelib/base.py      | 20 ++++++--
 utils/checkpackagelib/test_base.py | 82 ++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 3 deletions(-)
utils/checkpackagelib/base.py +17 -3
index 4636eca3a6..a3aff9e3d8 100644
@@ -4,14 +4,28 @@ import os
 
 
 class _CheckFunction(object):
+    flags = []
+
     def __init__(self, filename, url_to_manual):
         self.filename = filename
         self.url_to_manual = url_to_manual
-        self.disable = re.compile(r"^\s*# check-package .*\b{}\b".format(self.__class__.__name__))
+        if self.flags:
+            flags_pattern = '|_' + '|_'.join(self.flags)
+        else:
+            flags_pattern = ''
+        self.disable = re.compile(r"^\s*# check-package .*\b{}({})\b".format(self.__class__.__name__, flags_pattern))
+        self.enabled_flags = {f: False for f in self.flags}
 
     def check_disabled(self, line_before):
-        if self.disable.search(line_before):
-            return True
+        found = self.disable.findall(line_before)
+        if found:
+            # catch flags to be used by CheckFunction for a source file, for all lines below
+            flags_found = [f[1:] for f in found if (f != '' and f[0] == '_')]
+            for f in flags_found:
+                self.enabled_flags[f] = True
+
+            ignore_this_line = '' in found
+            return ignore_this_line
         return False
 
     def before(self):
utils/checkpackagelib/test_base.py +82 -0

85 lines not on this page · raw message

Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH v4 3/15 utils/check-package: remove hard-coded list from lib_config:Indent

In reply to Angelo Compagnucci

From: James Knight <[email protected]>

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.

[Ricardo: update commit message after rebase]
Cc Thomas Petazzoni <[email protected]>

---
Changes v3 -> v4:
- none (rebased on current master).

 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(-)
package/Config.in +2 -0
index a24c73c2ca..5a536b879d 100644
@@ -1,3 +1,5 @@
+# check-package Indent_ignore-menu-indent-below
+
 menu "Target packages"
 
 	source "package/busybox/Config.in"
package/Config.in.host +2 -0
index 595caf9e7f..0f086f3b47 100644
@@ -1,3 +1,5 @@
+# check-package Indent_ignore-menu-indent-below
+
 menu "Host utilities"
 
 	source "package/abootimg/Config.in.host"
package/kodi/Config.in +2 -0
index 110aa91a49..ac44552439 100644
@@ -1,3 +1,5 @@
+# check-package Indent_ignore-menu-indent-below
+
 config BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	bool
 	default y
package/x11r7/Config.in +2 -0
index efa25988c9..bb54b11da4 100644
@@ -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
utils/checkpackagelib/lib_config.py +3 -5
index 202baa7f1b..2c1c378c52 100644
@@ -194,6 +194,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"]
@@ -231,11 +232,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),
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

PATCH v4 4/15 package/andes-spi-burn: fix the license files variable

In reply to Angelo Compagnucci

Since the package was added in ee9d6414d1 ("package/andes-spi-burn:
new package"), the license file is set in ANDES_SPI_BURN_FILES instead of ANDES_SPI_BURN_LICENSE_FILES, so legal-info does not save it and its hash is never checked.

Rename the variable. The hash of LICENSE in the hash file is the one of another variant of the Apache-2.0 text, not the one of the file shipped by andes-spi-burn: update it, now that it is checked.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/andes-spi-burn/andes-spi-burn.hash | 2 +-
 package/andes-spi-burn/andes-spi-burn.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/andes-spi-burn/andes-spi-burn.hash +1 -1
index 5022f0fc1b..adf8b295a4 100644
@@ -1,3 +1,3 @@
 # Locally computed
 sha256  72a5b016ebe0da77662a10edb8078c29cfcbedd8c0ff523d299248e0b1fb84dd  andes-spi-burn-5b8193c35360febd8445cfa32adc6b13a861616d.tar.gz
-sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
+sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
package/andes-spi-burn/andes-spi-burn.mk +1 -1
index 8ee5fb2897..599b1f6fa1 100644
@@ -7,7 +7,7 @@
 ANDES_SPI_BURN_VERSION = 5b8193c35360febd8445cfa32adc6b13a861616d
 ANDES_SPI_BURN_SITE = $(call github,andestech,IntelJ3,$(ANDES_SPI_BURN_VERSION))
 ANDES_SPI_BURN_LICENSE = Apache-2.0
-ANDES_SPI_BURN_FILES = LICENSE
+ANDES_SPI_BURN_LICENSE_FILES = LICENSE
 
 define HOST_ANDES_SPI_BURN_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) -f Makefile_SPIburn
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

PATCH v4 5/15 package/fbv: drop the unused configure options

In reply to Angelo Compagnucci

Since the move to the autotools-based fork in c7109e265c ("package/fbv:
change upstream, update version"), FBV_CONFIGURE_OPTS is not used: it was only passed to ./configure by the custom FBV_CONFIGURE_CMDS removed by that commit, and the autotools infra uses FBV_CONF_OPTS.

The new configure.ac has none of these options anyway: it looks for libpng and libjpeg with AC_SEARCH_LIBS and enables the formats it finds. Drop the dead options and keep only the dependencies.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/fbv/fbv.mk | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
package/fbv/fbv.mk +1 -12
index f7a061dfd7..45320a6bcb 100644
@@ -10,24 +10,13 @@ FBV_LICENSE = GPL-2.0
 FBV_LICENSE_FILES = COPYING
 FBV_AUTORECONF = YES
 
-### image format dependencies and configure options
+### image format dependencies
 FBV_DEPENDENCIES = # empty
-FBV_CONFIGURE_OPTS = # empty
 ifeq ($(BR2_PACKAGE_FBV_PNG),y)
 FBV_DEPENDENCIES += libpng
-
-# libpng in turn depends on other libraries
-ifeq ($(BR2_STATIC_LIBS),y)
-FBV_CONFIGURE_OPTS += "--libs=`$(PKG_CONFIG_HOST_BINARY) --libs libpng`"
-endif
-
-else
-FBV_CONFIGURE_OPTS += --without-libpng
 endif
 ifeq ($(BR2_PACKAGE_FBV_JPEG),y)
 FBV_DEPENDENCIES += jpeg
-else
-FBV_CONFIGURE_OPTS += --without-libjpeg
 endif
 
 $(eval $(autotools-package))
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

PATCH v4 6/15 package/usbip: fix the configure options variable

In reply to Angelo Compagnucci

Since the package was added in f05f2c1ad7 ("package/usbip: new package"), --without-tcp-wrappers is set in USBIP_CONFIGURE_OPTS, which the autotools infra does not use: it uses USBIP_CONF_OPTS.

The option was never passed, so configure links with libwrap whenever it finds it in the staging directory. Rename the variable, so that the build does not depend on what else is in staging.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/usbip/usbip.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/usbip/usbip.mk +1 -1
index b4475c8d89..e56d5f8973 100644
@@ -29,7 +29,7 @@ USBIP_SUBDIR = tools/usb/usbip
 USBIP_INSTALL_STAGING = YES
 
 USBIP_AUTORECONF = YES
-USBIP_CONFIGURE_OPTS = --without-tcp-wrappers
+USBIP_CONF_OPTS = --without-tcp-wrappers
 
 define USBIP_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_NET)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw

PATCH v4 7/15 package/postgresql: drop the unused install-world options

In reply to Angelo Compagnucci

Since the move to meson in cc77be28fc ("package/postgresql: bump version to 17.2"), POSTGRESQL_INSTALL_TARGET_OPTS and POSTGRESQL_INSTALL_STAGING_OPTS are not used: the meson infra installs with ninja install and has no such variables.

Nothing is lost: install-world is install plus the documentation, which is disabled with -Ddocs=disabled, and the contrib modules built by the world target are installed by ninja install. Drop the dead options.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/postgresql/postgresql.mk | 2 --
 1 file changed, 2 deletions(-)
package/postgresql/postgresql.mk +0 -2
index d852dc0e1e..41024e2b49 100644
@@ -30,8 +30,6 @@ POSTGRESQL_DEPENDENCIES = \
 
 ifeq ($(BR2_PACKAGE_POSTGRESQL_FULL),y)
 POSTGRESQL_NINJA_OPTS += world
-POSTGRESQL_INSTALL_TARGET_OPTS += DESTDIR=$(TARGET_DIR) install-world
-POSTGRESQL_INSTALL_STAGING_OPTS += DESTDIR=$(STAGING_DIR) install-world
 endif
 
 ifeq ($(BR2_PACKAGE_READLINE),y)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Maxim Kochetkov on v4 7/15
#12 lore raw

Re: [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options

Quoted 10 lines · Angelo Compagnucci

Since the move to meson in cc77be28fc ("package/postgresql: bump version to 17.2"), POSTGRESQL_INSTALL_TARGET_OPTS and POSTGRESQL_INSTALL_STAGING_OPTS are not used: the meson infra installs with ninja install and has no such variables.

Nothing is lost: install-world is install plus the documentation, which is disabled with -Ddocs=disabled, and the contrib modules built by the world target are installed by ninja install. Drop the dead options.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#13 lore raw

PATCH v4 8/15 package/libselinux: drop the unused make environment

In reply to Angelo Compagnucci

LIBSELINUX_MAKE_ENV, added in 0e5eef911c ("package/libselinux: allow pip to use system-provided packages"), is not used: libselinux is a generic package and its build commands only use LIBSELINUX_MAKE_OPTS, which already passes $(PKG_PYTHON_SETUPTOOLS_ENV) to make. Drop it.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/libselinux/libselinux.mk | 3 ---
 1 file changed, 3 deletions(-)
package/libselinux/libselinux.mk +0 -3
index 9a01b9cf94..2039d5f1ab 100644
@@ -38,9 +38,6 @@ LIBSELINUX_DEPENDENCIES += \
 	host-python-setuptools \
 	host-swig
 
-LIBSELINUX_MAKE_ENV += \
-	$(PKG_PYTHON_SETUPTOOLS_ENV)
-
 LIBSELINUX_MAKE_OPTS += \
 	$(PKG_PYTHON_SETUPTOOLS_ENV) \
 	PYTHON=python$(PYTHON3_VERSION_MAJOR)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#14 lore raw

PATCH v4 9/15 package/zfs: drop the unused module subdirectories

In reply to Angelo Compagnucci

ZFS_MODULE_SUBDIRS is not used since 41493cae71 ("package/zfs: not using kernel-module infra"): the kernel modules are built by the autotools build system of zfs, and the variable was only read by the kernel-module infra. Drop it.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/zfs/zfs.mk | 12 ------------
 1 file changed, 12 deletions(-)
package/zfs/zfs.mk +0 -12
index 071557bf3e..6c20939da5 100644
@@ -63,18 +63,6 @@ ZFS_MAKE_ENV += \
 	ARCH=$(KERNEL_ARCH) \
 	CROSS_COMPILE="$(TARGET_CROSS)"
 
-# ZFS userland tools are unfunctional without the Linux kernel modules.
-ZFS_MODULE_SUBDIRS = \
-	module/avl \
-	module/icp \
-	module/lua \
-	module/nvpair \
-	module/spl \
-	module/unicode \
-	module/zcommon \
-	module/zstd \
-	module/zfs
-
 # These requirements will be validated by zfs/config/kernel-config-defined.m4
 define ZFS_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_DISABLE_OPT,CONFIG_DEBUG_LOCK_ALLOC)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v4 9/15
#15 lore raw

Re: [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories

Quoted 7 lines · Angelo Compagnucci

ZFS_MODULE_SUBDIRS is not used since 41493cae71 ("package/zfs: not using kernel-module infra"): the kernel modules are built by the autotools build system of zfs, and the variable was only read by the kernel-module infra. Drop it.

Quoted 32 lines

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/zfs/zfs.mk | 12 ------------
 1 file changed, 12 deletions(-)
package/zfs/zfs.mk +0 -13
index 071557bf3e..6c20939da5 100644
@@ -63,18 +63,6 @@ ZFS_MAKE_ENV += \
        ARCH=$(KERNEL_ARCH) \
        CROSS_COMPILE="$(TARGET_CROSS)"
 
-# ZFS userland tools are unfunctional without the Linux kernel modules.
-ZFS_MODULE_SUBDIRS = \
-       module/avl \
-       module/icp \
-       module/lua \
-       module/nvpair \
-       module/spl \
-       module/unicode \
-       module/zcommon \
-       module/zstd \
-       module/zfs
-
 # These requirements will be validated by zfs/config/kernel-config-defined.m4
 define ZFS_LINUX_CONFIG_FIXUPS
        $(call KCONFIG_DISABLE_OPT,CONFIG_DEBUG_LOCK_ALLOC)
--
Quoted 2 lines

2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#16 lore raw

PATCH v4 10/15 package/mesa3d: drop the unused host Vulkan drivers

In reply to Angelo Compagnucci

HOST_MESA3D_VULKAN_DRIVERS-y, added in 250a4cd4cf ("package/mesa3d: add panfrost vulkan driver config"), is not used: host-mesa3d is configured with -Dvulkan-drivers="", since it only builds tools.

It does not need the Vulkan driver either: the panfrost compiler installed for the target build is built with -Dtools=panfrost, which already enables src/panfrost/clc (src/panfrost/meson.build). Drop it.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/mesa3d/mesa3d.mk | 1 -
 1 file changed, 1 deletion(-)
package/mesa3d/mesa3d.mk +0 -1
index f20f02190a..329d5c3702 100644
@@ -138,7 +138,6 @@ MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_FREEDRENO) += freedreno
 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_IMAGINATION) += imagination
 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL)   += intel
 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_PANFROST) += panfrost
-HOST_MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_PANFROST) += panfrost
 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_SWRAST) += swrast
 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_VIRTIO) += virtio
 
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#17 lore raw

PATCH v4 11/15 package/nxp-mwifiex: drop the unused make options

In reply to Angelo Compagnucci

NXP_MWIFIEX_MAKE_OPTS, set since the package was added in 1c38699601 ("package/nxp-mwifiex: new package"), is not used: the kernel-module infra only passes NXP_MWIFIEX_MODULE_MAKE_OPTS to the kernel build system, and the generic infra does not use it either. The module has always been built without it. Drop it.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/nxp-mwifiex/nxp-mwifiex.mk | 2 --
 1 file changed, 2 deletions(-)
package/nxp-mwifiex/nxp-mwifiex.mk +0 -2
index 019939d93a..c49fd0965a 100644
@@ -9,8 +9,6 @@ NXP_MWIFIEX_SITE = $(call github,nxp-imx,mwifiex,$(NXP_MWIFIEX_VERSION))
 NXP_MWIFIEX_LICENSE = GPL-2.0
 NXP_MWIFIEX_LICENSE_FILES = LICENSE
 
-NXP_MWIFIEX_MAKE_OPTS = KERNELDIR=$(LINUX_DIR)
-
 define NXP_MWIFIEX_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_NET)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_WIRELESS)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#18 lore raw

PATCH v4 12/15 package/libglib2/libglib2-bootstrap: drop unused variables

In reply to Angelo Compagnucci

Two variables of libglib2-bootstrap are not used:

- LIBGLIB2_BOOTSTRAP_VERSION_MAJOR, set when the package was added in 11aa1cfa5a ("package/{gobject-introspection, libglib2}: bump to {1.82.0, 2.82.4}"), is not referenced anywhere;
- LIBGLIB2_BOOTSTRAP_POST_INSTALL_TARGET_HOOKS are never run since 866462e8dd ("package/libglib2/libglib2-bootstrap: do not install to target") set LIBGLIB2_BOOTSTRAP_INSTALL_TARGET = NO.

Drop them.

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk | 3 ---
 1 file changed, 3 deletions(-)
package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk +0 -3
index 1e512fd7ed..856e7e697d 100644
@@ -16,7 +16,6 @@
 # The bootstrap package is an implementation detail that nothing
 # except gobject-introspection should depend on.
 
-LIBGLIB2_BOOTSTRAP_VERSION_MAJOR = $(LIBGLIB2_VERSION_MAJOR)
 LIBGLIB2_BOOTSTRAP_VERSION = $(LIBGLIB2_VERSION)
 LIBGLIB2_BOOTSTRAP_SOURCE = $(LIBGLIB2_SOURCE)
 LIBGLIB2_BOOTSTRAP_SITE = $(LIBGLIB2_SITE)
@@ -53,8 +52,6 @@ LIBGLIB2_BOOTSTRAP_MESON_EXTRA_PROPERTIES = \
 	have_c99_snprintf=true \
 	have_unix98_printf=true
 
-LIBGLIB2_BOOTSTRAP_POST_INSTALL_TARGET_HOOKS = $(LIBGLIB2_POST_INSTALL_TARGET_HOOKS)
-
 HOST_LIBGLIB2_BOOTSTRAP_DEPENDENCIES = \
 	host-gettext \
 	host-libffi \
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#19 lore raw

PATCH v4 13/15 package/linux-pam: fix linking with the NLS and atomic libraries

In reply to Angelo Compagnucci

Since the move to meson in 30e38505e4 ("package/linux-pam: security bump to version 1.7.2"), LINUX_PAM_LIBS is passed through LINUX_PAM_MAKE_OPTS, which the meson infra does not use. So linux-pam is linked neither with $(TARGET_NLS_LIBS), when the gettext functions come from an external libintl, nor with -latomic, added in f1a47904b6 ("package/linux-pam: link with -latomic when needed") for pam_keyinit.

This breaks the build when libintl is external, for example on musl with NLS:

ld: libpam_misc/libpam_misc.so.0.82.1.p/misc_conv.c.o: in function `misc_conv':
misc_conv.c:(.text+0xa40): undefined reference to `libintl_dgettext'

Pass the libraries through LINUX_PAM_LDFLAGS, which the meson infra puts in the cross-compilation file, as done for example by gcr.

The meson build of linux-pam is also in 2026.02.x, so the problem affects 2026.02.x and later.

Fixes:
https://autobuild.buildroot.net/results/455/455da16d91d6f87a1a7d412c4b1e0de403c5cbcf/

Fixes 30e38505e4bc6f8313509bdee2418024693088fa ("package/linux-pam: security bump to version 1.7.2")

---
Changes v3 -> v4:
- new patch: fix a file warned about by the package infra checks added at the end of the series.

 package/linux-pam/linux-pam.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/linux-pam/linux-pam.mk +1 -1
index a4be4fa3b6..844ca2a1fe 100644
@@ -19,7 +19,7 @@ LINUX_PAM_DEPENDENCIES = host-flex host-pkgconf \
 LINUX_PAM_LICENSE = BSD-3-Clause
 LINUX_PAM_LICENSE_FILES = Copyright
 LINUX_PAM_LIBS = $(TARGET_NLS_LIBS)
-LINUX_PAM_MAKE_OPTS += LIBS="$(LINUX_PAM_LIBS)"
+LINUX_PAM_LDFLAGS = $(TARGET_LDFLAGS) $(LINUX_PAM_LIBS)
 LINUX_PAM_CPE_ID_VENDOR = linux-pam
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#20 lore raw

PATCH v4 14/15 utils/check-package: warn about symbols not recognized by a package infra

In reply to Angelo Compagnucci

From: Ricardo Martincoski <[email protected]>

For each .mk file, create a list of all symbols defined and compare to the list of symbols supported by the package infra(s) used in the file. Also keep track of usage for internal variables, since any variable suffix can be used as long the variable is use in the file. Ignore some variables that are defined in one file and used in others, for instance the variable that holds the path to host tools to be used in the build of other packages.
Use a small list for the exceptions that don't use a package/rootfs
infra: linux extensions and initramfs.
Also support the special case of _SUBDIR, see below.

In the main script, add support for a check function to return more than one warning at once.

Create a simple model for the package infras, listing the supported suffixes for variables for each package infra type.
This file may need updates when new package infras are added or existent ones are changed.

Add an exception to initramfs, because it changes TARGETS_ROOTFS. Add an exception to xenomai because it changes LINUX_EXTRA_DOWNLOADS. Add an exception to luarocks because it changes TARGET_FINALIZE_HOOKS. Add an exception to toolchain/toolchain.mk because it does not call any package infra.

The _SUBDIR variable is a tricky one. It *is* declared for the generic infra package (and all package infras that inherit from the generic one), but it is really used in certain conditions. package/pkg-generic.mk uses <pkg>_SUBDIR only to define:
(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
and it also uses <pkg>_SRCDIR only to define:
$(2)_BUILDDIR ?= $$($(2)_SRCDIR)
so the generic package infra does not really uses _SUBDIR by itself in the common scenario.
So The manual entry for the generic infra seems correct in not mentioning _SUBDIR.
Also any package infra that inherits from the generic one (by calling inner-generic-package) needs to use one of the three variables in order to support _SUBDIR: _BUILDDIR, _SRCDIR or _SUBDIR.
That is the case for: autotools (_SRCDIR), cargo (_SRCDIR, _SUBDIR), cmake (_BUILDDIR, _SRCDIR), luarocks (_SRCDIR, _SUBDIR), meson (_SRCDIR), perl (_SRCDIR), python (_BUILDDIR), qmake (_BUILDDIR) and waf (_SRCDIR).
Of course the .mk file for a package using the generic infra can define this symbol and use it, directly or indirectly, for example, in its _INSTALL_TARGET_CMDS.
Also any package infra, even the ones that do not use directly any of the three variables above, can use _SUBDIR when the package uses the macros KCONFIG_ENABLE_OPT, KCONFIG_SET_OPT or KCONFIG_DISABLE_OPT declared in package/pkg-utils.mk.

The variables this check finds in the tree are fixed by the previous patches, except in gcc-final, added to .checkpackageignore: the m68k ColdFire libgcc fixup hook is registered under a wrong name since bfcddf0570 ("package/gcc/gcc-final: add a target variant in charge of target installation"), so it never runs, but fixing it changes the ColdFire internal toolchain and needs to be tested on its own.

Cc Francois Perrad <[email protected]>
Cc Giulio Benetti <[email protected]>
Cc Romain Naour <[email protected]>
Cc Thomas De Schampheleire <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v4 (v1 was patch 27/29 of the "warn about symbols not recognized by a package infra" series, now sent together with the "support inline flags" series, v3):
- rebase on current master: print_warnings() in utils/check-package

    now also handles the expected failures of the ignore list;

- add the suffixes added to the package infras since v1, which gave about 240 false positives on the current tree:
_ADD_CCACHE_DEPENDENCY, _BUSYBOX_CONFIG_FIXUPS, _CPE_ID_VALID, _DOWNLOAD_POST_PROCESS_OPTS and _SVN_EXTERNALS (generic), _AUTOPOINT (autotools), _BUILD_ENV, _BUILD_OPTS and _CMAKE_BACKEND (cmake), _EXTLDFLAGS and _SUBDIR (golang), _CARGO_MANIFEST_PATH (python) and _VERITY_EXTRA_ARGS (rootfs);
- add the variables used outside their package since v1:
FLUTTER_ENGINE_GEN_SNAPSHOT, GCC_TARGET_SIMD, GO_BINARIES_INSTALL, HOST_FLUTTER_SDK_BIN_DART_BIN, HOST_FLUTTER_SDK_BIN_FLUTTER, QT6_GIT, QT6_QMAKE, QT6_QT_CONF_FIXUP and TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE, and the LINUX_TOOLS_BIN_ARCH_EXCLUDE and LINUX_TOOLS_PRE_CONFIGURE_HOOKS hooks of the linux-tools;
- the variables still found in the tree are fixed by the previous patches, except in gcc-final, added to .checkpackageignore (see the commit message).

 .checkpackageignore                  |   1 +
 fs/initramfs/initramfs.mk            |   1 +
 linux/linux-ext-xenomai.mk           |   2 +-
 package/luarocks/luarocks.mk         |   2 +
 toolchain/toolchain.mk               |   2 +
 utils/check-package                  |  17 +-
 utils/checkpackagelib/lib_mk.py      | 120 ++++++++
 utils/checkpackagelib/pkg_infra.py   | 322 ++++++++++++++++++++
 utils/checkpackagelib/test_lib_mk.py | 426 +++++++++++++++++++++++++++
 9 files changed, 888 insertions(+), 5 deletions(-)
 create mode 100644 utils/checkpackagelib/pkg_infra.py
.checkpackageignore +1 -0
index 25c668db54..6419cc53b8 100644
@@ -345,6 +345,7 @@ package/gcc/8.4.0/0001-xtensa-fix-PR-target-91880.patch lib_patch.Upstream
 package/gcc/8.4.0/0002-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch lib_patch.Upstream
 package/gcc/8.4.0/0003-libsanitizer-Remove-cyclades-from-libsanitizer.patch lib_patch.Upstream
 package/gcc/8.4.0/0004-disable-split-stack-for-non-thread-builds.patch lib_patch.Upstream
+package/gcc/gcc-final/gcc-final.mk lib_mk.TypoInVariableSuffix
 package/gdb/15.2/0001-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch lib_patch.Upstream
 package/gdb/15.2/0002-sh-ptrace-Define-pt_-dsp-regs-uapi_pt_-dsp-regs-on-G.patch lib_patch.Upstream
 package/gdb/15.2/0003-use-asm-sgidefs.h.patch lib_patch.Upstream
fs/initramfs/initramfs.mk +1 -0
index 3b3d4ed8b9..69f0910368 100644
@@ -27,6 +27,7 @@ rootfs-initramfs-show-depends:
 .PHONY: rootfs-initramfs rootfs-initramfs-show-depends
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+# check-package TypoInVariableSuffix
 TARGETS_ROOTFS += rootfs-initramfs
 endif
 
linux/linux-ext-xenomai.mk +1 -1
index 5ec6891bbf..247ff087cb 100644
@@ -12,7 +12,7 @@ XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
 ifneq ($(filter ftp://% http://% https://%,$(XENOMAI_ADEOS_PATCH)),)
 XENOMAI_ADEOS_PATCH_NAME = $(notdir $(XENOMAI_ADEOS_PATCH))
 XENOMAI_ADEOS_PATCH_PATH = $(LINUX_DL_DIR)/$(XENOMAI_ADEOS_PATCH_NAME)
-# check-package TypoInPackageVariable
+# check-package TypoInPackageVariable, TypoInVariableSuffix
 LINUX_EXTRA_DOWNLOADS += $(XENOMAI_ADEOS_PATCH)
 BR_NO_CHECK_HASH_FOR += $(XENOMAI_ADEOS_PATCH_NAME)
 else
package/luarocks/luarocks.mk +2 -0
index 43d099726f..f808f4ca13 100644
@@ -43,11 +43,13 @@ endef
 
 $(eval $(host-generic-package))
 
+# check-package TypoInVariableSuffix
 define LUAROCKS_FINALIZE_TARGET
 	rm -rf $(TARGET_DIR)/usr/lib/luarocks
 endef
 
 # Apply to global variable directly, as pkg-generic does not
 ifneq ($(BR2_PACKAGE_LUAJIT)$(BR2_PACKAGE_LUA),)
+# check-package TypoInVariableSuffix
 TARGET_FINALIZE_HOOKS += LUAROCKS_FINALIZE_TARGET
 endif
toolchain/toolchain.mk +2 -0
index fe87a72ed4..36344c1b20 100644
@@ -10,6 +10,7 @@
 # Install the gconv modules
 ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y)
 TOOLCHAIN_GLIBC_GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))
+# check-package TypoInVariableSuffix
 define TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
 	$(Q)found_gconv=no; \
 	for d in $(TOOLCHAIN_EXTERNAL_PREFIX) ''; do \
@@ -51,5 +52,6 @@ define TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
 			>$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
 	fi
 endef
+# check-package TypoInVariableSuffix
 TOOLCHAIN_TARGET_FINALIZE_HOOKS += TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
 endif
utils/check-package +13 -4
index f9978adef4..d83484efc5 100755
@@ -219,12 +219,21 @@ def print_warnings(warnings, xfail):
     if warnings is None:
         return 0, 0  # No warning generated.
 
+    # Allow each check function to return either one warning or a list of warnings
+    if len(warnings) == 0:
+        return 0, 0  # No warning generated.
+    if type(warnings[0]) is list:
+        all_warnings = warnings
+    else:
+        all_warnings = [warnings]
+
     if xfail:
         return 0, 1  # Warning not generated, fail expected for this file.
-    for level, message in enumerate(warnings):
-        if flags.verbose >= level:
-            print(message.replace("\t", "< tab  >").rstrip())
-    return 1, 1  # One more warning to count.
+    for each_warning in all_warnings:
+        for level, message in enumerate(each_warning):
+            if flags.verbose >= level:
+                print(message.replace("\t", "< tab  >").rstrip())
+    return len(all_warnings), 1  # One or more warnings to count.
 
 
 def check_file_using_lib(fname):
utils/checkpackagelib/lib_mk.py +120 -0

132 lines not on this page · raw message

utils/checkpackagelib/pkg_infra.py new file +322 -0

322 lines not on this page · raw message

utils/checkpackagelib/test_lib_mk.py +426 -0

432 lines not on this page · raw message

Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#21 lore raw

PATCH v4 15/15 utils/check-package: warn about disabled install

In reply to Angelo Compagnucci

From: Ricardo Martincoski <[email protected]>

When a package defines one of these variables:
<pkg>_INSTALL_IMAGES_CMDS
<pkg>_PRE_INSTALL_IMAGES_HOOKS
<pkg>_POST_INSTALL_IMAGES_HOOKS
it also needs to enable <pkg>_INSTALL_IMAGES.

The same also occurs for <pkg>_INSTALL_STAGING.

And yet <pkg>_INSTALL_TARGET is a similar case, except that it defaults to YES, while the other two default to NO.

So warn when a package defines a install command or hook that will never be called because the equivalent flag is not set.
Take into account that some special cases have <pkg>_INSTALL_STAGING defaulting to YES.
Also only warn when the script can determine for sure the flag to install is disabled. So if a flag that defaults to YES is overridden to NO inside a conditional, consider it may be enabled.

---
Changes v1 -> v4 (v1 was patch 28/29 of the "warn about symbols not recognized by a package infra" series):
- rebase on current master; the only file warned about, libglib2-bootstrap, is fixed by a previous patch.

 utils/checkpackagelib/lib_mk.py      |  89 ++++++++++++++++++
 utils/checkpackagelib/test_lib_mk.py | 129 +++++++++++++++++++++++++++
 2 files changed, 218 insertions(+)
utils/checkpackagelib/lib_mk.py +89 -0
index 9e154e3049..aeb88cb32b 100644
@@ -63,6 +63,95 @@ def get_package_prefix_from_filename(filename):
     return package, package_upper
 
 
+class DisabledInstall(_CheckFunction):
+    END_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(end_conditional)))
+    START_CONDITIONAL = re.compile(r"^\s*({})".format("|".join(start_conditional)))
+    PATHS_WITH_INSTALL_STAGING_YES = [
+        "package/linux-tools/",
+        "toolchain/",
+    ]
+
+    def before(self):
+        _, self.package = get_package_prefix_from_filename(self.filename)
+
+        self.install_images = False
+        self.all_images_cmds = []
+        self.IMAGES_CMDS = re.compile(r"^\s*(define\s+)?{}({})".format(self.package, "|".join([
+            r"_PRE_INSTALL_IMAGES_HOOKS",
+            r"_INSTALL_IMAGES_CMDS",
+            r"_POST_INSTALL_IMAGES_HOOKS"])))
+        self.INSTALL_IMAGES = re.compile(r"\s*{}_INSTALL_IMAGES\s*=\s*YES".format(self.package))
+
+        self.install_staging = False
+        for path in self.PATHS_WITH_INSTALL_STAGING_YES:
+            if self.filename.startswith(path):
+                self.install_staging = True
+                break
+        self.all_staging_cmds = []
+        self.STAGING_CMDS = re.compile(r"^\s*(define\s+)?{}({})".format(self.package, "|".join([
+            r"_PRE_INSTALL_STAGING_HOOKS",
+            r"_INSTALL_STAGING_CMDS",
+            r"_POST_INSTALL_STAGING_HOOKS"])))
+        self.INSTALL_STAGING = re.compile(r"\s*{}_INSTALL_STAGING\s*=\s*YES".format(self.package))
+
+        self.conditional = 0
+        self.install_target = True
+        self.all_target_cmds = []
+        self.TARGET_CMDS = re.compile(r"^\s*(define\s+)?{}({})".format(self.package, "|".join([
+            r"_PRE_INSTALL_TARGET_HOOKS",
+            r"_INSTALL_TARGET_CMDS",
+            r"_POST_INSTALL_TARGET_HOOKS"])))
+        self.INSTALL_TARGET = re.compile(r"\s*{}_INSTALL_TARGET\s*=\s*NO".format(self.package))
+
+    def check_line(self, lineno, text):
+        if self.START_CONDITIONAL.search(text):
+            self.conditional += 1
+            return
+        if self.END_CONDITIONAL.search(text):
+            self.conditional -= 1
+            return
+
+        if self.INSTALL_IMAGES.search(text):
+            self.install_images = True
+            return
+        if self.INSTALL_STAGING.search(text):
+            self.install_staging = True
+            return
+        if self.INSTALL_TARGET.search(text):
+            if self.conditional == 0:
+                self.install_target = False
+            return
+
+        if self.IMAGES_CMDS.search(text):
+            self.all_images_cmds.append([lineno, text])
+            return
+        if self.STAGING_CMDS.search(text):
+            self.all_staging_cmds.append([lineno, text])
+            return
+        if self.TARGET_CMDS.search(text):
+            self.all_target_cmds.append([lineno, text])
+            return
+
+    def after(self):
+        warnings = []
+        if not self.install_images:
+            for lineno, text in self.all_images_cmds:
+                warnings.append(["{}:{}: never called because {}_INSTALL_IMAGES is disabled"
+                                 .format(self.filename, lineno, self.package),
+                                 text])
+        if not self.install_staging:
+            for lineno, text in self.all_staging_cmds:
+                warnings.append(["{}:{}: never called because {}_INSTALL_STAGING is disabled"
+                                 .format(self.filename, lineno, self.package),
+                                 text])
+        if not self.install_target:
+            for lineno, text in self.all_target_cmds:
+                warnings.append(["{}:{}: never called because {}_INSTALL_TARGET is disabled"
+                                 .format(self.filename, lineno, self.package),
+                                 text])
+        return warnings
+
+
 class Indent(_CheckFunction):
     COMMENT = re.compile(r"^\s*#")
     CONDITIONAL = re.compile(r"^\s*({})\s".format("|".join(start_conditional + end_conditional + continue_conditional)))
utils/checkpackagelib/test_lib_mk.py +129 -0

135 lines not on this page · raw message

Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot