From fe489050806f2a0e7c2d14d9a5835fde9c71c7d5 Mon Sep 17 00:00:00 2001 From: Fiona Klute Date: Mon, 29 Sep 2025 11:24:31 +0200 Subject: [PATCH] Makefile: add check-package-external target The new target provides a convenient way to run utils/check-package on any external trees, using .checkpackageignore files from the respective trees if present. While .checkpackageignore should be used as little as possible, in a few cases adding overrides for false-positives to the affected files is not feasible, a practical example of this is a Markdown file misidentified as Python by libmagic (likely due to code blocks). Signed-off-by: Fiona Klute [Arnout: set ${ignore} explicitly to empty, in case it exists in the environment.] Signed-off-by: Arnout Vandecappelle --- Makefile | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d2257ed3a3..004039d847 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,8 @@ endif noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \ defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \ - print-version olddefconfig distclean manual manual-% check-package + print-version olddefconfig distclean manual manual-% check-package \ + check-package-external # Some global targets do not trigger a build, but are used to collect # metadata, or do various checks. When such targets are triggered, @@ -1255,10 +1256,29 @@ release: print-version: @echo $(BR2_VERSION_FULL) +# $(1): br2-external path +# $(2): br2-external description +define check-package-external + @$(call MESSAGE,"Checking packages in $(2)") + $(Q)if [ -r "$(1)/.checkpackageignore" ]; then \ + ignore="--ignore-list=$(1)/.checkpackageignore" ; \ + else \ + ignore=""; \ + fi ; \ + $(TOPDIR)/utils/check-package \ + --br2-external $${ignore} \ + `git -C $(1) ls-tree -r --format='$(1)/%(path)' HEAD` +endef + check-package: $(Q)./utils/check-package `git ls-tree -r --name-only HEAD` \ --ignore-list=$(TOPDIR)/.checkpackageignore +check-package-external: + $(foreach name,$(BR2_EXTERNAL_NAMES),\ + $(call check-package-external,$(BR2_EXTERNAL_$(name)_PATH),\ + $(BR2_EXTERNAL_$(name)_DESC))$(sep)) + .PHONY: .checkpackageignore .checkpackageignore: $(Q)./utils/check-package --failed-only `git ls-tree -r --name-only HEAD` \