[Buildroot] [PATCH 15/16 v2] core/show-info: report package build steps and stamp files

Yann E. MORIN yann.morin.1998 at free.fr
Sat Nov 13 13:28:26 UTC 2021


People (and their scripts!) whi want to report on the progress of the
build, will need to know what steps a package follows in what order.

This is handled internally by Buildroot itself already, by use of stamp
files.

However, the names of those stamp files are purely an implementation
detail (even if they are very unlikely to ever change).

Expose the build steps in a list, which is guaranteed to be ordered, ad
for each step, its name and stamp file. The output (once filtered
through jq, elided for bevity) will look like:

    [...]
    "install_target": true,
    "install_staging": false,
    "install_images": false,
    "build_steps": [
      {
        "step": "download",
        "stamp_file": ".stamp_downloaded"
      },
      {
        "step": "extract",
        "stamp_file": ".stamp_extracted"
      },
      {
        "step": "patch",
        "stamp_file": ".stamp_patched"
      },
      {
        "step": "configure",
        "stamp_file": ".stamp_configured"
      },
      {
        "step": "build",
        "stamp_file": ".stamp_built"
      },
      {
        "step": "install_target",
        "stamp_file": ".stamp_target_installed"
      }
    ],
    [...]

(Note: the first three fields already existed before this patch.)

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Cc: Vadim Kochan <vadim4j at gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Cc: Arnout Vandecappelle <arnout at mind.be>
Cc: eeppeliteloop at gmail.com
---
 package/pkg-utils.mk | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 37a4d244d7..d7cd8f9775 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -122,6 +122,29 @@ define _json-info-pkg
 		"install_staging": $(call yesno-to-bool,$($(1)_INSTALL_STAGING))$(comma) \
 		"install_images": $(call yesno-to-bool,$($(1)_INSTALL_IMAGES))$(comma) \
 	)
+	"build_steps": [
+		$(if $($(1)_OVERRIDE_SRCDIR), \
+			{ "step": "rsync"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_RSYNC))) }$(comma) \
+			, \
+			{ "step": "download"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_SOURCE))) }$(comma) \
+			{ "step": "extract"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_EXTRACT))) }$(comma) \
+			{ "step": "patch"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_PATCH))) }$(comma) \
+		)
+		{ "step": "configure", "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_CONFIGURE))) },
+		{ "step": "build", "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_BUILD))) },
+		$(if $(filter YES,$($(1)_INSTALL_STAGING)), \
+			{ "step": "install_staging"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_INSTALL_STAGING))) }$(comma) \
+		)
+		$(if $(filter YES,$($(1)_INSTALL_TARGET)), \
+			{ "step": "install_target"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_INSTALL_TARGET))) }$(comma) \
+		)
+		$(if $(filter YES,$($(1)_INSTALL_IMAGES)), \
+			{ "step": "install_images"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_INSTALL_IMAGES))) }$(comma) \
+		)
+		$(if $(filter host,$($(1)_TYPE)), \
+			{ "step": "install"$(comma) "stamp_file": $(call mk-json-str,$(notdir $($(1)_TARGET_INSTALL_HOST))) } \
+		)
+	],
 	"dependencies": [
 		$(call make-comma-list, \
 			$(foreach dep,$(sort $($(1)_FINAL_ALL_DEPENDENCIES)), \
-- 
2.25.1



More information about the buildroot mailing list