Skip to contentSkip to conversation

post-build: reimplement using a for loop and make verbose

PATCH New Luca Ceresoli 3 participants 5 messages Apr 3, 2013 – Apr 8, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 post-build: reimplement using a for loop and make verbose

Make the post-build system similar to the rootfs overlay system. This allows to show each script filename before execution.

---
 Makefile |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Makefile +4 -5
index c95bb1e..69996bc 100644
@@ -509,11 +509,10 @@ endif
 			$${dir}/ $(TARGET_DIR); \
 	done
 
-ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
-	@$(call MESSAGE,"Executing post-build script\(s\)")
-	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
-		$(s) $(TARGET_DIR)$(sep))
-endif
+	@for scr in $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)); do \
+		$(call MESSAGE,"Executing post-build script $${scr}"); \
+		$${scr} $(TARGET_DIR); \
+	done
 
 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 post-build: reimplement using a for loop and make verbose

Dear Luca Ceresoli,

Quoted 4 lines · Luca Ceresoli

Make the post-build system similar to the rootfs overlay system. This allows to show each script filename before execution.

I don't have a strong opinion on whether this is useful or not, but if it gets applied, I'd like the same to be done for post-image scripts, in order to keep the consistency.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 post-build: reimplement using a for loop and make verbose

Quoted 10 lines · Thomas Petazzoni

Dear Luca Ceresoli,

Quoted 4 lines · Luca Ceresoli

Make the post-build system similar to the rootfs overlay system. This allows to show each script filename before execution.

I don't have a strong opinion on whether this is useful or not, but if it gets applied, I'd like the same to be done for post-image scripts, in order to keep the consistency.

To me it is useful each time multiple post-build scripts are used, because is
makes it easy to understand what's happening and which scripts you are running
(and which you are not running).
E.g., I have multiple products with a common base, plus some "optional" features.
Some features needs a specific post-build script. Each product implements a subset
of the features, but these subsets overlap between different products. When a build a product's rootfs it is useful to see if I am running all and only
the correct post-build scripts: the "common base" script, plus the scripts for the
wanted features.

Of course I agree this change should be done also in the post-image scripts. I will submit a patchset that does also this.

Luca

#3 lore raw

PATCH 1/1 post-build: reimplement using a for loop and make verbose

In reply to Luca Ceresoli

Alternatively, you could just move the MESSAGE into the loop instead of relying on shell loops. That would keep things more in make, if that's desired.

	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
		$(call MESSAGE,"Executing $(s)"); \
		$(s) $(TARGET_DIR)$(sep))

Danomi -

#4 lore raw

PATCH 1/1 post-build: reimplement using a for loop and make verbose

Quoted 7 lines · Danomi Manchego

Alternatively, you could just move the MESSAGE into the loop instead of relying on shell loops. That would keep things more in make, if that's desired.

	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
		$(call MESSAGE,"Executing $(s)"); \
		$(s) $(TARGET_DIR)$(sep))

It is actually cleanerand should also be more efficient(FWIW).

Sending a v2 patchset with this implementation.

Luca