From patchwork Mon Jun 30 22:26:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 365785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id BAB6B140115 for ; Tue, 1 Jul 2014 08:27:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C3AEB8B49F; Mon, 30 Jun 2014 22:26:55 +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 FrrA3e-eT8UN; Mon, 30 Jun 2014 22:26:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 23FA68B1D2; Mon, 30 Jun 2014 22:26:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 946431C1654 for ; Mon, 30 Jun 2014 22:26:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8ECF6321A6 for ; Mon, 30 Jun 2014 22:26:43 +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 QUFPT1Hhah+M for ; Mon, 30 Jun 2014 22:26:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by silver.osuosl.org (Postfix) with ESMTPS id BAC6E31E0F for ; Mon, 30 Jun 2014 22:26:42 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id n3so6850414wiv.9 for ; Mon, 30 Jun 2014 15:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KjBeiNDag/RqPo/oXANHJzX/2ecU7nV/Ukh0r6YwBqY=; b=ktf68/5C3pPKc+tQoTWMXnDkmbl91IACElFEZCVAQqnCHNXwTTrxij/OwZrWzGB4dY Dtcz8XeuVvj+zZa2wA9dxuYIBeNd1UvXfIGbLeOSFzTQ2U7YXewW4iVkb8rZcznSpFQE mZrCggPpcl6sz57d89YGrtaQOxispO1pf52H/C5YqvqjrVcHf3/HjN5rQA4I/SgYNHZ/ apIkRJZVYinP2JpKD9/gaRXGS9pGO3doxldKGZu8pl31pQ6DZlqEU1NkhzuqylHeS8qo eo4nOWRLXM0m+w0365vtoo65aTTMPbrm2sNDYXf7+UsLTfClPB9G5oBx646+Z1V7mzfn xVtg== X-Received: by 10.180.184.36 with SMTP id er4mr31576240wic.37.1404167201231; Mon, 30 Jun 2014 15:26:41 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id o12sm36042951wiw.5.2014.06.30.15.26.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jun 2014 15:26:40 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Tue, 1 Jul 2014 00:26:24 +0200 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 06/14] pkg-infra: move the hg download helper to a script 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 Maintaining the download helpers in the Makefile has proved to be a bit complex, so move it to a shell script. Signed-off-by: "Yann E. MORIN" Reviewed-by: Samuel Martin Tested-by: Thomas De Schampheleire [tested a particular scenario that used to fail, when the 'hg archive' step is interrupted, now working fine] --- package/pkg-download.mk | 11 +++-------- support/download/hg | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100755 support/download/hg diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 9f3afac..3290b6b 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -13,7 +13,7 @@ export SVN := $(call qstrip,$(BR2_SVN)) export CVS := $(call qstrip,$(BR2_CVS)) BZR := $(call qstrip,$(BR2_BZR)) export GIT := $(call qstrip,$(BR2_GIT)) -HG := $(call qstrip,$(BR2_HG)) $(QUIET) +export HG := $(call qstrip,$(BR2_HG)) $(QUIET) SCP := $(call qstrip,$(BR2_SCP)) $(QUIET) SSH := $(call qstrip,$(BR2_SSH)) $(QUIET) LOCALFILES := $(call qstrip,$(BR2_LOCALFILES)) @@ -161,13 +161,8 @@ endef define DOWNLOAD_HG test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - (pushd $(DL_DIR) > /dev/null && \ - rm -rf $($(PKG)_BASE_NAME) && \ - $(HG) clone --noupdate --rev $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ - $(HG) archive --repository $($(PKG)_BASE_NAME) --type tgz --prefix $($(PKG)_BASE_NAME)/ \ - --rev $($(PKG)_DL_VERSION) $(DL_DIR)/$($(PKG)_SOURCE) && \ - rm -rf $($(PKG)_DL_DIR) && \ - popd > /dev/null) + $(EXTRA_ENV) support/download/hg $($(PKG)_SITE) $($(PKG)_DL_VERSION) \ + $($(PKG)_BASE_NAME) $(DL_DIR)/$($(PKG)_SOURCE) endef # TODO: improve to check that the given PKG_DL_VERSION exists on the remote diff --git a/support/download/hg b/support/download/hg new file mode 100755 index 0000000..70b49cf --- /dev/null +++ b/support/download/hg @@ -0,0 +1,25 @@ +#!/bin/sh + +# We want to catch any command failure, and exit immediately +set -e + +# Download helper for hg +# Call it with: +# $1: hg repo +# $2: hg cset +# $3: package's basename (eg. foobar-1.2.3) +# $4: output file +# And this environment: +# HG : the hg command to call +# BR2_DL_DIR: path to Buildroot's download dir + +repo="${1}" +cset="${2}" +basename="${3}" +output="${4}" + +cd "${BR2_DL_DIR}" +${HG} clone --noupdate --rev "${cset}" "${repo}" "${basename}" +${HG} archive --repository "${basename}" --type tgz --prefix "${basename}" \ + --rev "${cset}" "${output}" +rm -rf "${basename}"