[openwrt/openwrt] build: use mkhash for IPK metadata checksums

LEDE Commits lede-commits at lists.infradead.org
Fri Nov 27 00:06:57 EST 2020


aparcar pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/e34f04f4bcaae2abead8e85b42dbcbba3ab2a065

commit e34f04f4bcaae2abead8e85b42dbcbba3ab2a065
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Thu Jul 16 10:34:11 2020 -1000

    build: use mkhash for IPK metadata checksums
    
    When setting the option IPK_FILES_CHECKSUMS the build system stores
    checksums of all package file as metadata. In combination with pkg_check
    this allows to see if a package is broken, e.g. caused by bad flash.
    
    To create those checksums the tool `sha256sum` were used while the rest
    of OpenWrt uses `mkhash`, a small & fast implementation of sha256. As
    the build system does not check the existence of `sha256sum` and the
    stderr output is moved to /dev/null, a situation where the option is
    enabled but no actual checksum are created may occur.
    
    Instead of adding `sha256sum` as a requirement, this replaces it with
    `mkhash sha256` and adapts the `sed` pipe command to fit spacing.
    
    CC: Xu Wang <xwang1498 at gmx.com>
    CC: Michal Hrusecky <Michal at Hrusecky.net>
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 include/package-ipkg.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 0bca8ae84d..a92d692121 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -218,8 +218,8 @@ $(_endef)
     ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
 	(cd $$(IDIR_$(1)); \
 		( \
-			find . -type f \! -path ./CONTROL/\* -exec sha256sum \{\} \; 2> /dev/null | \
-			sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
+			find . -type f \! -path ./CONTROL/\* -exec mkhash sha256 -n \{\} \; 2> /dev/null | \
+			sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
 		) || true \
 	)
     endif



More information about the lede-commits mailing list