Makefile: assemble package file lists before calling post-build scripts
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Wed, 18 Mar 2020 15:58:13 +0000 (16:58 +0100)
committerYann E. MORIN <yann.morin.1998@free.fr>
Fri, 20 Mar 2020 21:17:28 +0000 (22:17 +0100)
Post-build scripts may want to do something based on the list of files
installed by a package. However, since commit
0e2be4db8ab01d479177a3a187c22525752195ae the final packages-file-lists.txt
file is only created _after_ the post-build scripts.

Move the assembly of the file lists upwards, before the post-build scripts.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Makefile

index 156ceb9aaea186ad398480c72ff281d0dbbb12b2..ae29b042ec5311f6ec8c6993254877e8bf5a35e2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -806,12 +806,6 @@ endif # merged /usr
                $(call MESSAGE,"Copying overlay $(d)"); \
                $(call SYSTEM_RSYNC,$(d),$(TARGET_DIR))$(sep))
 
-       @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
-               $(call MESSAGE,"Executing post-build script $(s)"); \
-               $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
-
-       touch $(TARGET_DIR)/usr
-
        $(if $(TARGET_DIR_FILES_LISTS), \
                cat $(TARGET_DIR_FILES_LISTS)) > $(BUILD_DIR)/packages-file-list.txt
        $(if $(HOST_DIR_FILES_LISTS), \
@@ -819,6 +813,12 @@ endif # merged /usr
        $(if $(STAGING_DIR_FILES_LISTS), \
                cat $(STAGING_DIR_FILES_LISTS)) > $(BUILD_DIR)/packages-file-list-staging.txt
 
+       @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
+               $(call MESSAGE,"Executing post-build script $(s)"); \
+               $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+
+       touch $(TARGET_DIR)/usr
+
 .PHONY: target-post-image
 target-post-image: $(TARGETS_ROOTFS) target-finalize staging-finalize
        @rm -f $(ROOTFS_COMMON_TAR)