From patchwork Sun May 4 12:01:45 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: 345466 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 5F48A140195 for ; Sun, 4 May 2014 22:02:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 949BD8B207; Sun, 4 May 2014 12:02:10 +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 NpbfrT3IAmQZ; Sun, 4 May 2014 12:02:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 777578B9D5; Sun, 4 May 2014 12:02:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 834971C2226 for ; Sun, 4 May 2014 12:02:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7FEA287B52 for ; Sun, 4 May 2014 12:02:02 +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 MZfzRu7ZPD2j for ; Sun, 4 May 2014 12:02:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by hemlock.osuosl.org (Postfix) with ESMTPS id DF12687B3D for ; Sun, 4 May 2014 12:02:01 +0000 (UTC) Received: by mail-we0-f178.google.com with SMTP id u56so5416810wes.23 for ; Sun, 04 May 2014 05:02:00 -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=pvSudkGtC0scJY4Rs3Rb0GFn6HEZ/3SP3ZZ5C7tbbmk=; b=y0ZYePJVG+c5DACqJqMsPGYOvAK7qGPIpl9dg/Nq1n16D05fRckkKkXkiBMCLIIRB6 kV9rAKsqJhwnJ+an24/ZPUdMcO/C/pdHzl/jLgeGdbN8xOtT9Sd/H/O9OAxampp4Qdvk 4uUcFw1RnYXhPQTyVAjCf+zNnoJ07ZK8dNT4sCXOU8psxevuAOKwA5aziwRSW9g5B2l5 dLuB49SNwGtUIxiDRvJy3n+pk5mriIEUxYr8WO/Eas2MR+Jhvr7fKIBysjPrehdZchdV 8iGu4fVzsN9RLb0zS1qsf8MV36wZCcRCvuvzY5Fb5druuYOlVaWI3QxV1rr1Gdw66lb2 W8rQ== X-Received: by 10.180.188.134 with SMTP id ga6mr11302006wic.58.1399204920293; Sun, 04 May 2014 05:02:00 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id iy13sm10455501wic.1.2014.05.04.05.01.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 04 May 2014 05:01:59 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 May 2014 14:01:45 +0200 Message-Id: <9f5178b0a3a655ad73e254ec82c73af1bb0c850b.1399204808.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 06/11] 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 From: "Yann E. MORIN" 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 --- 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 b8d0d02..121a795 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}"