From 723b321bb03d7526f7583d64ac1d34eca429920d Mon Sep 17 00:00:00 2001 From: Thomas Perale Date: Fri, 29 May 2026 19:51:55 +0200 Subject: [PATCH] Makefile: add 'show-info-all' The maintenance and testing workflow sometimes requires to output a list of every existing package on Buildroot: - Generating an SBOM of the whole Buildroot tree, e.g. `for security.buildroot.org - List every source for every package, e.g. for sources.buildroot.net The previous solution relied on `make allyesconfig` but always ran into conflicts that needed manual resolution. Also some packages would not be present because they are architecture dependent. To avoid having to manually modify the 'show-info' command this commit adds the 'show-info-all' command. It accesses the PACKAGES_ALL variable with all the packages present in Buildroot independently of the architecture or any config entries. It forces the `BR2_HAVE_DOT_CONFIG` variable to be set to force the reading of the package mk files. It is also added to noconfig_targets, to avoid the .config influencing the output of show-info-all. Note that this is not yet a complete solution - it doesn't take into account the multiple versions that are possible for some packages like GCC. Also for e.g. linux or uboot the version is empty and the URL is invalid. Signed-off-by: Thomas Perale [Arnout: refactor with existing show-info] Signed-off-by: Arnout Vandecappelle --- Makefile | 32 ++++++++++++++++++++++++-------- docs/manual/common-usage.adoc | 12 ++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index cb52a1d668..14ea241dc4 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconf defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \ print-version olddefconfig distclean manual manual-% check-package \ - check-package-external + check-package-external show-info-all # Some global targets do not trigger a build, but are used to collect # metadata, or do various checks. When such targets are triggered, @@ -142,7 +142,7 @@ nobuild_targets := source %-source \ clean distclean help show-targets graph-depends \ %-graph-depends %-show-depends %-show-version \ graph-build graph-size list-defconfigs \ - savedefconfig update-defconfig printvars show-vars + savedefconfig update-defconfig printvars show-vars show-info-all ifeq ($(MAKECMDGOALS),) BR_BUILDING = y else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),) @@ -236,6 +236,13 @@ BR2_CONFIG = $(CONFIG_DIR)/.config ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) -include $(BR2_CONFIG) endif +# show-info-all needs to access the PACKAGES_ALL variable. This variable +# contains a reference to every package present in Buildroot. +# Since the 'show-info-all' command might be used without actually having a +# dotconfig this condition is forced to be set true. +ifeq ($(MAKECMDGOALS),show-info-all) +BR2_HAVE_DOT_CONFIG = y +endif ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),) # Disable top-level parallel build if per-package directories is not @@ -934,15 +941,22 @@ check-dependencies: $(TOPDIR)/support/scripts/graph-depends -C .PHONY: show-info -show-info: +show-info: show-info-inner +show-info: SHOW_INFO_PACKAGES = \ + $(foreach i,$(PACKAGES) $(TARGETS_ROOTFS), \ + $(i) $($(call UPPERCASE,$(i))_FINAL_RECURSIVE_DEPENDENCIES) \ + ) + +.PHONY: show-info-all +show-info-all: show-info-inner +show-info-all: SHOW_INFO_PACKAGES = $(PACKAGES_ALL) + +.PHONY: show-info-inner +show-info-inner: @: $(info $(call clean-json, \ { $(foreach p, \ - $(sort $(foreach i,$(PACKAGES) $(TARGETS_ROOTFS), \ - $(i) \ - $($(call UPPERCASE,$(i))_FINAL_RECURSIVE_DEPENDENCIES) \ - ) \ - ), \ + $(sort $(SHOW_INFO_PACKAGES)), \ $(call json-info,$(call UPPERCASE,$(p)))$(comma) \ ) } \ ) \ @@ -1213,6 +1227,8 @@ help: @echo ' external-deps - list external packages used' @echo ' legal-info - generate info about license compliance' @echo ' show-info - generate info about packages, as a JSON blurb' + @echo ' show-info-all - generate info about all packages in Buildroot,' + @echo ' regardless of configuration or target architecture' @echo ' pkg-stats - generate info about packages as JSON and HTML' @echo ' printvars - dump internal variables selected with VARS=...' @echo ' show-vars - dump all internal variables as a JSON blurb; use VARS=...' diff --git a/docs/manual/common-usage.adoc b/docs/manual/common-usage.adoc index 7437a7c3c0..631c2f7788 100644 --- a/docs/manual/common-usage.adoc +++ b/docs/manual/common-usage.adoc @@ -170,6 +170,18 @@ by using the +show-info+ make target: make show-info ---- +Buildroot can also produce information in the +show-info+ format about all +packages regardless of the configuration or architecture by using ++show-info-all+. +This is used for maintenance tasks that require information about every +package in the tree, such as generating a full-tree SBOM for +https://security.buildroot.org[]. +It does not require a +.config+ file: + +---- +make show-info-all +---- + Buildroot can also produce details about packages as HTML and JSON output using the +pkg-stats+ make target. Amongst other things, these details include whether known CVEs (security vulnerabilities) affect