diff mbox

[4/5] core/pkg-utils: check hashes of license files

Message ID b4adb01dc51cc7e3300265e0b97e0366f7fbb786.1498428166.git.yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN June 25, 2017, 10:03 p.m. UTC
This will help catch a change of license even if the filename does
not change.

For now, a missing hash for the license files is not a fatal error, to
let people catch up and add them. When we switch to make it mandatory,
we can simplify the code by just removing the case statement.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Rahul Bedarkar <rahulbedarkar89@gmail.com>
---
 package/pkg-utils.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Peter Korsgaard July 3, 2017, 4:04 p.m. UTC | #1
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > This will help catch a change of license even if the filename does
 > not change.

 > For now, a missing hash for the license files is not a fatal error, to
 > let people catch up and add them. When we switch to make it mandatory,
 > we can simplify the code by just removing the case statement.

 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Luca Ceresoli <luca@lucaceresoli.net>
 > Cc: Peter Korsgaard <peter@korsgaard.com>
 > Cc: Rahul Bedarkar <rahulbedarkar89@gmail.com>

Committed, thanks.
diff mbox

Patch

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index e9ac56276f..accf48c464 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -85,5 +85,10 @@  endef
 
 define legal-license-file # pkgname, pkgname-pkgver, pkgdir, filename, file-fullpath, {HOST|TARGET}
 	mkdir -p $(LICENSE_FILES_DIR_$(6))/$(2)/$(dir $(4)) && \
+	{ \
+		support/download/check-hash $(3)/$(1).hash $(5) $(4); \
+		ret=$${?}; \
+		case $${ret} in (0|3) ;; (*) exit 1;; esac; \
+	} && \
 	cp $(5) $(LICENSE_FILES_DIR_$(6))/$(2)/$(4)
 endef