summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-09-16 12:11:12 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-09-16 16:27:04 +0200
commit8c60b9f2cb74dc5fd7eeac6761d1681a8610e01d (patch)
tree9d8c2ac34ed1863b27ae9bbb9d344c2520f42be0
parentc106986f73f8e1ae022924bc5b6a79c3b2e7eb41 (diff)
downloadptxdist-8c60b9f2cb74dc5fd7eeac6761d1681a8610e01d.tar.gz
ptxdist-8c60b9f2cb74dc5fd7eeac6761d1681a8610e01d.tar.xz
ptxd_make_world_get: handle packages that share the same source better
To allow multiple souce files for on packge, $(<source-file>) contains the base variable to find the corresponding URL and md5sum. So in general this needs to be used to call world/get and world/check_src. However, when packages share the same source file then $(<source-file>) points to just one of them. So others call world/get with the environment for a different package. This can have unexpected side effects. For example for kernel packages created with the template that have the same version as the generic kernel package: The special handling for the KERNEL_MAKEVARS -> KERNEL_MAKE_OPT transition breaks the build of the new kernel package. To avoid this, derive the environment from the current package if the source file is <PKG>_SOURCE. In this case all necessary variables are available. In all other cases stick to the current mechanism. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/post/ptxd_make_world_get.make13
1 files changed, 11 insertions, 2 deletions
diff --git a/rules/post/ptxd_make_world_get.make b/rules/post/ptxd_make_world_get.make
index 7ce627ba5..a2026c994 100644
--- a/rules/post/ptxd_make_world_get.make
+++ b/rules/post/ptxd_make_world_get.make
@@ -28,12 +28,21 @@ endif
$(STATEDIR)/%.stamp:
@touch $@
+#
+# Use the current package for the primary source file.
+# This avoids strange effects when multiple packages share a source file.
+# For anything else $($(src)) is special and must be used.
+#
+define _ptx_source_to_pkg
+$(if $(filter $($(PTX_MAP_TO_PACKAGE_$(1))_SOURCE),$(2)),$(PTX_MAP_TO_PACKAGE_$(1)),$($(2)))
+endef
+
$(STATEDIR)/%.get:
@$(call targetinfo)
@$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_SOURCES), \
- $(call world/get, $($(src)))$(ptx/nl))
+ $(call world/get, $(call _ptx_source_to_pkg,$(*),$(src)))$(ptx/nl))
@$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_SOURCES), \
- $(call world/check_src, $($(src)))$(ptx/nl))
+ $(call world/check_src, $(call _ptx_source_to_pkg,$(*),$(src)))$(ptx/nl))
@$(call touch)
world/get = \