diff mbox

[11/13,v7] core/legal-info: generate a hash of all saved files

Message ID a96a39a5d8ae941eb19df25cbaff28b92614749f.1462637351.git.yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN May 7, 2016, 4:14 p.m. UTC
Having a hash of the saved files can be interesting for the recipient to
verify the integrity of the files.

We remove the warning file earlier, to exclude it from the hash list.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
Changes v1 -> v2:
  - simplify getting rid of the ..../legal-info/ prefix  (Luca)
  - always sort with the C locale
---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni June 24, 2016, 3:08 p.m. UTC | #1
Hello,

On Sat,  7 May 2016 18:14:36 +0200, Yann E. MORIN wrote:
> Having a hash of the saved files can be interesting for the recipient to
> verify the integrity of the files.
> 
> We remove the warning file earlier, to exclude it from the hash list.

I added an explanation here about why we generate into a temporary file.

> -	@echo "Legal info produced in $(LEGAL_INFO_DIR)"
>  	@rm -f $(LEGAL_WARNINGS)
> +	@(cd $(LEGAL_INFO_DIR); \
> +	  find * -type f -exec sha256sum {} + \
> +	  |LC_ALL=C sort -k2 \
> +	  >.legal-info.sha256; \
> +	  mv .legal-info.sha256 legal-info.sha256 \
> +	)

I've fixed a bit the indentation here to be more consistent with the
usual style in Buildroot, i.e using tabs, and splitting lines a bit
less.

Applied with those minor issues fixed. Thanks!

Thomas
diff mbox

Patch

diff --git a/Makefile b/Makefile
index daa32a4..688bf26 100644
--- a/Makefile
+++ b/Makefile
@@ -701,8 +701,14 @@  legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p
 		cat support/legal-info/README.warnings-header \
 			$(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
 		cat $(LEGAL_WARNINGS); fi
-	@echo "Legal info produced in $(LEGAL_INFO_DIR)"
 	@rm -f $(LEGAL_WARNINGS)
+	@(cd $(LEGAL_INFO_DIR); \
+	  find * -type f -exec sha256sum {} + \
+	  |LC_ALL=C sort -k2 \
+	  >.legal-info.sha256; \
+	  mv .legal-info.sha256 legal-info.sha256 \
+	)
+	@echo "Legal info produced in $(LEGAL_INFO_DIR)"
 
 show-targets:
 	@echo $(PACKAGES) $(TARGETS_ROOTFS)