diff mbox series

[1/1] Makefile: move 'ppd-fixup-paths' to 'host-finalize'

Message ID 20240828124440.3882-1-tianyuanhao3@163.com
State Not Applicable
Headers show
Series [1/1] Makefile: move 'ppd-fixup-paths' to 'host-finalize' | expand

Commit Message

TIAN Yuanhao Aug. 28, 2024, 12:44 p.m. UTC
When using 'per-package', some python shebang in the host directory
will point to the per-package directory. However, the python modules
that are runtime dependencies will not be rsynced to the corresponding
per-package directory, which may cause the python script to fail to
find the python module.

For example, when enabling BR2_PER_PACKAGE_DIRECTORIES and
BR2_PACKAGE_HOST_BMAP_TOOLS, the following error will occur:

  ModuleNotFoundError: No module named 'six'

output/host/bin/bmaptool detects the presence of host-python-six in
output/per-package/host-bmap-tools/host. However, host-python-six is
not a required compile-time dependency for host-bmap-tools. Therefore,
it will not be rsynced to output/per-package/host-bmap-tools/host, but
only to output/host. This is the reason for the error.

Move the 'ppd-fixup-paths' to 'host-finalize' to allow the host python
script to search for python modules in output/host.

Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
Cc: Brandon Maier <Brandon.Maier@collins.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yann E. MORIN Sept. 7, 2024, 7:32 p.m. UTC | #1
Yuanhao, All,

On 2024-08-28 05:44 -0700, TIAN Yuanhao spake thusly:
> When using 'per-package', some python shebang in the host directory
> will point to the per-package directory. However, the python modules
> that are runtime dependencies will not be rsynced to the corresponding
> per-package directory, which may cause the python script to fail to
> find the python module.
> 
> For example, when enabling BR2_PER_PACKAGE_DIRECTORIES and
> BR2_PACKAGE_HOST_BMAP_TOOLS, the following error will occur:
> 
>   ModuleNotFoundError: No module named 'six'
> 
> output/host/bin/bmaptool detects the presence of host-python-six in
> output/per-package/host-bmap-tools/host. However, host-python-six is
> not a required compile-time dependency for host-bmap-tools. Therefore,
> it will not be rsynced to output/per-package/host-bmap-tools/host, but
> only to output/host. This is the reason for the error.
> 
> Move the 'ppd-fixup-paths' to 'host-finalize' to allow the host python
> script to search for python modules in output/host.

Thankyou for this patch.

As you already noticed [1], there was a more generic patch pending [1],
so I've marked yours as "Not applicable" in patchwork.

Thank you for th effedback on my previous patch! :-)

Regards,
Yann E. MORIN.

> Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
> Cc: Brandon Maier <Brandon.Maier@collins.com>
> Cc: James Hilliard <james.hilliard1@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 55aeafde23..f1fc3a4a52 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -604,7 +604,6 @@ prepare-sdk: world
>  	PARALLEL_JOBS=$(PARALLEL_JOBS) \
>  		PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) \
>  		$(TOPDIR)/support/scripts/fix-rpath staging
> -	$(call ppd-fixup-paths,$(BASE_DIR))
>  	$(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh
>  	mkdir -p $(HOST_DIR)/share/buildroot
>  	echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
> @@ -722,6 +721,7 @@ STAGING_DIR_FILES_LISTS = $(sort $(wildcard $(BUILD_DIR)/*/.files-list-staging.t
>  host-finalize: $(PACKAGES) $(HOST_DIR) $(HOST_DIR_SYMLINK)
>  	@$(call MESSAGE,"Finalizing host directory")
>  	$(call per-package-rsync,$(sort $(PACKAGES)),host,$(HOST_DIR),copy)
> +	$(call ppd-fixup-paths,$(BASE_DIR))
>  
>  .PHONY: staging-finalize
>  staging-finalize: $(STAGING_DIR_SYMLINK)
> -- 
> 2.45.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 55aeafde23..f1fc3a4a52 100644
--- a/Makefile
+++ b/Makefile
@@ -604,7 +604,6 @@  prepare-sdk: world
 	PARALLEL_JOBS=$(PARALLEL_JOBS) \
 		PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) \
 		$(TOPDIR)/support/scripts/fix-rpath staging
-	$(call ppd-fixup-paths,$(BASE_DIR))
 	$(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh
 	mkdir -p $(HOST_DIR)/share/buildroot
 	echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
@@ -722,6 +721,7 @@  STAGING_DIR_FILES_LISTS = $(sort $(wildcard $(BUILD_DIR)/*/.files-list-staging.t
 host-finalize: $(PACKAGES) $(HOST_DIR) $(HOST_DIR_SYMLINK)
 	@$(call MESSAGE,"Finalizing host directory")
 	$(call per-package-rsync,$(sort $(PACKAGES)),host,$(HOST_DIR),copy)
+	$(call ppd-fixup-paths,$(BASE_DIR))
 
 .PHONY: staging-finalize
 staging-finalize: $(STAGING_DIR_SYMLINK)