When calling a download target, hash verification is now completely
skipped if the SKIPHASH variable is set.

This allows to easily bump package version:

    # Update PKG_VERSION in the package Makefile
    $ make package/<mypackage>/download SKIPHASH=1 V=s
    $ make package/<mypackage>/check FIXUP=1 V=s

This will download the new version of the package, and then automatically
update PKG_HASH with the hash of the new version.  Of course, it is still
the responsibility of the packager to ensure that the new tarball is
legitimate, because it is downloaded from a possibly untrusted source.

Fixes: b30ba14e ("scripts/download.pl: fail loudly if provided hash is 
unsupported")
Signed-off-by: Baptiste Jonglez <g...@bitsofnetworks.org>
---
 include/download.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/download.mk b/include/download.mk
index 0a25641738..a6821b5304 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -102,12 +102,18 @@ check_md5 = \
 hash_var = $(if $(filter-out x,$(1)),MD5SUM,HASH)
 endif
 
+ifdef SKIPHASH
+DOWNLOAD_CMD = $(SCRIPT_DIR)/download.pl --skip-hash
+else
+DOWNLOAD_CMD = $(SCRIPT_DIR)/download.pl
+endif
+
 define DownloadMethod/unknown
        echo "ERROR: No download method available"; false
 endef
 
 define DownloadMethod/default
-       $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(HASH)" "$(URL_FILE)" 
$(foreach url,$(URL),"$(url)") \
+       $(DOWNLOAD_CMD) "$(DL_DIR)" "$(FILE)" "$(HASH)" "$(URL_FILE)" $(foreach 
url,$(URL),"$(url)") \
        $(if $(filter check,$(1)), \
                $(call check_hash,$(FILE),$(HASH),$(2)$(call 
hash_var,$(MD5SUM))) \
                $(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \
-- 
2.11.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to