* [Buildroot] [next v3 0/3] check-package: support inline flags v3
@ 2023-09-03 16:35 Ricardo Martincoski
2023-09-03 16:35 ` [Buildroot] [next v3 1/3] utils/check-package: factor-out check_disabled() Ricardo Martincoski
` (3 more replies)
0 siblings, 4 replies; 23+ messages in thread
From: Ricardo Martincoski @ 2023-09-03 16:35 UTC (permalink / raw)
To: buildroot; +Cc: James Knight, Thomas Petazzoni, Ricardo Martincoski
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 <james.d.knight@live.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
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
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 23+ messages in thread* [Buildroot] [next v3 1/3] utils/check-package: factor-out check_disabled() 2023-09-03 16:35 [Buildroot] [next v3 0/3] check-package: support inline flags v3 Ricardo Martincoski @ 2023-09-03 16:35 ` Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 2/3] utils/check-package: support inline flags Ricardo Martincoski ` (2 subsequent siblings) 3 siblings, 0 replies; 23+ messages in thread From: Ricardo Martincoski @ 2023-09-03 16:35 UTC (permalink / raw) To: buildroot; +Cc: James Knight, Thomas Petazzoni, 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 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 <james.d.knight@live.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> --- 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 diff --git a/utils/check-package b/utils/check-package index 105902303e..23d250d4a1 100755 --- a/utils/check-package +++ b/utils/check-package @@ -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) diff --git a/utils/checkpackagelib/base.py b/utils/checkpackagelib/base.py index f666e4110b..15a304acf3 100644 --- a/utils/checkpackagelib/base.py +++ b/utils/checkpackagelib/base.py @@ -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 diff --git a/utils/checkpackagelib/test_base.py b/utils/checkpackagelib/test_base.py new file mode 100644 index 0000000000..ef266d542c --- /dev/null +++ b/utils/checkpackagelib/test_base.py @@ -0,0 +1,49 @@ +import pytest +import checkpackagelib.test_util as util +import checkpackagelib.base as m + + +IgnoreNextLine = [ + ('without comment to ignore a given CheckFunction', + 'any', + 'content to test\n' + '# commented content to test\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), # set of line numbers for all lines not ignored while testing + ('ignore next line', + 'any', + 'content to test\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n' + 'content to test\n', + [1, 2, 4, 5]), + ('comment to ignore one CheckFunction does not affect another one', + 'any', + 'content to test\n' + '# check-package AnotherCheckFunction\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), + ('ignore 2 CheckFunctions for next line', + 'any', + '# check-package CheckFunctionUnderTest, AnotherCheckFunction\n' + 'content to ignore\n' + '# check-package AnotherCheckFunction, CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n', + [1, 3, 5]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', IgnoreNextLine) +def test_IgnoreNextLine(testname, filename, string, expected): + class CheckFunctionUnderTest(m._CheckFunction): + def check_line(self, lineno, text): + return lineno + + warnings = util.check_file(CheckFunctionUnderTest, filename, string) + assert warnings == expected diff --git a/utils/checkpackagelib/test_util.py b/utils/checkpackagelib/test_util.py index 23f2995e27..b06e218498 100644 --- a/utils/checkpackagelib/test_util.py +++ b/utils/checkpackagelib/test_util.py @@ -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] -- 2.34.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [next v3 2/3] utils/check-package: support inline flags 2023-09-03 16:35 [Buildroot] [next v3 0/3] check-package: support inline flags v3 Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 1/3] utils/check-package: factor-out check_disabled() Ricardo Martincoski @ 2023-09-03 16:35 ` Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 3/3] utils/check-package: remove hard-coded list from lib_config:Indent Ricardo Martincoski 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci 3 siblings, 0 replies; 23+ messages in thread From: Ricardo Martincoski @ 2023-09-03 16:35 UTC (permalink / raw) To: buildroot; +Cc: James Knight, Thomas Petazzoni, 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 <james.d.knight@live.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> --- 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(-) diff --git a/utils/checkpackagelib/base.py b/utils/checkpackagelib/base.py index 15a304acf3..d17b9d899f 100644 --- a/utils/checkpackagelib/base.py +++ b/utils/checkpackagelib/base.py @@ -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): diff --git a/utils/checkpackagelib/test_base.py b/utils/checkpackagelib/test_base.py index ef266d542c..bbe9285466 100644 --- a/utils/checkpackagelib/test_base.py +++ b/utils/checkpackagelib/test_base.py @@ -47,3 +47,85 @@ def test_IgnoreNextLine(testname, filename, string, expected): warnings = util.check_file(CheckFunctionUnderTest, filename, string) assert warnings == expected + + +SpecialCheckForThisFile = [ + ('without special comment', + 'any', + 'content to test\n' + '# commented content to test\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), # set of line numbers for all lines not ignored while testing + ('ignore next line (CheckFunction with flags)', + 'any', + 'content to test\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n' + 'content to test\n', + [1, 2, 4, 5]), + ('comment to ignore one CheckFunction does not affect another one (CheckFunction with flags)', + 'any', + 'content to test\n' + '# check-package AnotherCheckFunction\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), + ('ignore 2 CheckFunctions for next line (CheckFunction with flags)', + 'any', + '# check-package CheckFunctionUnderTest, AnotherCheckFunction\n' + 'content to ignore\n' + '# check-package AnotherCheckFunction, CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n', + [1, 3, 5]), + ('one flag', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + 'content to test using flag-2\n', + [1, 2, [3, [-2]], [4, [-2]]]), + ('flag and ignore next line in the same file', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test using flag-2\n', + [1, 2, 4, [5, [-2]], [6, [-2]], [8, [-2]]]), + ('2 flags', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + '# check-package CheckFunctionUnderTest_flag-1\n' + 'content to test using flag-1 and flag-2\n' + 'content to test using flag-1 and flag-2\n', + [1, 2, [3, [-2]], [4, [-2]], [5, [-1, -2]], [6, [-1, -2]]]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', SpecialCheckForThisFile) +def test_SpecialCheckForThisFile(testname, filename, string, expected): + class CheckFunctionUnderTest(m._CheckFunction): + flags = ['flag-1', 'flag-2'] + + def check_line(self, lineno, text): + flags = [] + if self.enabled_flags['flag-1']: + flags.append(-1) + if self.enabled_flags['flag-2']: + flags.append(-2) + if flags: + return [lineno, flags] + return lineno + + warnings = util.check_file(CheckFunctionUnderTest, filename, string) + assert warnings == expected -- 2.34.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [next v3 3/3] utils/check-package: remove hard-coded list from lib_config:Indent 2023-09-03 16:35 [Buildroot] [next v3 0/3] check-package: support inline flags v3 Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 1/3] utils/check-package: factor-out check_disabled() Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 2/3] utils/check-package: support inline flags Ricardo Martincoski @ 2023-09-03 16:35 ` Ricardo Martincoski 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci 3 siblings, 0 replies; 23+ messages in thread From: Ricardo Martincoski @ 2023-09-03 16:35 UTC (permalink / raw) To: buildroot; +Cc: James Knight, Ricardo Martincoski, Thomas Petazzoni 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 --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), -- 2.34.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags 2023-09-03 16:35 [Buildroot] [next v3 0/3] check-package: support inline flags v3 Ricardo Martincoski ` (2 preceding siblings ...) 2023-09-03 16:35 ` [Buildroot] [next v3 3/3] utils/check-package: remove hard-coded list from lib_config:Indent Ricardo Martincoski @ 2026-11-07 16:33 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 01/15] utils/check-package: factor-out check_disabled() Angelo Compagnucci ` (14 more replies) 3 siblings, 15 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:33 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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/20230101233653.487175-28-ricardo.martincoski@gmail.com/ - [28/29] utils/check-package: warn about disabled install (patch 15) https://patchwork.buildroot.org/project/buildroot/patch/20230101233653.487175-29-ricardo.martincoski@gmail.com/ - [next,v3,1/3] utils/check-package: factor-out check_disabled() (patch 1) https://patchwork.buildroot.org/project/buildroot/patch/20230903163509.614740-2-ricardo.martincoski@gmail.com/ - [next,v3,2/3] utils/check-package: support inline flags (patch 2) https://patchwork.buildroot.org/project/buildroot/patch/20230903163509.614740-3-ricardo.martincoski@gmail.com/ - [next,v3,3/3] utils/check-package: remove hard-coded list from lib_config:Indent (patch 3) https://patchwork.buildroot.org/project/buildroot/patch/20230903163509.614740-4-ricardo.martincoski@gmail.com/ 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 -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 01/15] utils/check-package: factor-out check_disabled() 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 02/15] utils/check-package: support inline flags Angelo Compagnucci ` (13 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls, Ricardo Martincoski From: Ricardo Martincoski <ricardo.martincoski@gmail.com> 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 <james.d.knight@live.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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 diff --git a/utils/check-package b/utils/check-package index aa10280f4d..f9978adef4 100755 --- a/utils/check-package +++ b/utils/check-package @@ -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: diff --git a/utils/checkpackagelib/base.py b/utils/checkpackagelib/base.py index 0ab6eba9f6..4636eca3a6 100644 --- a/utils/checkpackagelib/base.py +++ b/utils/checkpackagelib/base.py @@ -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 diff --git a/utils/checkpackagelib/test_base.py b/utils/checkpackagelib/test_base.py new file mode 100644 index 0000000000..ef266d542c --- /dev/null +++ b/utils/checkpackagelib/test_base.py @@ -0,0 +1,49 @@ +import pytest +import checkpackagelib.test_util as util +import checkpackagelib.base as m + + +IgnoreNextLine = [ + ('without comment to ignore a given CheckFunction', + 'any', + 'content to test\n' + '# commented content to test\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), # set of line numbers for all lines not ignored while testing + ('ignore next line', + 'any', + 'content to test\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n' + 'content to test\n', + [1, 2, 4, 5]), + ('comment to ignore one CheckFunction does not affect another one', + 'any', + 'content to test\n' + '# check-package AnotherCheckFunction\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), + ('ignore 2 CheckFunctions for next line', + 'any', + '# check-package CheckFunctionUnderTest, AnotherCheckFunction\n' + 'content to ignore\n' + '# check-package AnotherCheckFunction, CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n', + [1, 3, 5]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', IgnoreNextLine) +def test_IgnoreNextLine(testname, filename, string, expected): + class CheckFunctionUnderTest(m._CheckFunction): + def check_line(self, lineno, text): + return lineno + + warnings = util.check_file(CheckFunctionUnderTest, filename, string) + assert warnings == expected diff --git a/utils/checkpackagelib/test_util.py b/utils/checkpackagelib/test_util.py index 23f2995e27..b06e218498 100644 --- a/utils/checkpackagelib/test_util.py +++ b/utils/checkpackagelib/test_util.py @@ -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] -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 02/15] utils/check-package: support inline flags 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 01/15] utils/check-package: factor-out check_disabled() Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 03/15] utils/check-package: remove hard-coded list from lib_config:Indent Angelo Compagnucci ` (12 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls, Ricardo Martincoski From: Ricardo Martincoski <ricardo.martincoski@gmail.com> 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 <james.d.knight@live.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> --- 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(-) diff --git a/utils/checkpackagelib/base.py b/utils/checkpackagelib/base.py index 4636eca3a6..a3aff9e3d8 100644 --- a/utils/checkpackagelib/base.py +++ b/utils/checkpackagelib/base.py @@ -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): diff --git a/utils/checkpackagelib/test_base.py b/utils/checkpackagelib/test_base.py index ef266d542c..bbe9285466 100644 --- a/utils/checkpackagelib/test_base.py +++ b/utils/checkpackagelib/test_base.py @@ -47,3 +47,85 @@ def test_IgnoreNextLine(testname, filename, string, expected): warnings = util.check_file(CheckFunctionUnderTest, filename, string) assert warnings == expected + + +SpecialCheckForThisFile = [ + ('without special comment', + 'any', + 'content to test\n' + '# commented content to test\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), # set of line numbers for all lines not ignored while testing + ('ignore next line (CheckFunction with flags)', + 'any', + 'content to test\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n' + 'content to test\n', + [1, 2, 4, 5]), + ('comment to ignore one CheckFunction does not affect another one (CheckFunction with flags)', + 'any', + 'content to test\n' + '# check-package AnotherCheckFunction\n' + 'content to test\n' + 'content to test\n' + 'content to test\n', + [1, 2, 3, 4, 5]), + ('ignore 2 CheckFunctions for next line (CheckFunction with flags)', + 'any', + '# check-package CheckFunctionUnderTest, AnotherCheckFunction\n' + 'content to ignore\n' + '# check-package AnotherCheckFunction, CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test\n', + [1, 3, 5]), + ('one flag', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + 'content to test using flag-2\n', + [1, 2, [3, [-2]], [4, [-2]]]), + ('flag and ignore next line in the same file', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + '# check-package CheckFunctionUnderTest\n' + 'content to ignore\n' + 'content to test using flag-2\n', + [1, 2, 4, [5, [-2]], [6, [-2]], [8, [-2]]]), + ('2 flags', + 'any', + 'content to test using default code\n' + '# check-package CheckFunctionUnderTest_flag-2\n' + 'content to test using flag-2\n' + '# check-package CheckFunctionUnderTest_flag-1\n' + 'content to test using flag-1 and flag-2\n' + 'content to test using flag-1 and flag-2\n', + [1, 2, [3, [-2]], [4, [-2]], [5, [-1, -2]], [6, [-1, -2]]]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', SpecialCheckForThisFile) +def test_SpecialCheckForThisFile(testname, filename, string, expected): + class CheckFunctionUnderTest(m._CheckFunction): + flags = ['flag-1', 'flag-2'] + + def check_line(self, lineno, text): + flags = [] + if self.enabled_flags['flag-1']: + flags.append(-1) + if self.enabled_flags['flag-2']: + flags.append(-2) + if flags: + return [lineno, flags] + return lineno + + warnings = util.check_file(CheckFunctionUnderTest, filename, string) + assert warnings == expected -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 03/15] utils/check-package: remove hard-coded list from lib_config:Indent 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 01/15] utils/check-package: factor-out check_disabled() Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 02/15] utils/check-package: support inline flags Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 04/15] package/andes-spi-burn: fix the license files variable Angelo Compagnucci ` (11 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls, Ricardo Martincoski 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 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(-) diff --git a/package/Config.in b/package/Config.in index a24c73c2ca..5a536b879d 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 595caf9e7f..0f086f3b47 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 110aa91a49..ac44552439 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 diff --git a/package/x11r7/Config.in b/package/x11r7/Config.in index efa25988c9..bb54b11da4 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 202baa7f1b..2c1c378c52 100644 --- a/utils/checkpackagelib/lib_config.py +++ b/utils/checkpackagelib/lib_config.py @@ -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), -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 04/15] package/andes-spi-burn: fix the license files variable 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (2 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 03/15] utils/check-package: remove hard-coded list from lib_config:Indent Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 05/15] package/fbv: drop the unused configure options Angelo Compagnucci ` (10 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/andes-spi-burn/andes-spi-burn.hash b/package/andes-spi-burn/andes-spi-burn.hash index 5022f0fc1b..adf8b295a4 100644 --- a/package/andes-spi-burn/andes-spi-burn.hash +++ b/package/andes-spi-burn/andes-spi-burn.hash @@ -1,3 +1,3 @@ # Locally computed sha256 72a5b016ebe0da77662a10edb8078c29cfcbedd8c0ff523d299248e0b1fb84dd andes-spi-burn-5b8193c35360febd8445cfa32adc6b13a861616d.tar.gz -sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE +sha256 c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE diff --git a/package/andes-spi-burn/andes-spi-burn.mk b/package/andes-spi-burn/andes-spi-burn.mk index 8ee5fb2897..599b1f6fa1 100644 --- a/package/andes-spi-burn/andes-spi-burn.mk +++ b/package/andes-spi-burn/andes-spi-burn.mk @@ -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 -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 05/15] package/fbv: drop the unused configure options 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (3 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 04/15] package/andes-spi-burn: fix the license files variable Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 06/15] package/usbip: fix the configure options variable Angelo Compagnucci ` (9 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/fbv/fbv.mk b/package/fbv/fbv.mk index f7a061dfd7..45320a6bcb 100644 --- a/package/fbv/fbv.mk +++ b/package/fbv/fbv.mk @@ -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)) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 06/15] package/usbip: fix the configure options variable 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (4 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 05/15] package/fbv: drop the unused configure options Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options Angelo Compagnucci ` (8 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/usbip/usbip.mk b/package/usbip/usbip.mk index b4475c8d89..e56d5f8973 100644 --- a/package/usbip/usbip.mk +++ b/package/usbip/usbip.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (5 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 06/15] package/usbip: fix the configure options variable Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-09 7:13 ` Maxim Kochetkov via buildroot 2026-11-07 16:34 ` [Buildroot] [PATCH v4 08/15] package/libselinux: drop the unused make environment Angelo Compagnucci ` (7 subsequent siblings) 14 siblings, 1 reply; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk index d852dc0e1e..41024e2b49 100644 --- a/package/postgresql/postgresql.mk +++ b/package/postgresql/postgresql.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options 2026-11-07 16:34 ` [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options Angelo Compagnucci @ 2026-11-09 7:13 ` Maxim Kochetkov via buildroot 0 siblings, 0 replies; 23+ messages in thread From: Maxim Kochetkov via buildroot @ 2026-11-09 7:13 UTC (permalink / raw) To: Angelo Compagnucci, buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 07.11.2026 19:34, Angelo Compagnucci wrote: > 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. > > Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Reviewed-by: Maxim Kochetkov <fido_max@inbox.ru> _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 08/15] package/libselinux: drop the unused make environment 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (6 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories Angelo Compagnucci ` (6 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk index 9a01b9cf94..2039d5f1ab 100644 --- a/package/libselinux/libselinux.mk +++ b/package/libselinux/libselinux.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (7 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 08/15] package/libselinux: drop the unused make environment Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-10 12:52 ` José Luis Salvador Rufo 2026-11-07 16:34 ` [Buildroot] [PATCH v4 10/15] package/mesa3d: drop the unused host Vulkan drivers Angelo Compagnucci ` (5 subsequent siblings) 14 siblings, 1 reply; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk index 071557bf3e..6c20939da5 100644 --- a/package/zfs/zfs.mk +++ b/package/zfs/zfs.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories 2026-11-07 16:34 ` [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories Angelo Compagnucci @ 2026-11-10 12:52 ` José Luis Salvador Rufo 0 siblings, 0 replies; 23+ messages in thread From: José Luis Salvador Rufo @ 2026-11-10 12:52 UTC (permalink / raw) To: Angelo Compagnucci Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, James Knight, Bernd Kuhls, Ricardo Martincoski, Maxim Kochetkov, Francois Perrad, Thomas Petazzoni, buildroot, Giulio Benetti, Fabrice Fontaine El sáb, 7 nov 2026 a las 17:34, Angelo Compagnucci (<angelo.compagnucci@gmail.com>) escribió: > > 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. > > Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Reviewed-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com> > --- > 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(-) > > diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk > index 071557bf3e..6c20939da5 100644 > --- a/package/zfs/zfs.mk > +++ b/package/zfs/zfs.mk > @@ -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) > -- > 2.53.0 > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 10/15] package/mesa3d: drop the unused host Vulkan drivers 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (8 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 11/15] package/nxp-mwifiex: drop the unused make options Angelo Compagnucci ` (4 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk index f20f02190a..329d5c3702 100644 --- a/package/mesa3d/mesa3d.mk +++ b/package/mesa3d/mesa3d.mk @@ -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 -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 11/15] package/nxp-mwifiex: drop the unused make options 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (9 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 10/15] package/mesa3d: drop the unused host Vulkan drivers Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables Angelo Compagnucci ` (3 subsequent siblings) 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/nxp-mwifiex/nxp-mwifiex.mk b/package/nxp-mwifiex/nxp-mwifiex.mk index 019939d93a..c49fd0965a 100644 --- a/package/nxp-mwifiex/nxp-mwifiex.mk +++ b/package/nxp-mwifiex/nxp-mwifiex.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (10 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 11/15] package/nxp-mwifiex: drop the unused make options Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-11 22:46 ` Fiona Klute via buildroot 2026-11-07 16:34 ` [Buildroot] [PATCH v4 13/15] package/linux-pam: fix linking with the NLS and atomic libraries Angelo Compagnucci ` (2 subsequent siblings) 14 siblings, 1 reply; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk b/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk index 1e512fd7ed..856e7e697d 100644 --- a/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk +++ b/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk @@ -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 \ -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables 2026-11-07 16:34 ` [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables Angelo Compagnucci @ 2026-11-11 22:46 ` Fiona Klute via buildroot 0 siblings, 0 replies; 23+ messages in thread From: Fiona Klute via buildroot @ 2026-11-11 22:46 UTC (permalink / raw) To: Angelo Compagnucci, buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls Am 07.11.26 um 17:34 schrieb 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. > > Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Reviewed-by: Fiona Klute <fiona.klute@gmx.de> Thanks for cleaning up! > --- > 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(-) > > diff --git a/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk b/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk > index 1e512fd7ed..856e7e697d 100644 > --- a/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk > +++ b/package/libglib2/libglib2-bootstrap/libglib2-bootstrap.mk > @@ -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 \ _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 13/15] package/linux-pam: fix linking with the NLS and atomic libraries 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (11 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 14/15] utils/check-package: warn about symbols not recognized by a package infra Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 15/15] utils/check-package: warn about disabled install Angelo Compagnucci 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls 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") Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(-) diff --git a/package/linux-pam/linux-pam.mk b/package/linux-pam/linux-pam.mk index a4be4fa3b6..844ca2a1fe 100644 --- a/package/linux-pam/linux-pam.mk +++ b/package/linux-pam/linux-pam.mk @@ -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) -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 14/15] utils/check-package: warn about symbols not recognized by a package infra 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (12 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 13/15] package/linux-pam: fix linking with the NLS and atomic libraries Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 15/15] utils/check-package: warn about disabled install Angelo Compagnucci 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Francois Perrad, Thomas Petazzoni, James Knight, Thomas De Schampheleire, Giulio Benetti, Bernd Kuhls, Ricardo Martincoski From: Ricardo Martincoski <ricardo.martincoski@gmail.com> 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 <francois.perrad@gadz.org> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com> Cc: Romain Naour <romain.naour@gmail.com> Cc: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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 diff --git a/.checkpackageignore b/.checkpackageignore index 25c668db54..6419cc53b8 100644 --- a/.checkpackageignore +++ b/.checkpackageignore @@ -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 diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk index 3b3d4ed8b9..69f0910368 100644 --- a/fs/initramfs/initramfs.mk +++ b/fs/initramfs/initramfs.mk @@ -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 diff --git a/linux/linux-ext-xenomai.mk b/linux/linux-ext-xenomai.mk index 5ec6891bbf..247ff087cb 100644 --- a/linux/linux-ext-xenomai.mk +++ b/linux/linux-ext-xenomai.mk @@ -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 diff --git a/package/luarocks/luarocks.mk b/package/luarocks/luarocks.mk index 43d099726f..f808f4ca13 100644 --- a/package/luarocks/luarocks.mk +++ b/package/luarocks/luarocks.mk @@ -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 diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk index fe87a72ed4..36344c1b20 100644 --- a/toolchain/toolchain.mk +++ b/toolchain/toolchain.mk @@ -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 diff --git a/utils/check-package b/utils/check-package index f9978adef4..d83484efc5 100755 --- a/utils/check-package +++ b/utils/check-package @@ -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): diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py index 297cb14460..9e154e3049 100644 --- a/utils/checkpackagelib/lib_mk.py +++ b/utils/checkpackagelib/lib_mk.py @@ -14,6 +14,7 @@ from checkpackagelib.lib import EmptyLastLine # noqa: F401 from checkpackagelib.lib import NewlineAtEof # noqa: F401 from checkpackagelib.lib import TrailingSpace # noqa: F401 from checkpackagelib.lib import Utf8Characters # noqa: F401 +from checkpackagelib.pkg_infra import get_valid_suffixes from checkpackagelib.tool import NotExecutable # noqa: F401 # used in more than one check @@ -384,6 +385,125 @@ class TypoInPackageVariable(_CheckFunction): text] +class TypoInVariableSuffix(_CheckFunction): + USED_OUTSIDE_THE_PACKAGE = [ + "ALCHEMY_INSTALL_LIB_SDK_FILE", + "ALCHEMY_MAKE", + "ALCHEMY_TARGET_ENV", + "ARCH_TOOLCHAIN_WRAPPER_OPTS", + "BR_LIBC", + "BR_NO_CHECK_HASH_FOR", + "DIRECTFB_HOST_BINARY", + "ERLANG_EI_VSN", + "FLUTTER_ENGINE_GEN_SNAPSHOT", + "GCC_TARGET_ABI", + "GCC_TARGET_ARCH", + "GCC_TARGET_CPU", + "GCC_TARGET_FLOAT_ABI", + "GCC_TARGET_FP32_MODE", + "GCC_TARGET_FPU", + "GCC_TARGET_MODE", + "GCC_TARGET_NAN", + "GCC_TARGET_SIMD", + "GOB2_HOST_BINARY", + "GO_BINARIES_INSTALL", + "HOST_FLUTTER_SDK_BIN_DART_BIN", + "HOST_FLUTTER_SDK_BIN_FLUTTER", + "HOST_GCC_APPLY_PATCHES", + "HOST_GCC_CONFIGURE_SYMLINK", + "HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS", + "HOST_GCC_XTENSA_OVERLAY_EXTRACT", + "HOST_GO_HOST_ENV", + "HOST_GO_TARGET_ENV", + "LIBGLIB2_HOST_BINARY", + "LIBXML2_HOST_BINARY", + "LUA_RUN", + "MKFS_JFFS2", + "PKG_CONFIG_HOST_BINARY", + "QEMU_USER", + "QT5_QMAKE", + "QT5_QT_CONF_FIXUP", + "QT6_GIT", + "QT6_QMAKE", + "QT6_QT_CONF_FIXUP", + "QT6_SOURCE_TARBALL_PREFIX", + "TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE", + "TOOLCHAIN_WRAPPER_BUILD", + "TOOLCHAIN_WRAPPER_INSTALL", + ] + DEFINITION = re.compile(r"^(define\s+)?([A-Z0-9_]+_[A-Z0-9_]+)") + USAGE = re.compile(r"([A-Z0-9_]+_[A-Z0-9_]+)") + INDIRECTLY_USING_SUBDIR = re.compile(r"\$\(call\s+" + r",|\$\(call\s+".join([ + "KCONFIG_DISABLE_OPT", + "KCONFIG_ENABLE_OPT", + "KCONFIG_SET_OPT", + ]) + r",|[A-Z0-9_]+" + r"\b|[A-Z0-9_]+".join([ + "_BUILDDIR", + "_SRCDIR", + "_SUBDIR", + ]) + r"\b") + + def before(self): + self.usage = [] + self.definitions = {} + if self.filename.startswith("linux/linux-ext-"): + self.valid_suffixes = ["LINUX_EXTENSIONS", "_PREPARE_KERNEL"] + elif self.filename.startswith("package/linux-tools/linux-tool-"): + self.valid_suffixes = ["LINUX_TOOLS", "LINUX_TOOLS_BIN_ARCH_EXCLUDE", + "LINUX_TOOLS_POST_PATCH_HOOKS", "LINUX_TOOLS_PRE_CONFIGURE_HOOKS", + "_DEPENDENCIES", + "_BUILD_CMDS", "_INSTALL_STAGING_CMDS", "_INSTALL_TARGET_CMDS", + "_LINUX_CONFIG_FIXUPS", "_INSTALL_INIT_SYSTEMD", + "_INSTALL_INIT_SYSV", "_INSTALL_INIT_OPENRC"] + elif self.filename.startswith("fs/initramfs/"): + self.valid_suffixes = ["_DEPENDENCIES", "_NAME", "_TYPE"] + else: + self.valid_suffixes = [] + self.using_subdir = False + + def check_line(self, lineno, text): + self.valid_suffixes += get_valid_suffixes(text) + + m = self.DEFINITION.search(text) + if m: + variable = m.group(2) + if variable not in self.USED_OUTSIDE_THE_PACKAGE: + self.definitions[variable] = [lineno, text] + + rest_of_line = self.DEFINITION.sub('', text) + variables = self.USAGE.findall(rest_of_line) + for variable in variables: + self.usage.append(variable) + + if self.INDIRECTLY_USING_SUBDIR.search(rest_of_line): + self.using_subdir = True + + def after(self): + if self.using_subdir: + _, package = get_package_prefix_from_filename(self.filename) + self.usage.append(package + "_SUBDIR") + self.usage.append("HOST_" + package + "_SUBDIR") + + possible_typo = {} + for variable, where in self.definitions.items(): + valid_suffix = False + for suffix in self.valid_suffixes: + if variable.endswith(suffix): + valid_suffix = True + break + if not valid_suffix: + possible_typo[variable] = where + + warnings = [] + for variable, where in possible_typo.items(): + if variable not in self.usage: + lineno, text = where + warnings.append(["{}:{}: possible typo on suffix: {}" + .format(self.filename, lineno, variable), + text]) + return warnings + + class UselessFlag(_CheckFunction): DEFAULT_AUTOTOOLS_FLAG = re.compile(r"^.*{}".format("|".join([ r"_AUTORECONF\s*=\s*NO", diff --git a/utils/checkpackagelib/pkg_infra.py b/utils/checkpackagelib/pkg_infra.py new file mode 100644 index 0000000000..1e292d65d6 --- /dev/null +++ b/utils/checkpackagelib/pkg_infra.py @@ -0,0 +1,322 @@ +AUTOTOOLS_VALID_SUFFIXES = [ + "_AUTOPOINT", + "_AUTORECONF", + "_AUTORECONF_OPTS", + "_CONF_ENV", + "_CONF_OPTS", + "_GETTEXTIZE", + "_GETTEXTIZE_OPTS", + "_INSTALL_OPTS", + "_INSTALL_STAGING_OPTS", + "_INSTALL_TARGET_OPTS", + "_LIBTOOL_PATCH", + "_MAKE", + "_MAKE_ENV", + "_MAKE_OPTS", + "_SUBDIR", + ] +BAREBOX_VALID_SUFFIXES = [ + ] +CARGO_VALID_SUFFIXES = [ + "_CARGO_BUILD_OPTS", + "_CARGO_ENV", + "_CARGO_INSTALL_OPTS", + "_SUBDIR", + ] +CMAKE_VALID_SUFFIXES = [ + "_BUILD_ENV", + "_BUILD_OPTS", + "_CMAKE_BACKEND", + "_CONF_ENV", + "_CONF_OPTS", + "_INSTALL_OPTS", + "_INSTALL_STAGING_OPTS", + "_INSTALL_TARGET_OPTS", + "_MAKE", + "_MAKE_ENV", + "_MAKE_OPTS", + "_SUBDIR", + "_SUPPORTS_IN_SOURCE_BUILD", + ] +GENERIC_VALID_SUFFIXES = [ + "_ACTUAL_SOURCE_SITE", + "_ACTUAL_SOURCE_TARBALL", + "_ADDITIONAL_DOWNLOADS", + "_ADD_CCACHE_DEPENDENCY", + "_ADD_SKELETON_DEPENDENCY", + "_ADD_TOOLCHAIN_DEPENDENCY", + "_BIN_ARCH_EXCLUDE", + "_BUILD_CMDS", + "_BUSYBOX_CONFIG_FIXUPS", + "_CONFIGURE_CMDS", + "_CONFIG_SCRIPTS", + "_CPE_ID", + "_CPE_ID_PREFIX", + "_CPE_ID_PRODUCT", + "_CPE_ID_UPDATE", + "_CPE_ID_VALID", + "_CPE_ID_VENDOR", + "_CPE_ID_VERSION", + "_DEPENDENCIES", + "_DEVICES", + "_DL_DIR", + "_DL_ENV", + "_DL_OPTS", + "_DL_SUBDIR", + "_DL_VERSION", + "_DOWNLOAD_DEPENDENCIES", + "_DOWNLOAD_POST_PROCESS", + "_DOWNLOAD_POST_PROCESS_OPTS", + "_DROP_FILES_OR_DIRS", + "_EXCLUDES", + "_EXTRACT_CMDS", + "_EXTRACT_DEPENDENCIES", + "_EXTRA_DOWNLOADS", + "_FLAT_STACKSIZE", + "_GIT_LFS", + "_GIT_SUBMODULES", + "_HELP_CMDS", + "_IGNORE_CVES", + "_INSTALL_CMDS", + "_INSTALL_IMAGES", + "_INSTALL_IMAGES_CMDS", + "_INSTALL_INIT_OPENRC", + "_INSTALL_INIT_SYSTEMD", + "_INSTALL_INIT_SYSV", + "_INSTALL_STAGING", + "_INSTALL_STAGING_CMDS", + "_INSTALL_TARGET", + "_INSTALL_TARGET_CMDS", + "_KEEP_PY_FILES", + "_LICENSE", + "_LICENSE_FILES", + "_LINUX_CONFIG_FIXUPS", + "_NAME", + "_OVERRIDE_SRCDIR", + "_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS", + "_PATCH", + "_PATCH_DEPENDENCIES", + "_PERMISSIONS", + "_POST_BUILD_HOOKS", + "_POST_CONFIGURE_HOOKS", + "_POST_DOWNLOAD_HOOKS", + "_POST_EXTRACT_HOOKS", + "_POST_INSTALL_HOOKS", + "_POST_INSTALL_IMAGES_HOOKS", + "_POST_INSTALL_STAGING_HOOKS", + "_POST_INSTALL_TARGET_HOOKS", + "_POST_LEGAL_INFO_HOOKS", + "_POST_PATCH_HOOKS", + "_POST_PREPARE_HOOKS", + "_POST_RSYNC_HOOKS", + "_PRE_BUILD_HOOKS", + "_PRE_CONFIGURE_HOOKS", + "_PRE_DOWNLOAD_HOOKS", + "_PRE_EXTRACT_HOOKS", + "_PRE_INSTALL_HOOKS", + "_PRE_INSTALL_IMAGES_HOOKS", + "_PRE_INSTALL_STAGING_HOOKS", + "_PRE_INSTALL_TARGET_HOOKS", + "_PRE_LEGAL_INFO_HOOKS", + "_PRE_PATCH_HOOKS", + "_PRE_RSYNC_HOOKS", + "_PROVIDES", + "_REDISTRIBUTE", + "_ROOTFS_PRE_CMD_HOOKS", + "_SELINUX_MODULES", + "_SITE", + "_SITE_METHOD", + "_SOURCE", + "_STRIP_COMPONENTS", + "_SVN_EXTERNALS", + "_TARGET_FINALIZE_HOOKS", + "_TOOLCHAIN_WRAPPER_ARGS", + "_USERS", + "_VERSION", + ] +GOLANG_VALID_SUFFIXES = [ + "_BIN_NAME", + "_BUILD_OPTS", + "_BUILD_TARGETS", + "_EXTLDFLAGS", + "_GOMOD", + "_GO_ENV", + "_INSTALL_BINS", + "_LDFLAGS", + "_SRC_DOMAIN", + "_SRC_SOFTWARE", + "_SRC_VENDOR", + "_SUBDIR", + "_TAGS", + ] +KCONFIG_VALID_SUFFIXES = [ + "_KCONFIG_DEFCONFIG", + "_KCONFIG_DEPENDENCIES", + "_KCONFIG_DOTCONFIG", + "_KCONFIG_EDITORS", + "_KCONFIG_FILE", + "_KCONFIG_FIXUP_CMDS", + "_KCONFIG_FRAGMENT_FILES", + "_KCONFIG_MAKE", + "_KCONFIG_OPTS", + "_KCONFIG_RULES", + "_KCONFIG_SUPPORTS_DEFCONFIG", + "_MAKE", + "_MAKE_ENV", + ] +KERNEL_MODULE_VALID_SUFFIXES = [ + "_DEPENDENCIES", + "_MAKE", + "_MODULE_MAKE_OPTS", + "_MODULE_SUBDIRS", + ] +LUAROCKS_VALID_SUFFIXES = [ + "_BUILD_OPTS", + "_NAME_UPSTREAM", + "_ROCKSPEC", + "_SUBDIR", + ] +MESON_VALID_SUFFIXES = [ + "_CFLAGS", + "_CONF_ENV", + "_CONF_OPTS", + "_CXXFLAGS", + "_FCFLAGS", + "_LDFLAGS", + "_MESON_EXTRA_BINARIES", + "_MESON_EXTRA_PROPERTIES", + "_NINJA_ENV", + "_NINJA_OPTS", + "_SUBDIR", + ] +PERL_VALID_SUFFIXES = [ + "_BUILD_OPTS", + "_CONF_ENV", + "_CONF_OPTS", + "_DISTNAME", + "_INSTALL_TARGET_OPTS", + "_PREFER_INSTALLER", + "_SUBDIR", + ] +PYTHON_VALID_SUFFIXES = [ + "_BASE_INSTALL_CMD", + "_BUILD_OPTS", + "_CARGO_MANIFEST_PATH", + "_ENV", + "_INSTALL_OPTS", + "_INSTALL_STAGING_OPTS", + "_INSTALL_TARGET_OPTS", + "_SETUP_TYPE", + "_SUBDIR", + ] +QMAKE_VALID_SUFFIXES = [ + "_CONF_ENV", + "_CONF_OPTS", + "_INSTALL_STAGING_OPTS", + "_INSTALL_TARGET_OPTS", + "_MAKE_ENV", + "_MAKE_OPTS", + "_SUBDIR", + "_SYNC_QT_HEADERS", + ] +REBAR_VALID_SUFFIXES = [ + "_CONF_ENV", + "_KEEP_DEPENDENCIES", + "_REBAR_ENV", + "_USE_AUTOCONF", + "_USE_BUNDLED_REBAR", + ] +ROOTFS_VALID_SUFFIXES = [ + "_CMD", + "_DEPENDENCIES", + "_IMAGE_NAME", + "_POST_GEN_HOOKS", + "_PRE_GEN_HOOKS", + "_VERITY_EXTRA_ARGS", + ] +TOOLCHAIN_EXTERNAL_VALID_SUFFIXES = [ + ] +VIRTUAL_VALID_SUFFIXES = [ + "_IS_VIRTUAL", + ] +WAF_VALID_SUFFIXES = [ + "_BUILD_OPTS", + "_CONF_ENV", + "_CONF_OPTS", + "_INSTALL_STAGING_OPTS", + "_INSTALL_TARGET_OPTS", + "_MAKE_ENV", + "_NEEDS_EXTERNAL_WAF", + "_SUBDIR", + "_WAF", + "_WAF_OPTS", + ] + + +ALL_VALID_SUFFIXES = \ + AUTOTOOLS_VALID_SUFFIXES + \ + BAREBOX_VALID_SUFFIXES + \ + CARGO_VALID_SUFFIXES + \ + CMAKE_VALID_SUFFIXES + \ + GENERIC_VALID_SUFFIXES + \ + GOLANG_VALID_SUFFIXES + \ + KCONFIG_VALID_SUFFIXES + \ + KERNEL_MODULE_VALID_SUFFIXES + \ + LUAROCKS_VALID_SUFFIXES + \ + MESON_VALID_SUFFIXES + \ + PERL_VALID_SUFFIXES + \ + PYTHON_VALID_SUFFIXES + \ + QMAKE_VALID_SUFFIXES + \ + REBAR_VALID_SUFFIXES + \ + ROOTFS_VALID_SUFFIXES + \ + TOOLCHAIN_EXTERNAL_VALID_SUFFIXES + \ + VIRTUAL_VALID_SUFFIXES + \ + WAF_VALID_SUFFIXES + + +def get_valid_suffixes(text): + if text.startswith("include"): + # we cannot guess the package infra used looking only at this file, so + # default to a superset of all known package infra types + return ALL_VALID_SUFFIXES + if text.startswith("$(eval"): + if "autotools-package)" in text: + return GENERIC_VALID_SUFFIXES + AUTOTOOLS_VALID_SUFFIXES + if "barebox-package)" in text: + return GENERIC_VALID_SUFFIXES + KCONFIG_VALID_SUFFIXES + BAREBOX_VALID_SUFFIXES + if "cargo-package)" in text: + return GENERIC_VALID_SUFFIXES + CARGO_VALID_SUFFIXES + if "cmake-package)" in text: + return GENERIC_VALID_SUFFIXES + CMAKE_VALID_SUFFIXES + if "generic-package)" in text: + return GENERIC_VALID_SUFFIXES + if "golang-package)" in text: + return GENERIC_VALID_SUFFIXES + GOLANG_VALID_SUFFIXES + if "kconfig-package)" in text: + return GENERIC_VALID_SUFFIXES + KCONFIG_VALID_SUFFIXES + if "kernel-module)" in text: + return KERNEL_MODULE_VALID_SUFFIXES + if "luarocks-package)" in text: + return GENERIC_VALID_SUFFIXES + LUAROCKS_VALID_SUFFIXES + if "meson-package)" in text: + return GENERIC_VALID_SUFFIXES + MESON_VALID_SUFFIXES + if "perl-package)" in text: + return GENERIC_VALID_SUFFIXES + PERL_VALID_SUFFIXES + if "python-package)" in text: + return GENERIC_VALID_SUFFIXES + PYTHON_VALID_SUFFIXES + if "qmake-package)" in text: + return GENERIC_VALID_SUFFIXES + QMAKE_VALID_SUFFIXES + if "rebar-package)" in text: + return GENERIC_VALID_SUFFIXES + AUTOTOOLS_VALID_SUFFIXES + REBAR_VALID_SUFFIXES + if "(rootfs)" in text: + return ROOTFS_VALID_SUFFIXES + if "toolchain-external-package)" in text: + return GENERIC_VALID_SUFFIXES + TOOLCHAIN_EXTERNAL_VALID_SUFFIXES + if "virtual-package)" in text: + return GENERIC_VALID_SUFFIXES + VIRTUAL_VALID_SUFFIXES + if "waf-package)" in text: + return GENERIC_VALID_SUFFIXES + WAF_VALID_SUFFIXES + # any new package infra will need support here, otherwise default to a + # superset of all known package infra types + return ALL_VALID_SUFFIXES + return [] diff --git a/utils/checkpackagelib/test_lib_mk.py b/utils/checkpackagelib/test_lib_mk.py index 1bbb0af20c..eca0a255f8 100644 --- a/utils/checkpackagelib/test_lib_mk.py +++ b/utils/checkpackagelib/test_lib_mk.py @@ -714,6 +714,432 @@ def test_TypoInPackageVariable(testname, filename, string, expected): assert warnings == expected +TypoInVariableSuffix = [ + ('good', + 'any.mk', + 'ANY_CONF_OPTS = \n' + '$(eval $(foo-package))\n', + [[]]), + ('bad', + 'any.mk', + 'ANY_VAR = \n' + '$(eval $(foo-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_VAR', 'ANY_VAR = \n']]]), + ('internal variable', + 'any.mk', + 'ANY_VAR = \n' + 'ANY_CONF_OPTS = ANY_VAR OTHER_VAR\n' + '$(eval $(foo-package))\n', + [[]]), + ('ignore missing space', + 'any.mk', + 'OTHER_VAR= \n', + [[['any.mk:1: possible typo on suffix: OTHER_VAR', 'OTHER_VAR= \n']]]), + ('libc exception', + './any.mk', + 'BR_LIBC = \n', + [[]]), + ('arch/gcc/toolchain exception', + 'any.mk', + 'GCC_TARGET_FPU += \n', + [[]]), + ('host (bad)', + 'any.mk', + 'HOST_OTHER_VAR = \n', + [[['any.mk:1: possible typo on suffix: HOST_OTHER_VAR', 'HOST_OTHER_VAR = \n']]]), + ('provides', + 'any.mk', + 'ANY_PROVIDES = other thing\n' + 'OTHER_VAR = \n' + '$(eval $(foo-package))\n', + [[['any.mk:2: possible typo on suffix: OTHER_VAR', 'OTHER_VAR = \n']]]), + ('ignore space', + 'any.mk', + 'ANY_PROVIDES = thing other \n' + 'OTHER_VAR = \n' + '$(eval $(foo-package))\n', + [[['any.mk:2: possible typo on suffix: OTHER_VAR', 'OTHER_VAR = \n']]]), + ('multiple warnings', + 'file.mk', + 'LUA_RUN = FILE_INTERNAL_VAR\n' + 'FILE_DEPENDENCY = wrong\n' + 'FILE_LICENCE = wrong\n' + 'FILE_CONF_OPTS = ok\n' + 'FILE_INTERNAL_VAR = used above\n' + 'FILE_WRONG = # commment\n' + '$(eval $(foo-package))\n', + [[['file.mk:2: possible typo on suffix: FILE_DEPENDENCY', 'FILE_DEPENDENCY = wrong\n'], + ['file.mk:3: possible typo on suffix: FILE_LICENCE', 'FILE_LICENCE = wrong\n'], + ['file.mk:6: possible typo on suffix: FILE_WRONG', 'FILE_WRONG = # commment\n']]]), + ('linux extensions', + 'linux/linux-ext-any.mk', + 'ANY_CPE_ID = \n' + 'define ANY_BUILD_CMDS\n' + 'endef\n' + 'ANY_PREPARE_KERNEL = \n', + [[['linux/linux-ext-any.mk:1: possible typo on suffix: ANY_CPE_ID', 'ANY_CPE_ID = \n'], + ['linux/linux-ext-any.mk:2: possible typo on suffix: ANY_BUILD_CMDS', 'define ANY_BUILD_CMDS\n']]]), + ('linux tools', + 'package/linux-tools/linux-tool-any.mk', + 'ANY_CPE_ID = \n' + 'define ANY_BUILD_CMDS\n' + 'endef\n' + 'ANY_PREPARE_KERNEL = \n', + [[['package/linux-tools/linux-tool-any.mk:1: possible typo on suffix: ANY_CPE_ID', 'ANY_CPE_ID = \n'], + ['package/linux-tools/linux-tool-any.mk:4: possible typo on suffix: ANY_PREPARE_KERNEL', 'ANY_PREPARE_KERNEL = \n']]]), + ('initramfs do not use fs infra', + 'fs/initramfs/any.mk', + 'ANY_CPE_ID = \n' + 'ANY_NAME = \n', + [[['fs/initramfs/any.mk:1: possible typo on suffix: ANY_CPE_ID', 'ANY_CPE_ID = \n']]]), + ('autotools', + 'any.mk', + 'ANY_CONF_OPTS = \n' + 'ANY_CPE_ID = \n' + 'ANY_GETTEXTIZE = \n' + 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n' + '$(eval $(autotools-package))\n', + [[['any.mk:4: possible typo on suffix: ANY_SUPPORTS_IN_SOURCE_BUILD', 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n']]]), + ('barebox', + 'any.mk', + 'ANY_CONF_OPTS = \n' + 'ANY_CPE_ID = \n' + '$(eval $(barebox-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n']]]), + ('cmake', + 'any.mk', + 'ANY_CONF_OPTS = \n' + 'ANY_CPE_ID = \n' + 'ANY_GETTEXTIZE = \n' + 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n' + '$(eval $(cmake-package))\n', + [[['any.mk:3: possible typo on suffix: ANY_GETTEXTIZE', 'ANY_GETTEXTIZE = \n']]]), + ('cargo', + 'any.mk', + 'ANY_CONF_OPTS = \n' + 'ANY_CPE_ID = \n' + 'ANY_CARGO_INSTALL_OPTS = \n' + '$(eval $(cargo-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n']]]), + ('generic', + 'any.mk', + 'ANY_CONF_OPTS = \n' + 'ANY_CPE_ID = \n' + '$(eval $(generic-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n']]]), + ('golang', + 'any.mk', + 'ANY_GO_ENV = \n' + 'ANY_CONF_OPTS = \n' + '$(eval $(golang-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n']]]), + ('kconfig', + 'any.mk', + 'ANY_GO_ENV = \n' + 'ANY_KCONFIG_FIXUP_CMDS = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + '$(eval $(kconfig-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_GO_ENV', 'ANY_GO_ENV = \n'], + # https://bugs.buildroot.org/show_bug.cgi?id=15161 kernel can't support SUBDIR + ['any.mk:4: possible typo on suffix: ANY_SUBDIR', 'ANY_SUBDIR = \n']]]), + ('kernel module + autotools', + 'any.mk', + 'ANY_CPE_ID = \n' + 'ANY_GETTEXTIZE = \n' + 'ANY_GO_ENV = \n' + 'ANY_KCONFIG_FIXUP_CMDS = \n' + 'ANY_MODULE_SUBDIRS = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n' + '$(eval $(kernel-module))\n' + '$(eval $(autotools-package))\n', + [[['any.mk:3: possible typo on suffix: ANY_GO_ENV', 'ANY_GO_ENV = \n'], + ['any.mk:4: possible typo on suffix: ANY_KCONFIG_FIXUP_CMDS', 'ANY_KCONFIG_FIXUP_CMDS = \n'], + ['any.mk:8: possible typo on suffix: ANY_SUPPORTS_IN_SOURCE_BUILD', 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n']]]), + ('kernel module + generic', + 'any.mk', + 'ANY_CPE_ID = \n' + 'ANY_GETTEXTIZE = \n' + 'ANY_GO_ENV = \n' + 'ANY_KCONFIG_FIXUP_CMDS = \n' + 'ANY_MODULE_SUBDIRS = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n' + '$(eval $(kernel-module))\n' + '$(eval $(generic-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_GETTEXTIZE', 'ANY_GETTEXTIZE = \n'], + ['any.mk:3: possible typo on suffix: ANY_GO_ENV', 'ANY_GO_ENV = \n'], + ['any.mk:4: possible typo on suffix: ANY_KCONFIG_FIXUP_CMDS', 'ANY_KCONFIG_FIXUP_CMDS = \n'], + ['any.mk:7: possible typo on suffix: ANY_SUBDIR', 'ANY_SUBDIR = \n'], + ['any.mk:8: possible typo on suffix: ANY_SUPPORTS_IN_SOURCE_BUILD', 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n']]]), + ('kernel module + cmake', + 'any.mk', + 'ANY_CPE_ID = \n' + 'ANY_GETTEXTIZE = \n' + 'ANY_GO_ENV = \n' + 'ANY_KCONFIG_FIXUP_CMDS = \n' + 'ANY_MODULE_SUBDIRS = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SUPPORTS_IN_SOURCE_BUILD = \n' + '$(eval $(kernel-module))\n' + '$(eval $(cmake-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_GETTEXTIZE', 'ANY_GETTEXTIZE = \n'], + ['any.mk:3: possible typo on suffix: ANY_GO_ENV', 'ANY_GO_ENV = \n'], + ['any.mk:4: possible typo on suffix: ANY_KCONFIG_FIXUP_CMDS', 'ANY_KCONFIG_FIXUP_CMDS = \n']]]), + ('luarocks', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + '$(eval $(luarocks-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:4: possible typo on suffix: ANY_DISTNAME', 'ANY_DISTNAME = \n'], + ['any.mk:5: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:6: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n'], + ['any.mk:7: possible typo on suffix: ANY_INSTALL_STAGING_OPTS', 'ANY_INSTALL_STAGING_OPTS = \n'], + ['any.mk:8: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n']]]), + ('meson', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'HOST_ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + '$(eval $(host-meson-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_BUILD_OPTS', 'ANY_BUILD_OPTS = \n'], + ['any.mk:3: possible typo on suffix: ANY_ROCKSPEC', 'ANY_ROCKSPEC = \n'], + ['any.mk:4: possible typo on suffix: ANY_DISTNAME', 'ANY_DISTNAME = \n'], + ['any.mk:5: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:7: possible typo on suffix: HOST_ANY_INSTALL_STAGING_OPTS', 'HOST_ANY_INSTALL_STAGING_OPTS = \n'], + ['any.mk:8: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n']]]), + ('perl', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + '$(eval $(perl-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:3: possible typo on suffix: ANY_ROCKSPEC', 'ANY_ROCKSPEC = \n'], + ['any.mk:5: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:7: possible typo on suffix: ANY_INSTALL_STAGING_OPTS', 'ANY_INSTALL_STAGING_OPTS = \n'], + ['any.mk:8: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n']]]), + ('python', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + '$(eval $(host-python-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:3: possible typo on suffix: ANY_ROCKSPEC', 'ANY_ROCKSPEC = \n'], + ['any.mk:4: possible typo on suffix: ANY_DISTNAME', 'ANY_DISTNAME = \n'], + ['any.mk:6: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n'], + ['any.mk:8: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n'], + ['any.mk:11: possible typo on suffix: ANY_SYNC_QT_HEADERS', 'ANY_SYNC_QT_HEADERS = \n']]]), + ('qmake + host generic', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_TARGET_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + '$(eval $(qmake-package))\n' + '$(eval $(host-generic-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_BUILD_OPTS', 'ANY_BUILD_OPTS = \n'], + ['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:3: possible typo on suffix: ANY_ROCKSPEC', 'ANY_ROCKSPEC = \n'], + ['any.mk:4: possible typo on suffix: ANY_DISTNAME', 'ANY_DISTNAME = \n'], + ['any.mk:5: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:8: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n']]]), + ('rebar', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_ROCKSPEC = \n' + 'ANY_DISTNAME = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + '$(eval $(rebar-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_BUILD_OPTS', 'ANY_BUILD_OPTS = \n'], + ['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:3: possible typo on suffix: ANY_ROCKSPEC', 'ANY_ROCKSPEC = \n'], + ['any.mk:4: possible typo on suffix: ANY_DISTNAME', 'ANY_DISTNAME = \n'], + ['any.mk:5: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:11: possible typo on suffix: ANY_SYNC_QT_HEADERS', 'ANY_SYNC_QT_HEADERS = \n']]]), + ('toolchain-external', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_INSTALL_STAGING = \n' + 'ANY_INSTALL_STAGING_CMDS = \n' + 'ANY_IS_VIRTUAL= \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_WAF = \n' + '$(eval $(toolchain-external-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_BUILD_OPTS', 'ANY_BUILD_OPTS = \n'], + ['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:3: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n'], + ['any.mk:4: possible typo on suffix: ANY_INSTALL_STAGING_OPTS', 'ANY_INSTALL_STAGING_OPTS = \n'], + ['any.mk:7: possible typo on suffix: ANY_IS_VIRTUAL', 'ANY_IS_VIRTUAL= \n'], + ['any.mk:9: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:10: possible typo on suffix: ANY_SUBDIR', 'ANY_SUBDIR = \n'], + ['any.mk:11: possible typo on suffix: ANY_SYNC_QT_HEADERS', 'ANY_SYNC_QT_HEADERS = \n'], + ['any.mk:12: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n'], + ['any.mk:13: possible typo on suffix: ANY_WAF', 'ANY_WAF = \n']]]), + ('virtual', + 'any.mk', + 'ANY_BUILD_OPTS ?= \n' + 'ANY_CFLAGS := \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_IS_VIRTUAL= \n' + 'ANY_PRE_PATCH_HOOKS += \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_WAF = \n' + '$(eval $(virtual-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_BUILD_OPTS', 'ANY_BUILD_OPTS ?= \n'], + ['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS := \n'], + ['any.mk:3: possible typo on suffix: ANY_CONF_OPTS', 'ANY_CONF_OPTS = \n'], + ['any.mk:4: possible typo on suffix: ANY_INSTALL_STAGING_OPTS', 'ANY_INSTALL_STAGING_OPTS = \n'], + ['any.mk:7: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:8: possible typo on suffix: ANY_SUBDIR', 'ANY_SUBDIR = \n'], + ['any.mk:9: possible typo on suffix: ANY_SYNC_QT_HEADERS', 'ANY_SYNC_QT_HEADERS = \n'], + ['any.mk:10: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n'], + ['any.mk:11: possible typo on suffix: ANY_WAF', 'ANY_WAF = \n']]]), + ('waf', + 'any.mk', + 'ANY_BUILD_OPTS = \n' + 'ANY_CFLAGS = \n' + 'ANY_CONF_OPTS = \n' + 'ANY_INSTALL_STAGING_OPTS = \n' + 'ANY_IS_VIRTUAL= \n' + 'ANY_PRE_PATCH_HOOKS = \n' + 'ANY_SETUP_TYPE = \n' + 'ANY_SUBDIR = \n' + 'ANY_SYNC_QT_HEADERS = \n' + 'ANY_USE_AUTOCONF = \n' + 'ANY_WAF = \n' + '$(eval $(waf-package))\n', + [[['any.mk:2: possible typo on suffix: ANY_CFLAGS', 'ANY_CFLAGS = \n'], + ['any.mk:5: possible typo on suffix: ANY_IS_VIRTUAL', 'ANY_IS_VIRTUAL= \n'], + ['any.mk:7: possible typo on suffix: ANY_SETUP_TYPE', 'ANY_SETUP_TYPE = \n'], + ['any.mk:9: possible typo on suffix: ANY_SYNC_QT_HEADERS', 'ANY_SYNC_QT_HEADERS = \n'], + ['any.mk:10: possible typo on suffix: ANY_USE_AUTOCONF', 'ANY_USE_AUTOCONF = \n']]]), + ('SUBDIR no use', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_INSTALL_TARGET_CMDS\n' + '\tmake\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[['any.mk:1: possible typo on suffix: ANY_SUBDIR', 'ANY_SUBDIR = \n']]]), + ('SUBDIR explicit use', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_INSTALL_TARGET_CMDS\n' + '\tmake $(ANY_SUBDIR)\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[]]), + ('SUBDIR indirect use 1', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_INSTALL_TARGET_CMDS\n' + '\tmake $(ANY_SRCDIR)\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[]]), + ('SUBDIR indirect use 2', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_INSTALL_TARGET_CMDS\n' + '\tmake $(ANY_BUILDDIR)\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[]]), + ('SUBDIR indirect use 3', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_LINUX_CONFIG_FIXUPS\n' + '\t$(call KCONFIG_ENABLE_OPT,CONFIG_BPF_SYSCALL)\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[]]), + ('SUBDIR indirect use 4', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_LINUX_CONFIG_FIXUPS\n' + '\t$(call KCONFIG_SET_OPT,CONFIG_BPF_SYSCALL)\n' + 'endef\n' + '$(eval $(generic-package))\n', + [[]]), + ('SUBDIR indirect use 5', + 'any.mk', + 'ANY_SUBDIR = \n' + 'define ANY_LINUX_CONFIG_FIXUPS\n' + '\t$(call KCONFIG_DISABLE_OPT,CONFIG_BPF_SYSCALL)\n' + 'endef\n' + '$(eval $(kconfig-package))\n', + [[]]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', TypoInVariableSuffix) +def test_TypoInVariableSuffix(testname, filename, string, expected): + warnings = util.check_file(m.TypoInVariableSuffix, filename, string) + assert warnings == expected + + UselessFlag = [ ('autoreconf no', 'any.mk', -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Buildroot] [PATCH v4 15/15] utils/check-package: warn about disabled install 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci ` (13 preceding siblings ...) 2026-11-07 16:34 ` [Buildroot] [PATCH v4 14/15] utils/check-package: warn about symbols not recognized by a package infra Angelo Compagnucci @ 2026-11-07 16:34 ` Angelo Compagnucci 14 siblings, 0 replies; 23+ messages in thread From: Angelo Compagnucci @ 2026-11-07 16:34 UTC (permalink / raw) To: buildroot Cc: Joseph Kogut, Marcus Folkesson, Leo Yu-Chi Liang, Romain Naour, Antoine Tenart, José Luis Salvador Rufo, Ricardo Martincoski, Fabrice Fontaine, Maxim Kochetkov, Angelo Compagnucci, Francois Perrad, Thomas Petazzoni, James Knight, Giulio Benetti, Bernd Kuhls, Ricardo Martincoski From: Ricardo Martincoski <ricardo.martincoski@gmail.com> 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. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- 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(+) diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py index 9e154e3049..aeb88cb32b 100644 --- a/utils/checkpackagelib/lib_mk.py +++ b/utils/checkpackagelib/lib_mk.py @@ -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))) diff --git a/utils/checkpackagelib/test_lib_mk.py b/utils/checkpackagelib/test_lib_mk.py index eca0a255f8..83ebb2f7bd 100644 --- a/utils/checkpackagelib/test_lib_mk.py +++ b/utils/checkpackagelib/test_lib_mk.py @@ -105,6 +105,135 @@ def test_get_package_prefix_from_filename(testname, filename, expected): assert [prefix_lower, prefix_upper] == expected +DisabledInstall = [ + ('ignore comment at beginning of line', + 'any.mk', + '# very useful comment\n', + [[]]), + ('install images disabled (default)', + 'any.mk', + 'define ANY_INSTALL_IMAGES_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_IMAGES_HOOKS += MY_HOOK \n' + 'ANY_POST_INSTALL_IMAGES_HOOKS += MY_HOOK\t\n', + [[['any.mk:1: never called because ANY_INSTALL_IMAGES is disabled', + 'define ANY_INSTALL_IMAGES_CMDS\n'], + ['any.mk:3: never called because ANY_INSTALL_IMAGES is disabled', + 'ANY_PRE_INSTALL_IMAGES_HOOKS += MY_HOOK \n'], + ['any.mk:4: never called because ANY_INSTALL_IMAGES is disabled', + 'ANY_POST_INSTALL_IMAGES_HOOKS += MY_HOOK\t\n']]]), + ('install images disabled (explicit)', + 'any.mk', + 'ANY_INSTALL_IMAGES = NO\n' + 'define ANY_INSTALL_IMAGES_CMDS\n' + 'endef\n' + ' ANY_PRE_INSTALL_IMAGES_HOOKS += MY_HOOK\n' + '\tANY_POST_INSTALL_IMAGES_HOOKS += MY_HOOK\n', + [[['any.mk:2: never called because ANY_INSTALL_IMAGES is disabled', + 'define ANY_INSTALL_IMAGES_CMDS\n'], + ['any.mk:4: never called because ANY_INSTALL_IMAGES is disabled', + ' ANY_PRE_INSTALL_IMAGES_HOOKS += MY_HOOK\n'], + ['any.mk:5: never called because ANY_INSTALL_IMAGES is disabled', + '\tANY_POST_INSTALL_IMAGES_HOOKS += MY_HOOK\n']]]), + ('install images enabled', + 'any.mk', + ' ANY_INSTALL_IMAGES = YES \n' + 'define ANY_INSTALL_IMAGES_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_IMAGES_HOOKS += MY_HOOK\n' + 'ANY_POST_INSTALL_IMAGES_HOOKS += MY_HOOK\n', + [[]]), + ('install staging enabled (default for toolchain)', + 'toolchain/toolchain-any.mk', + 'define ANY_INSTALL_STAGING_CMDS\n' + 'endef\n' + 'ANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\t\n', + [[]]), + ('install staging enabled (default for linux tools)', + 'package/linux-tools/linux-tool-foo.mk.in', + 'define FOO_INSTALL_STAGING_CMDS\n' + 'endef\n', + [[]]), + ('install staging disabled (default)', + 'any.mk', + 'define ANY_INSTALL_STAGING_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_STAGING_HOOKS += MY_HOOK \n' + 'ANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\t\n', + [[['any.mk:1: never called because ANY_INSTALL_STAGING is disabled', + 'define ANY_INSTALL_STAGING_CMDS\n'], + ['any.mk:3: never called because ANY_INSTALL_STAGING is disabled', + 'ANY_PRE_INSTALL_STAGING_HOOKS += MY_HOOK \n'], + ['any.mk:4: never called because ANY_INSTALL_STAGING is disabled', + 'ANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\t\n']]]), + ('install staging disabled (explicit)', + 'any.mk', + 'ANY_INSTALL_STAGING = NO\n' + 'define ANY_INSTALL_STAGING_CMDS\n' + 'endef\n' + ' ANY_PRE_INSTALL_STAGING_HOOKS += MY_HOOK\n' + '\tANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\n', + [[['any.mk:2: never called because ANY_INSTALL_STAGING is disabled', + 'define ANY_INSTALL_STAGING_CMDS\n'], + ['any.mk:4: never called because ANY_INSTALL_STAGING is disabled', + ' ANY_PRE_INSTALL_STAGING_HOOKS += MY_HOOK\n'], + ['any.mk:5: never called because ANY_INSTALL_STAGING is disabled', + '\tANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\n']]]), + ('install staging enabled', + 'any.mk', + ' ANY_INSTALL_STAGING = YES \n' + 'define ANY_INSTALL_STAGING_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_STAGING_HOOKS += MY_HOOK\n' + 'ANY_POST_INSTALL_STAGING_HOOKS += MY_HOOK\n', + [[]]), + ('install target disabled (explicit)', + 'any.mk', + 'ANY_INSTALL_TARGET = NO\n' + 'define ANY_INSTALL_TARGET_CMDS\n' + 'endef\n' + ' ANY_PRE_INSTALL_TARGET_HOOKS += MY_HOOK\n' + '\tANY_POST_INSTALL_TARGET_HOOKS += MY_HOOK\n', + [[['any.mk:2: never called because ANY_INSTALL_TARGET is disabled', + 'define ANY_INSTALL_TARGET_CMDS\n'], + ['any.mk:4: never called because ANY_INSTALL_TARGET is disabled', + ' ANY_PRE_INSTALL_TARGET_HOOKS += MY_HOOK\n'], + ['any.mk:5: never called because ANY_INSTALL_TARGET is disabled', + '\tANY_POST_INSTALL_TARGET_HOOKS += MY_HOOK\n']]]), + ('install target enabled (explict)', + 'any.mk', + 'ANY_INSTALL_TARGET = YES\n' + 'define ANY_INSTALL_TARGET_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_TARGET_HOOKS += MY_HOOK\n' + 'ANY_POST_INSTALL_TARGET_HOOKS += MY_HOOK\n', + [[]]), + ('install target enabled (default)', + 'any.mk', + 'define ANY_INSTALL_TARGET_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_TARGET_HOOKS += MY_HOOK\n' + 'ANY_POST_INSTALL_TARGET_HOOKS += MY_HOOK\n', + [[]]), + ('install target possibly enabled (conditional)', + 'any.mk', + 'ifeq ($(condition))\n' + 'ANY_INSTALL_TARGET = NO\n' + 'endif\n' + 'define ANY_INSTALL_TARGET_CMDS\n' + 'endef\n' + 'ANY_PRE_INSTALL_TARGET_HOOKS += MY_HOOK\n' + 'ANY_POST_INSTALL_TARGET_HOOKS += MY_HOOK\n', + [[]]), + ] + + +@pytest.mark.parametrize('testname,filename,string,expected', DisabledInstall) +def test_DisabledInstall(testname, filename, string, expected): + warnings = util.check_file(m.DisabledInstall, filename, string) + assert warnings == expected + + Indent = [ ('ignore comment at beginning of line', 'any', -- 2.53.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 23+ messages in thread
end of thread, other threads:[~2026-11-11 22:47 UTC | newest] Thread overview: 23+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-09-03 16:35 [Buildroot] [next v3 0/3] check-package: support inline flags v3 Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 1/3] utils/check-package: factor-out check_disabled() Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 2/3] utils/check-package: support inline flags Ricardo Martincoski 2023-09-03 16:35 ` [Buildroot] [next v3 3/3] utils/check-package: remove hard-coded list from lib_config:Indent Ricardo Martincoski 2026-11-07 16:33 ` [Buildroot] [PATCH v4 00/15] check-package: warn about symbols not recognized by a package infra, support inline flags Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 01/15] utils/check-package: factor-out check_disabled() Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 02/15] utils/check-package: support inline flags Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 03/15] utils/check-package: remove hard-coded list from lib_config:Indent Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 04/15] package/andes-spi-burn: fix the license files variable Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 05/15] package/fbv: drop the unused configure options Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 06/15] package/usbip: fix the configure options variable Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 07/15] package/postgresql: drop the unused install-world options Angelo Compagnucci 2026-11-09 7:13 ` Maxim Kochetkov via buildroot 2026-11-07 16:34 ` [Buildroot] [PATCH v4 08/15] package/libselinux: drop the unused make environment Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 09/15] package/zfs: drop the unused module subdirectories Angelo Compagnucci 2026-11-10 12:52 ` José Luis Salvador Rufo 2026-11-07 16:34 ` [Buildroot] [PATCH v4 10/15] package/mesa3d: drop the unused host Vulkan drivers Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 11/15] package/nxp-mwifiex: drop the unused make options Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 12/15] package/libglib2/libglib2-bootstrap: drop unused variables Angelo Compagnucci 2026-11-11 22:46 ` Fiona Klute via buildroot 2026-11-07 16:34 ` [Buildroot] [PATCH v4 13/15] package/linux-pam: fix linking with the NLS and atomic libraries Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 14/15] utils/check-package: warn about symbols not recognized by a package infra Angelo Compagnucci 2026-11-07 16:34 ` [Buildroot] [PATCH v4 15/15] utils/check-package: warn about disabled install Angelo Compagnucci
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox