From patchwork Thu Jul 16 20:34:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Spooren X-Patchwork-Id: 1330526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aparcar.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=McUHiLia; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B75dv0NCVz9sRW for ; Fri, 17 Jul 2020 06:37:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=tV1C7+I93+xO9eMghvosM60clW2w8IC3rm7KZwUjr/k=; b=McUHiLiaAQfM3JNnaRAHbwyitJ 8SkLPXZHTJeWMr0MuE+CNcRQkI2eI/o0m3sfybu1HGIGufQtfogxybLJ7HVUSh/rmPmQxk8gOeT8q nEoOIPNxSALiU1bJLMYN3h4Rh4nqboEm0uywcfFiYpYO2+iGA8AbwIdT0cmRTpYu8LEOKbBRu6OUc Xpy9+3b253ctmXJzJ7ZH7QPkReamtLgiWhmtAtnJQXqWWkp6fy2u+eWstfm4VLRzQWY/LAcPec9vn IJ21PmXEOgfBGiMmEQnj08wSb67ZTMyrJBrCRFFoKsRT/5+GpSd4ShYu1WZGDSNf7p2SeRc7UCMRq VePfvyYQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwAaP-0007lv-9X; Thu, 16 Jul 2020 20:34:33 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwAaL-0007iY-AD for openwrt-devel@lists.openwrt.org; Thu, 16 Jul 2020 20:34:32 +0000 Received: from dawn.lan (udp224251uds.hawaiiantel.net [72.234.141.215]) (Authenticated sender: mail@aparcar.org) by relay11.mail.gandi.net (Postfix) with ESMTPA id B9E0F100007; Thu, 16 Jul 2020 20:34:19 +0000 (UTC) From: Paul Spooren To: openwrt-devel@lists.openwrt.org Subject: [PATCH] build: use mkhash for IPK metadata checksums Date: Thu, 16 Jul 2020 10:34:11 -1000 Message-Id: <20200716203411.3720170-1-mail@aparcar.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_163429_511043_91808ACE X-CRM114-Status: GOOD ( 10.55 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.178.231 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [217.70.178.231 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hrusecky , Paul Spooren , Xu Wang Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 CC: Michal Hrusecky Signed-off-by: Paul Spooren --- 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 622cbf3223..82c8f24c9c 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -220,8 +220,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