From patchwork Thu Nov 22 00:18:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 200909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 3AA1C2C0080 for ; Thu, 22 Nov 2012 11:21:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BD844A03F2; Thu, 22 Nov 2012 00:21:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JFN3ThcSYobS; Thu, 22 Nov 2012 00:21:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 41CB5A03AF; Thu, 22 Nov 2012 00:20:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id A97B48F74A for ; Thu, 22 Nov 2012 00:19:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8CD9E81617 for ; Thu, 22 Nov 2012 00:19:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hd2XaOi7cH7C for ; Thu, 22 Nov 2012 00:19:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by whitealder.osuosl.org (Postfix) with ESMTPS id 2410E814D7 for ; Thu, 22 Nov 2012 00:19:13 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id e12so1163520wge.10 for ; Wed, 21 Nov 2012 16:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=C39JIpK5QtW15lWwPX6xEVDfVuGYjEtJDUDRgvbiLcs=; b=uGjYD/j9gQK1EAlVa6TVzRKabjTkQpIR8r3kToHwGY8ap05xDEhTxm9QAwrFZVBHuV 7JcR2eMhP2jGeyIGQ7VPKOcC3mhZNQha82FI02m2TL9DEnEcHOCEoQYXOA/39aZDAN2K RONeGUhbSrTCrAlmXS0C9uroNRWZgs03baU3v41G3m8wbSKSzzHmrradYlsk1yz1vV/k 1GpdBUy+xfMibKpZ74jGuVSAuOsRLdj/dSe1ochFujachfY/IoMlFidaZO2i4vrmMeTj EXQuYrHH6KPZWU2TMWy12cYCbJ+PeR0Cc1f6LVyOvsPc5FswHOKZJxqCpwmdfmloZMDZ wTDA== Received: by 10.180.99.5 with SMTP id em5mr1774629wib.8.1353543554202; Wed, 21 Nov 2012 16:19:14 -0800 (PST) Received: from localhost.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net. [82.229.165.48]) by mx.google.com with ESMTPS id r10sm1847697wiz.0.2012.11.21.16.19.12 (version=SSLv3 cipher=OTHER); Wed, 21 Nov 2012 16:19:13 -0800 (PST) From: Samuel Martin To: buildroot@busybox.net Date: Thu, 22 Nov 2012 01:18:10 +0100 Message-Id: <1353543503-8952-21-git-send-email-s.martin49@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1353543503-8952-1-git-send-email-s.martin49@gmail.com> References: <1353543503-8952-1-git-send-email-s.martin49@gmail.com> Subject: [Buildroot] [PATCH 20/33] pkg-download.mk: add tarball check in the wget method X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net In case of wrong package source url, the retrieved file is a html page; this lead to a build failure at the extraction time. So, in case of tarballs, check the file type of the downloaded material and remove the temporary file if it is wrong. As a side effect of this, if the source location has changed since the package integration in Buildroot, the download will fall back on the Buildroot backup site. Signed-off-by: Samuel Martin --- package/pkg-download.mk | 13 +++++++++++-- support/dependencies/dependencies.sh | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 6c57244..5e99d7d 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -175,8 +175,17 @@ endef # the next time the download is tried. define DOWNLOAD_WGET test -e $(DL_DIR)/$(2) || \ - ($(WGET) -O $(DL_DIR)/$(2).tmp '$(call qstrip,$(1))' && \ - mv $(DL_DIR)/$(2).tmp $(DL_DIR)/$(2)) || \ + (($(WGET) -O $(DL_DIR)/$(2).tmp '$(call qstrip,$(1))' ; \ + case "$(2)" in \ + *.bz2|*.gz|*.tbz|*.tbz2|*.tgz|*.xz|*.tar) \ + file $(DL_DIR)/$(2).tmp | grep -q 'HTML\ document' && \ + (rm -f $(DL_DIR)/$(2).tmp ; \ + echo "error: Cannot retrieve $(2) from '$(call qstrip,$(1))'." ; \ + echo "error: Wrong package URL: $(call qstrip,$(1))") || \ + exit 0 ;; \ + *) exit 0 ;; \ + esac) && \ + mv $(DL_DIR)/$(2).tmp $(DL_DIR)/$(2)) || \ (rm -f $(DL_DIR)/$(2).tmp ; exit 1) endef diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh index 9f0f6a9..651fc51 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -131,7 +131,7 @@ if ! $SHELL --version 2>&1 | grep -q '^GNU bash'; then fi; # Check that a few mandatory programs are installed -for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio python unzip rsync ${DL_TOOLS} ; do +for prog in awk bison file flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio python unzip rsync ${DL_TOOLS} ; do if ! which $prog > /dev/null ; then /bin/echo -e "\nYou must install '$prog' on your build machine"; if test $prog = "makeinfo" ; then