Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Makefile: add check-package-external target
@ 2025-09-29  9:24 Fiona Klute via buildroot
  2026-01-01 17:18 ` Thomas Petazzoni via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2025-09-29  9:24 UTC (permalink / raw)
  To: buildroot; +Cc: Fiona Klute

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 <fiona.klute@gmx.de>
---
I've considered wrapping this into the existing check-package target,
but there are a few reasons not to:

1. Some people might not want to subject their external trees to
check-package at all, and would be annoyed by the warnings.

2. BR2_EXTERNAL support for utils/docker-run is still pending (see [1]).

3. The older shellcheck and flake8 versions in the Buildroot base
container image used by utils/docker-run produce some false positives
for my external trees, so I want to keep using the (newer) local
versions for checking those, but use the container for upstream
patches. That is more convenient with separate targets.

If anyone's wondering about the "Markdown misidentified as Python"
example: It looks like "__init__(self):" appearing in a code block
makes libmagic consider the file Python.

 Makefile | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b8678ea15b..cdc7ac0e4e 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,
@@ -1262,10 +1263,27 @@ 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" ; \
+	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` \
-- 
2.51.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-02-13 19:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29  9:24 [Buildroot] [PATCH 1/1] Makefile: add check-package-external target Fiona Klute via buildroot
2026-01-01 17:18 ` Thomas Petazzoni via buildroot
2026-01-01 18:04   ` Fiona Klute via buildroot
2026-01-04 10:13   ` Peter Korsgaard
2026-01-04 10:39     ` Thomas Petazzoni via buildroot
2026-01-04 13:34       ` Peter Korsgaard
2026-01-12 21:02         ` Fiona Klute via buildroot
2026-02-03 10:40 ` Arnout Vandecappelle via buildroot
2026-02-13 19:37 ` Thomas Perale via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox