From patchwork Thu Oct 26 09:50:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Jonglez X-Patchwork-Id: 830557 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nfJhLsM0"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yN2Xl6C7fz9rxj for ; Thu, 26 Oct 2017 20:59:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date: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=EGxdq13C0jXOc2sEMCtHQJ5D1ZCrZ/QEsNBqv0Y7zdA=; b=nfJhLsM0K+syY9 N4FTRxDBisL4nxBVNLHhsh2raG/nKy5OT3E40NItt8Vqq0nw1o+3ZqpOJZmF7Gu9FDKISEDxEUwkL BJt81GVfDTEjGuEUSpb6/GvFiq1OQN8SSO8ofdndqaFS90tSNbqYdtYayRMiGWn9sDBDp/h/cZb8H SZ10KloZLY9XN5IMUzrIEimo6LZVyOStSvUevdkQ7S3Ql+/vyYQj7DUViiv14LUiVc1TYqlcWbJsj MHwHXOA5E4G3viLrYEHuHNaqWtjLpSGtuUSEhUaVOHtlJgDOKYb0fe28nf8ZtqBKXGsEXSvg5BYw0 JKKrdW/5ytGC4j/W+/DQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e7ewP-0004g6-FE; Thu, 26 Oct 2017 09:59:09 +0000 Received: from mx1.imag.fr ([2001:660:5301:6::5]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7eua-00037J-6E for lede-dev@lists.infradead.org; Thu, 26 Oct 2017 09:57:20 +0000 Received: from blaine ([IPv6:2001:660:5301:24:6516:eb5c:6d00:9a58]) by mx1.imag.fr (8.13.8/8.13.8) with ESMTP id v9Q9uW69021503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 26 Oct 2017 11:56:34 +0200 Received: from jonglezb by blaine with local (Exim 4.89) (envelope-from ) id 1e7ets-00022b-UX; Thu, 26 Oct 2017 11:56:32 +0200 From: Baptiste Jonglez To: lede-dev@lists.infradead.org, Felix Fietkau , Stijn Tintel Date: Thu, 26 Oct 2017 11:50:58 +0200 Message-Id: <20171026095059.6592-1-git@bitsofnetworks.org> X-Mailer: git-send-email 2.11.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (mx1.imag.fr [IPv6:2001:660:5301:6::5]); Thu, 26 Oct 2017 11:56:35 +0200 (CEST) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: v9Q9uW69021503 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: jonglezb@blaine.imag.fr MailScanner-NULL-Check: 1509616598.92002@znlxwxBoTHQWUq8l+JCWRg X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171026_025716_781966_179A81A1 X-CRM114-Status: UNSURE ( 7.55 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [2001:660:5301:6:0:0:0:5 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 1/2] scripts/download.pl: Add a --skip-hash option X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Baptiste Jonglez MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When the new "--skip-hash" option is passed to scripts/download.pl, hash verification of the downloaded files is completely skipped. This can be useful when bumping package version, since the hash may not be known in advance. Signed-off-by: Baptiste Jonglez Acked-by: Stijn Tintel --- scripts/download.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/download.pl b/scripts/download.pl index 775408934a..e0bf187559 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -13,9 +13,11 @@ use File::Basename; use File::Copy; use Text::ParseWords; -@ARGV > 2 or die "Syntax: $0 [ ...]\n"; +@ARGV > 2 or die "Syntax: $0 [--skip-hash] [ ...]\n"; my $url_filename; +my $skip_hash = 0; +$skip_hash = shift @ARGV if $ARGV[0] eq "--skip-hash"; my $target = glob(shift @ARGV); my $filename = shift @ARGV; my $file_hash = shift @ARGV; @@ -87,8 +89,13 @@ sub download_cmd($) { ; } -my $hash_cmd = hash_cmd(); -$hash_cmd or die "Cannot find appropriate hash command, ensure the provided hash is either a MD5 or SHA256 checksum.\n"; +my $hash_cmd; +if ($skip_hash) { + print("Warning: skipping hash verification as requested.\n"); +} else { + $hash_cmd = hash_cmd(); + $hash_cmd or die "Cannot find appropriate hash command, ensure the provided hash is either a MD5 or SHA256 checksum.\n"; +} sub download { From patchwork Thu Oct 26 09:50:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Jonglez X-Patchwork-Id: 830556 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ero+d/be"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="EyhQjAKa"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yN2WC18Ccz9rxj for ; Thu, 26 Oct 2017 20:57:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kgbenltbrnkp0JkgCMZPNkbuCXaB3tZgAaLh5YKOj1E=; b=Ero+d/beyJZPbE EK9O3W0mDjVUPGMk5y2xRgmU3C/0aNpuVTLHp7fhral9SyNH1KmQmoLi779o8/B4sLHSvddyeXwBm /yFOBMgRlwbJCvOUJdIVMo7brjMXkVZqH0eTP62GkccebHcKJhUE8G8bJYfS3Jy/oBOFc9Evh7a9E hPIOi2lkOuRh0vU35WQSH7pmO0s8SFkCVAXFzha8lyVl2N10FDSVdeGa2fFF+WyU6A2D8Lf3HJcwr eDCnolbU/T3GWob7sSBu9jc+9twoxYHTNRvYJ0oLRt/UYqPahCjBOVhCGzDjiNw7ubWhToTIrt7JL OfyXozEPsNNMVem+dGkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e7evD-0003or-FY; Thu, 26 Oct 2017 09:57:55 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7evA-0003nh-Bx for lede-dev@bombadil.infradead.org; Thu, 26 Oct 2017 09:57:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SBS3wmGxhQT65FVK6wGyOdo6NovVp7aTO+lCdSWp/OE=; b=EyhQjAKahRrEZKY09JdntdTwR Eerm/hR3q/jfHhHrg2KBhTC4IlcrGpJegpqTI2dGxlvJpGSHBaH0C86Sz3jEabeKjBTvC2HCSxhWY bpBfEiTmklJ5rx1T55z+kyKnwF+GEX2Y9u63JcVfKbVK+8P1Yl8mkhw8B67uZinZ7k7ok+ZljAck8 9xznIwamMXMGJDpnekac76dL1e4x3aZqnCUesGUV6BovxqFTzK9X2jvTKDo5z9s4ecG0yWUUnaa7d Oklx9HXHEK2rAJ22dhZ/lCOdRLO3s6Pg9oyoqSe7w6qJG8S+ikATNeSkUE1P4/RC2dG4luolfD2lx W5WUUOR0Q==; Received: from mx1.imag.fr ([2001:660:5301:6::5]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7ev6-0008MM-RC for lede-dev@lists.infradead.org; Thu, 26 Oct 2017 09:57:50 +0000 Received: from blaine ([IPv6:2001:660:5301:24:6516:eb5c:6d00:9a58]) by mx1.imag.fr (8.13.8/8.13.8) with ESMTP id v9Q9uaRJ021520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 26 Oct 2017 11:56:37 +0200 Received: from jonglezb by blaine with local (Exim 4.89) (envelope-from ) id 1e7etx-000234-KT; Thu, 26 Oct 2017 11:56:37 +0200 From: Baptiste Jonglez To: lede-dev@lists.infradead.org, Felix Fietkau , Stijn Tintel Date: Thu, 26 Oct 2017 11:50:59 +0200 Message-Id: <20171026095059.6592-2-git@bitsofnetworks.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026095059.6592-1-git@bitsofnetworks.org> References: <20171026095059.6592-1-git@bitsofnetworks.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (mx1.imag.fr [IPv6:2001:660:5301:6::5]); Thu, 26 Oct 2017 11:56:37 +0200 (CEST) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: v9Q9uaRJ021520 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: jonglezb@blaine.imag.fr MailScanner-NULL-Check: 1509616598.97951@4OokhdmQjUpLptEnBkC1tw X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [2001:660:5301:6:0:0:0:5 listed in] [list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 2/2] download.mk: introduce a new variable SKIPHASH X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Baptiste Jonglez MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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//download SKIPHASH=1 V=s $ make package//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 Acked-by: Stijn Tintel Acked-by: Stijn Tintel --- 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) \