diff options
authorThomas De Schampheleire <>2013-11-12 08:47:56 (GMT)
committer Peter Korsgaard <>2013-11-12 22:20:37 (GMT)
commit003d38da3a716b0a19e980fb69a6cd55b353f4f3 (patch)
parent7a7ec2dd3758a9832471db2ccf0f8bf7b08ad6dc (diff)
legal info: fix saving of host package licenses
Due to some tricky make behavior, the license texts of host packages that did not provide an explicit HOST_FOO_LICENSE_FILES definition was not saved. The problem is that it is not straightforward to use a variable defined/updated inside an evaluated block as input to a foreach statement. If you try to use $(FOO) then only the original value of FOO is used for foreach, any update inside the block is ignored. However, if you use $$(FOO), the entire contents of FOO (typically a list of items) is passed as one item to foreach, thus causing just one iteration instead of several. >From Arnout Vandecapelle's explanation: Any variable referenced with a single $ inside the inner-generic-package macro is expanded before the resulting contents are eval'ed. Therefore, it is not possible to refer to variables defined by the inner-generic-package macro from within a single-$ function call. To fix the problem, one should defer the evaluation of the entire block using double dollar signs. Additionally, a few empty lines have been added to the legal-info-foo block for clarity. Signed-off-by: Thomas De Schampheleire <> Acked-by: Luca Ceresoli <> Tested-by: Luca Ceresoli <> Signed-off-by: Peter Korsgaard <>
1 files changed, 13 insertions, 4 deletions
diff --git a/package/ b/package/
index 75fda02..5111f31 100644
--- a/package/
+++ b/package/
@@ -502,26 +502,35 @@ $(2)_MANIFEST_TARBALL ?= not saved
# Packages without a source are assumed to be part of Buildroot, skip them.
ifneq ($(call qstrip,$$($(2)_SOURCE)),)
ifeq ($$($(2)_SITE_METHOD),local)
# Packages without a tarball: don't save and warn
@$(call legal-warning-pkg-savednothing,$$($(2)_RAWNAME),local)
else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
@$(call legal-warning-pkg-savednothing,$$($(2)_RAWNAME),override)
# Other packages
# Save license files if defined
ifeq ($(call qstrip,$$($(2)_LICENSE_FILES)),)
@$(call legal-license-nofiles,$$($(2)_RAWNAME))
@$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
- @$(foreach F,$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F))$$(sep))
+# Double dollar signs are really needed here, to catch host packages
+# without explicit HOST_FOO_LICENSE_FILES assignment, also in case they
+# have multiple license files.
+ @$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$(F),$$($(2)_DIR)/$$(F))$$(sep))
+endif # license files
ifeq ($$($(2)_REDISTRIBUTE),YES)
# Copy the source tarball (just hardlink if possible)
@cp -l $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR) 2>/dev/null || \
+endif # redistribute
+endif # other packages
@$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_MANIFEST_TARBALL))
endif # ifneq ($(call qstrip,$$($(2)_SOURCE)),)
$(foreach hook,$($(2)_POST_LEGAL_INFO_HOOKS),$(call $(hook))$(sep))