Skip to contentSkip to conversation

legal info: split host and package output

PATCH Superseded Thomas De Schampheleire 2 participants 13 messages Oct 4, 2013 – Oct 7, 2013 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 legal info: split host and package output

---
 Makefile                     |  25 +++++++++++++++----------
 docs/manual/legal-notice.txt |   6 +++---
 package/pkg-generic.mk       |  12 ++++++------
 package/pkg-utils.mk         |  32 +++++++++++++++++++-------------
 4 files changed, 43 insertions(+), 32 deletions(-)
#1 lore raw

PATCH 1/1 legal info: fix saving of host package licenses

Due to a missing dollar sign, the licenses for host packages were not saved.

---
Note: Aaargh this dollar sign madness!

 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
package/pkg-generic.mk +1 -1
@@ -511,7 +511,7 @@ ifeq ($(call qstrip,$$($(2)_LICENSE_FILE
 	@$(call legal-license-nofiles,$$($(2)_RAWNAME))
 	@$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-	@$(foreach F,$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F))$$(sep))
+	@$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))
 endif
 ifeq ($$($(2)_REDISTRIBUTE),YES)
 # Copy the source tarball (just hardlink if possible)
#2 lore raw

PATCH 1/1 legal info: fix saving of host package licenses

Quoted 14 lines · Thomas De Schampheleire

Due to a missing dollar sign, the licenses for host packages were not saved.

---
Note: Aaargh this dollar sign madness!

 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

package/pkg-generic.mk ifeq ($(call qstrip,$$($(2)_LICENSE_FILE · line 517

Quoted 8 lines
package/pkg-generic.mk +1 -1
@@ -511,7 +511,7 @@ ifeq ($(call qstrip,$$($(2)_LICENSE_FILE
        @$(call legal-license-nofiles,$$($(2)_RAWNAME))
        @$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-       @$(foreach F,$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F))$$(sep))
+       @$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))
 endif
 ifeq ($$($(2)_REDISTRIBUTE),YES)
 # Copy the source tarball (just hardlink if possible)

Hold this one: it seems to break packages that define multiple license files, like libfuse. Looking into it...

#3 lore raw

PATCH 1/1 legal info: fix saving of host package licenses

Hi,

Quoted 12 lines · Thomas De Schampheleire
Quoted 10 lines · Thomas De Schampheleire

Due to a missing dollar sign, the licenses for host packages were not saved.

---
Note: Aaargh this dollar sign madness!

 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

package/pkg-generic.mk ifeq ($(call qstrip,$$($(2)_LICENSE_FILE · line 517

Quoted 12 lines
package/pkg-generic.mk +1 -1
@@ -511,7 +511,7 @@ ifeq ($(call qstrip,$$($(2)_LICENSE_FILE
        @$(call legal-license-nofiles,$$($(2)_RAWNAME))
        @$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-       @$(foreach F,$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F))$$(sep))
+       @$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))
 endif
 ifeq ($$($(2)_REDISTRIBUTE),YES)
 # Copy the source tarball (just hardlink if possible)

Hold this one: it seems to break packages that define multiple license files, like libfuse. Looking into it...

This is a tricky problem, and I don't know how to solve it. The foreach line does not work correctly with variables that are defined inside an evaluated macro, as our inner-generic-package is. Here is an example Makefile that shows the problem:

all:

VARA = foo bar

define inner
VARB = foo bar
VARC = $(1)
some-$(1):

        @echo $(1) != $(VARC)
        @echo $(1) = $$(VARC)
        @echo
        @echo $(foreach F,foo bar,echo $(F))
        @echo $(foreach F,$(VARA),echo $(F))
        @echo $(foreach F,$$(VARB),echo $(F))
        @echo $(foreach F,$$(VARC),echo $(F))

endef

outer = $(call inner,foo bar)
$(eval $(outer))

The first set of echoes shows that $(VARC) cannot be used like that, it is empty. Using double-dollar signs does work.
However, when passing this to foreach you get problems. The first two foreach'es show the expected output, while the second two show the problem.

Here is the output:

$ make -f ~/tmp/wrap some-foo
foo bar !=
foo bar = foo bar

echo foo echo bar
echo foo echo bar
echo foo bar
echo foo bar

As you can see, the fact that we pass $$(VARC) to foreach renders the foreach useless: it only iterates once instead of for each word. But we cannot pass simply $(VARC) as that is empty when foreach is evaluated.

Does anyone know how to solve this?

Thanks,
Thomas

#4 lore raw

PATCH 1/1 legal info: fix saving of host package licenses

Quoted 75 lines · Thomas De Schampheleire

Hi,

Quoted 12 lines · Thomas De Schampheleire
Quoted 10 lines · Thomas De Schampheleire

Due to a missing dollar sign, the licenses for host packages were not saved.

---
Note: Aaargh this dollar sign madness!

 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

package/pkg-generic.mk ifeq ($(call qstrip,$$($(2)_LICENSE_FILE · line 517

Quoted 12 lines
package/pkg-generic.mk +1 -1
@@ -511,7 +511,7 @@ ifeq ($(call qstrip,$$($(2)_LICENSE_FILE
        @$(call legal-license-nofiles,$$($(2)_RAWNAME))
        @$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-       @$(foreach F,$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F))$$(sep))
+       @$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))
 endif
 ifeq ($$($(2)_REDISTRIBUTE),YES)
 # Copy the source tarball (just hardlink if possible)

Hold this one: it seems to break packages that define multiple license files, like libfuse. Looking into it...

This is a tricky problem, and I don't know how to solve it. The foreach line does not work correctly with variables that are defined inside an evaluated macro, as our inner-generic-package is. Here is an example Makefile that shows the problem:

all:

VARA = foo bar

define inner
VARB = foo bar
VARC = $(1)
some-$(1):

        @echo $(1) != $(VARC)
        @echo $(1) = $$(VARC)
        @echo
        @echo $(foreach F,foo bar,echo $(F))
        @echo $(foreach F,$(VARA),echo $(F))
        @echo $(foreach F,$$(VARB),echo $(F))
        @echo $(foreach F,$$(VARC),echo $(F))

endef

outer = $(call inner,foo bar)
$(eval $(outer))

The first set of echoes shows that $(VARC) cannot be used like that, it is empty. Using double-dollar signs does work.
However, when passing this to foreach you get problems. The first two foreach'es show the expected output, while the second two show the problem.

Here is the output:

$ make -f ~/tmp/wrap some-foo
foo bar !=
foo bar = foo bar

echo foo echo bar
echo foo echo bar
echo foo bar
echo foo bar

Quoted 6 lines

As you can see, the fact that we pass $$(VARC) to foreach renders the foreach useless: it only iterates once instead of for each word. But we cannot pass simply $(VARC) as that is empty when foreach is evaluated.

Does anyone know how to solve this?

Note: I found a solution and submitted a second version of this series...

Best regards,
Thomas

#5 lore raw

PATCH 1/1 legal info: split manifest for host and target

In reply to Thomas De Schampheleire

---
Note: this is a resend without changes, now accumulated in a legal-info series

 Makefile                     |  8 +++++---
 docs/manual/legal-notice.txt |  6 +++---
 package/pkg-generic.mk       |  2 +-
 package/pkg-utils.mk         |  2 +-
 4 files changed, 10 insertions(+), 8 deletions(-)
Makefile +5 -3
@@ -110,7 +110,8 @@ HOST_DIR:=$(BASE_DIR)/host
 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
-LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
+LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
+LEGAL_MANIFEST_CSV_HOST=$(LEGAL_INFO_DIR)/host-manifest.csv
 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
@@ -588,8 +589,9 @@ legal-info-clean:
 legal-info-prepare: $(LEGAL_INFO_DIR)
 	@$(call MESSAGE,"Collecting legal info")
 	@$(call legal-license-file,buildroot,COPYING,COPYING)
-	@$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
-	@$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
+	@$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,TARGET)
+	@$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,HOST)
+	@$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,HOST)
 	@$(call legal-warning,the Buildroot source code has not been saved)
 	@$(call legal-warning,the toolchain has not been saved)
 	@cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
docs/manual/legal-notice.txt +3 -3
@@ -44,8 +44,8 @@ There you will find:
   saved);
   patches applied to some packages by Buildroot are distributed with the
   Buildroot sources and are not duplicated in the +sources/+ subdirectory.
-* A manifest file listing the configured packages, their version, license and
-  related information.
+* A manifest file (one for host and one for target packages) listing the
+  configured packages, their version, license and related information.
   Some of this information might not be defined in Buildroot; such items are
   marked as "unknown".
 * A +licenses/+ subdirectory, which contains the license text of packages.
@@ -72,7 +72,7 @@ License abbreviations
 ---------------------
 
 Here is a list of the licenses that are most widely used by packages in
-Buildroot, with the name used in the manifest file:
+Buildroot, with the name used in the manifest files:
 
 * `GPLv2`:
   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html[
package/pkg-generic.mk +1 -1
@@ -519,7 +519,7 @@ ifeq ($$($(2)_REDISTRIBUTE),YES)
 	   cp $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR)
 endif
 endif
-	@$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_MANIFEST_TARBALL))
+	@$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_MANIFEST_TARBALL),$(call UPPERCASE,$(5)))
 endif # ifneq ($(call qstrip,$$($(2)_SOURCE)),)
 	$(foreach hook,$($(2)_POST_LEGAL_INFO_HOOKS),$(call $(hook))$(sep))
 
package/pkg-utils.mk +1 -1
@@ -96,7 +96,7 @@ legal-warning-pkg=echo "WARNING: $(1): $
 define legal-warning-pkg-savednothing # pkg, {local|override}
 	$(call legal-warning-pkg,$(1),sources and license files not saved ($(2) packages not handled))
 endef
-legal-manifest=echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV)
+legal-manifest=echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV_$(6))
 define legal-license-header
 	echo -e "$(LEGAL_INFO_SEPARATOR)\n\t$(1):" \
 		"$(2)\n$(LEGAL_INFO_SEPARATOR)\n\n" >>$(LEGAL_LICENSES_TXT)
#6 lore raw

PATCH 1/1 legal-info: split license texts for host and target

In reply to Thomas De Schampheleire
---
 Makefile               |   8 +++++---
 package/pkg-generic.mk |   2 +-
 package/pkg-utils.mk   |  16 ++++++++--------
 3 files changed, 14 insertions(+), 12 deletions(-)
Makefile +5 -3
@@ -109,10 +109,12 @@ HOST_DIR:=$(BASE_DIR)/host
 
 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
-LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
+LICENSE_FILES_DIR_TARGET=$(LEGAL_INFO_DIR)/licenses
+LICENSE_FILES_DIR_HOST=$(LEGAL_INFO_DIR)/host-licenses
 LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
 LEGAL_MANIFEST_CSV_HOST=$(LEGAL_INFO_DIR)/host-manifest.csv
-LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_LICENSES_TXT_TARGET=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_LICENSES_TXT_HOST=$(LEGAL_INFO_DIR)/host-licenses.txt
 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
 
@@ -588,7 +590,7 @@ legal-info-clean:
 
 legal-info-prepare: $(LEGAL_INFO_DIR)
 	@$(call MESSAGE,"Collecting legal info")
-	@$(call legal-license-file,buildroot,COPYING,COPYING)
+	@$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
 	@$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,TARGET)
 	@$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,HOST)
 	@$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,HOST)
package/pkg-generic.mk +1 -1
@@ -508,7 +508,7 @@ else
 # Other packages
 # Save license files if defined
 ifeq ($(call qstrip,$$($(2)_LICENSE_FILES)),)
-	@$(call legal-license-nofiles,$$($(2)_RAWNAME))
+	@$(call legal-license-nofiles,$$($(2)_RAWNAME),$(call UPPERCASE,$(5)))
 	@$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
 	@$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))
package/pkg-utils.mk +8 -8
@@ -99,15 +99,15 @@ endef
 legal-manifest=echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV_$(6))
 define legal-license-header
 	echo -e "$(LEGAL_INFO_SEPARATOR)\n\t$(1):" \
-		"$(2)\n$(LEGAL_INFO_SEPARATOR)\n\n" >>$(LEGAL_LICENSES_TXT)
+		"$(2)\n$(LEGAL_INFO_SEPARATOR)\n\n" >>$(LEGAL_LICENSES_TXT_$(3))
 endef
 define legal-license-nofiles
-	$(call legal-license-header,$(1),unknown license file(s))
+	$(call legal-license-header,$(1),unknown license file(s),$(2))
 endef
-define legal-license-file # pkg, filename, file-fullpath
-	$(call legal-license-header,$(1),$(2) file) && \
-	cat $(3) >>$(LEGAL_LICENSES_TXT) && \
-	echo >>$(LEGAL_LICENSES_TXT) && \
-	mkdir -p $(LICENSE_FILES_DIR)/$(1)/$(dir $(2)) && \
-	cp $(3) $(LICENSE_FILES_DIR)/$(1)/$(2)
+define legal-license-file # pkg, filename, file-fullpath, type
+	$(call legal-license-header,$(1),$(2) file,$(4)) && \
+	cat $(3) >>$(LEGAL_LICENSES_TXT_$(4)) && \
+	echo >>$(LEGAL_LICENSES_TXT_$(4)) && \
+	mkdir -p $(LICENSE_FILES_DIR_$(4))/$(1)/$(dir $(2)) && \
+	cp $(3) $(LICENSE_FILES_DIR_$(4))/$(1)/$(2)
 endef
#7 lore raw

PATCH 1/1 legal-info: split license texts for host and target

Quoted 39 lines · Thomas De Schampheleire
---
 Makefile               |   8 +++++---
 package/pkg-generic.mk |   2 +-
 package/pkg-utils.mk   |  16 ++++++++--------
 3 files changed, 14 insertions(+), 12 deletions(-)
Makefile +5 -3
@@ -109,10 +109,12 @@ HOST_DIR:=$(BASE_DIR)/host
 
 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
-LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
+LICENSE_FILES_DIR_TARGET=$(LEGAL_INFO_DIR)/licenses
+LICENSE_FILES_DIR_HOST=$(LEGAL_INFO_DIR)/host-licenses
 LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
 LEGAL_MANIFEST_CSV_HOST=$(LEGAL_INFO_DIR)/host-manifest.csv
-LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_LICENSES_TXT_TARGET=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_LICENSES_TXT_HOST=$(LEGAL_INFO_DIR)/host-licenses.txt
 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
 
@@ -588,7 +590,7 @@ legal-info-clean:
 
 legal-info-prepare: $(LEGAL_INFO_DIR)
        @$(call MESSAGE,"Collecting legal info")
-       @$(call legal-license-file,buildroot,COPYING,COPYING)
+       @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
        @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,TARGET)
        @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,HOST)
        @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,HOST)

package/pkg-generic.mk else · line 514

Quoted 8 lines
package/pkg-generic.mk +1 -1
@@ -508,7 +508,7 @@ else
 # Other packages
 # Save license files if defined
 ifeq ($(call qstrip,$$($(2)_LICENSE_FILES)),)
-       @$(call legal-license-nofiles,$$($(2)_RAWNAME))
+       @$(call legal-license-nofiles,$$($(2)_RAWNAME),$(call UPPERCASE,$(5)))
        @$(call legal-warning-pkg,$$($(2)_RAWNAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
        @$(foreach F,$$($(2)_LICENSE_FILES),$(call legal-license-file,$$($(2)_RAWNAME),$(F),$$($(2)_DIR)/$(F),$(call UPPERCASE,$(5)))$$(sep))

This $(call UPPERCASE,$(5)) extra parameter accidentally ended up in the first patch of this series.
I will fix that, when I investigated the problem with that patch (double dollar sign). (or if someone else knows what the problem is, please let me know).

Best regards,
Thomas

#9 lore raw

PATCH 1/1 legal info: split sources for host and target

In reply to Thomas De Schampheleire

---
This patch concludes the splitting of legal info for host and target.

 Makefile               |  9 +++++----
 package/pkg-generic.mk |  6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)
Makefile +5 -4
@@ -108,7 +108,8 @@ TARGET_DIR:=$(BASE_DIR)/target
 HOST_DIR:=$(BASE_DIR)/host
 
 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
-REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
+REDIST_SOURCES_DIR_TARGET=$(LEGAL_INFO_DIR)/sources
+REDIST_SOURCES_DIR_HOST=$(LEGAL_INFO_DIR)/host-sources
 LICENSE_FILES_DIR_TARGET=$(LEGAL_INFO_DIR)/licenses
 LICENSE_FILES_DIR_HOST=$(LEGAL_INFO_DIR)/host-licenses
 LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
@@ -419,7 +420,7 @@ world: toolchain $(TARGETS_ALL)
 # dependencies anywhere else
 #
 ################################################################################
-$(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
+$(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
 	@mkdir -p $@
 
 # We make a symlink lib32->lib or lib64->lib as appropriate
@@ -598,8 +599,8 @@ legal-info-prepare: $(LEGAL_INFO_DIR)
 	@$(call legal-warning,the toolchain has not been saved)
 	@cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
 
-legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
-		$(TARGETS_LEGAL_INFO)
+legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
+		$(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
 	@cat support/legal-info/README.header >>$(LEGAL_REPORT)
 	@if [ -r $(LEGAL_WARNINGS) ]; then \
 		cat support/legal-info/README.warnings-header \
package/pkg-generic.mk +3 -3
@@ -488,7 +488,7 @@ ifeq ($$($(2)_REDISTRIBUTE),YES)
 ifneq ($$($(2)_SITE_METHOD),local)
 ifneq ($$($(2)_SITE_METHOD),override)
 # Packages that have a tarball need it downloaded and extracted beforehand
-$(1)-legal-info: $(1)-extract $(REDIST_SOURCES_DIR)
+$(1)-legal-info: $(1)-extract $(REDIST_SOURCES_DIR_$(call UPPERCASE,$(5)))
 $(2)_MANIFEST_TARBALL = $$($(2)_SOURCE)
 endif
 endif
@@ -515,8 +515,8 @@ else
 endif
 ifeq ($$($(2)_REDISTRIBUTE),YES)
 # Copy the source tarball (just hardlink if possible)
-	@cp -l $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR) 2>/dev/null || \
-	   cp $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR)
+	@cp -l $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR_$(call UPPERCASE,$(5))) 2>/dev/null || \
+	   cp $(DL_DIR)/$$($(2)_SOURCE) $(REDIST_SOURCES_DIR_$(call UPPERCASE,$(5)))
 endif
 endif
 	@$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_MANIFEST_TARBALL),$(call UPPERCASE,$(5)))
#11 lore raw

PATCH 1/1 legal info: cleanup utility functions

In reply to Thomas De Schampheleire

The legal-info utility functions where defined using two ways util-foo = command-foo
and
define util-bar # parameter description
command-bar
endef

This commit changes these functions to use the second form for clarity and additionally adds parameter descriptions on all functions.

---
 package/pkg-utils.mk |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
package/pkg-utils.mk +11 -5
@@ -91,17 +91,23 @@ endef
 # legal-info helper functions
 #
 LEGAL_INFO_SEPARATOR="::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
-legal-warning=echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)
-legal-warning-pkg=echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
+define legal-warning # text
+	echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)
+endef
+define legal-warning-pkg # pkg, text
+	echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
+endef
 define legal-warning-pkg-savednothing # pkg, {local|override}
 	$(call legal-warning-pkg,$(1),sources and license files not saved ($(2) packages not handled))
 endef
-legal-manifest=echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV_$(6))
-define legal-license-header
+define legal-manifest # pkg, version, license, license-files, source, type
+	echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV_$(6))
+endef
+define legal-license-header # pkg, license-file, type
 	echo -e "$(LEGAL_INFO_SEPARATOR)\n\t$(1):" \
 		"$(2)\n$(LEGAL_INFO_SEPARATOR)\n\n" >>$(LEGAL_LICENSES_TXT_$(3))
 endef
-define legal-license-nofiles
+define legal-license-nofiles # pkg, type
 	$(call legal-license-header,$(1),unknown license file(s),$(2))
 endef
 define legal-license-file # pkg, filename, file-fullpath, type
#12 lore raw

PATCH 1/1 legal info: cleanup utility functions

Hi Thomas,

Quoted 9 lines · Thomas De Schampheleire

The legal-info utility functions where defined using two ways util-foo = command-foo
and
define util-bar # parameter description
command-bar
endef

This commit changes these functions to use the second form for clarity and additionally adds parameter descriptions on all functions.

Yeah, never liked what I wrote here...

But, in order to make the code een more readable, I suggest you to add an empty line between definitions, just like the "define KCONFIG_*" above in the same file.

Apart from this, and from a little note below,

Quoted 18 lines
---
  package/pkg-utils.mk |  16 +++++++++++-----
  1 files changed, 11 insertions(+), 5 deletions(-)
package/pkg-utils.mk +2 -2
@@ -91,17 +91,23 @@ endef
  # legal-info helper functions
  #
  LEGAL_INFO_SEPARATOR="::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
-legal-warning=echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)
-legal-warning-pkg=echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
+define legal-warning # text
+	echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)

package/pkg-utils.mk endef · line 103

Quoted 10 lines
package/pkg-utils.mk +5 -2
+endef
+define legal-warning-pkg # pkg, text
+	echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
+endef
  define legal-warning-pkg-savednothing # pkg, {local|override}
  	$(call legal-warning-pkg,$(1),sources and license files not saved ($(2) packages not handled))
  endef
-legal-manifest=echo '"$(1)","$(2)","$(3)","$(4)","$(5)"' >>$(LEGAL_MANIFEST_CSV_$(6))
-define legal-license-header
+define legal-manifest # pkg, version, license, license-files, source, type

"type" is too generic to convey a meaning here. How about "{host|target}"?

Signature · 1 line
Luca