From patchwork Mon Nov 6 00:46:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABl_PORTAY?= X-Patchwork-Id: 834425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVYpj6LrCz9s81 for ; Mon, 6 Nov 2017 11:49:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1817F30470; Mon, 6 Nov 2017 00:48:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nvELNb9Vgl-M; Mon, 6 Nov 2017 00:48:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id EFEAD303FB; Mon, 6 Nov 2017 00:48:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E864F1C0ADF for ; Mon, 6 Nov 2017 00:48:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D913687C6C for ; Mon, 6 Nov 2017 00:48:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tgXksw8ZMwCw for ; Mon, 6 Nov 2017 00:48:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by fraxinus.osuosl.org (Postfix) with ESMTPS id BA11887C5F for ; Mon, 6 Nov 2017 00:48:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C092C9C1B14; Sun, 5 Nov 2017 19:48:48 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id GOLcZogrxNaO; Sun, 5 Nov 2017 19:48:48 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 4BBCB9C1B16; Sun, 5 Nov 2017 19:48:48 -0500 (EST) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 537apvs-a_aX; Sun, 5 Nov 2017 19:48:48 -0500 (EST) Received: from archlinux.local (modemcable013.17-177-173.mc.videotron.ca [173.177.17.13]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 4007D9C1B14; Sun, 5 Nov 2017 19:48:19 -0500 (EST) From: =?utf-8?q?Ga=C3=ABl_PORTAY?= To: buildroot@buildroot.org, "Yann E . MORIN" Date: Sun, 5 Nov 2017 19:46:50 -0500 Message-Id: <20171106004650.23669-1-gael.portay@savoirfairelinux.com> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] support/download: keep files downloaded without hash X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ga=C3=ABl_PORTAY?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In the situation where the hash is missing from the hash file, the dl-wrapper downloads the file again and again until the developer specifies the hash to complete the download step. To avoid this situation, the freshly-downloaded file is not removed anymore after a successful download. The build continues to terminate in error and the file will not be downloaded again during the next builds. Next builds will terminate in error until the hash is specified. Signed-off-by: Gaƫl PORTAY --- support/download/dl-wrapper | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper index f944b71db5..b018819833 100755 --- a/support/download/dl-wrapper +++ b/support/download/dl-wrapper @@ -21,7 +21,7 @@ set -e main() { local OPT OPTARG - local backend output hfile recurse quiet + local backend output hfile recurse quiet rc # Parse our options; anything after '--' is for the backend while getopts :hb:o:H:rq OPT; do @@ -93,9 +93,16 @@ main() { # Check if the downloaded file is sane, and matches the stored hashes # for that file - if ! support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then - rm -rf "${tmpd}" - exit 1 + if support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then + rc=0 + else + if [ ${?} -ne 3 ]; then + rm -rf "${tmpd}" + exit 1 + fi + + # the hash file exists and there was no hash to check the file against + rc=1 fi # tmp_output is in the same directory as the final output, so we can @@ -141,6 +148,8 @@ main() { rm -f "${tmp_output}" exit 1 fi + + return ${rc} } help() {