core/legal-info: also save patches

Currently, the legal-info infra only saves the source archive of a
package. However, that's not enough as we may apply some patches on
packages sources.

We do suggest users to also redistribute the Buildroot sources as part
of their compliance distribution, so the patches bundled in Buildroot
would indeed be included in the compliance distribution.

However, that's still not enough, since we may download some patches, or
the user may use a global patch directory. Patches in there might not
end up in the compliance distribution, and there are risks of
non-conformity.

So, always include patches alongside the source archive.

To ensure reproducibility, we also generate a series file, so patches
can be re-applied in the correct order.

We get the list of patches to include from the list of patches that were
applied by the package infrastructure (via the apply-patches support
script). So, we need to get packages properly extracted and patched
before we can save their legal-info, not just in the case they define
_LICENSE_FILES.

Update the legal-info header accordingly.

Note: this means that, when a package is not patched and defines no
LICENSE_FILES, we will extract and patch it for nothing. There is no
easy way to know whether we have to patch a package or not. We can only
either duplicate the logic to detect patches (bad) or rely on the infra
actually patching the package. Also, a vast majority of packages are
either patched, or define _LICENSE_FILES, so it is best and easiest to
always extract and patch them prior to legal-info.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Yann E. MORIN 2016-05-07 18:14:33 +02:00 committed by Thomas Petazzoni
parent 1924159814
commit 1273636fc6
2 changed files with 15 additions and 9 deletions

View File

@ -749,12 +749,10 @@ $(2)_MANIFEST_LICENSE_FILES = $$($(2)_LICENSE_FILES)
endif endif
$(2)_MANIFEST_LICENSE_FILES ?= not saved $(2)_MANIFEST_LICENSE_FILES ?= not saved
# If the package declares _LICENSE_FILES, we need to extract it, # We need to extract and patch a package to be able to retrieve its
# for overriden, local or normal remote packages alike, whether # license files (if any) and the list of patches applied to it (if
# we want to redistribute it or not. # any).
ifneq ($$($(2)_LICENSE_FILES),)
$(1)-legal-info: $(1)-patch $(1)-legal-info: $(1)-patch
endif
# We only save the sources of packages we want to redistribute, that are # We only save the sources of packages we want to redistribute, that are
# non-overriden (local or true override). # non-overriden (local or true override).
@ -810,6 +808,13 @@ endif
$$(Q)support/scripts/hardlink-or-copy \ $$(Q)support/scripts/hardlink-or-copy \
$$(DL_DIR)/$$($(2)_ACTUAL_SOURCE_TARBALL) \ $$(DL_DIR)/$$($(2)_ACTUAL_SOURCE_TARBALL) \
$$($(2)_REDIST_SOURCES_DIR) $$($(2)_REDIST_SOURCES_DIR)
# Save patches and generate the series file
$$(Q)while read f; do \
support/scripts/hardlink-or-copy \
$$$${f} \
$$($(2)_REDIST_SOURCES_DIR) || exit 1; \
printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
done <$$($(2)_DIR)/.applied_patches_list
endif # redistribute endif # redistribute
endif # other packages endif # other packages

View File

@ -14,10 +14,11 @@ This material is composed of the following items.
compiled programs. compiled programs.
Note: this may have not been saved due to technical limitations, you may Note: this may have not been saved due to technical limitations, you may
need to collect it manually. need to collect it manually.
* The source code for all packages; this has been saved in the sources/ * The original source code for all packages; this has been saved in the
subdirectory (except for the non-redistributable packages, which have not sources/ subdirectory (except for the non-redistributable packages, which
been saved); patches applied to some packages by Buildroot are included in have not been saved). Patches that were applied are also saved, along
the Buildroot sources and were not duplicated in the sources/ subdirectory. with a file named 'series' that lists the patches in the order they were
applied.
* A manifest file listing the configured packages and related information. * A manifest file listing the configured packages and related information.
* The license text of the packages; they have been saved in the licenses/ * The license text of the packages; they have been saved in the licenses/
subdirectory. subdirectory.