All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 07/13] pkg-infra: move the hg download helper to a script
Date: Sun,  2 Mar 2014 18:51:40 +0100	[thread overview]
Message-ID: <a7f0f6fd40c6e33c8b500c5a64ea4aecc22ba12c.1393781650.git.yann.morin.1998@free.fr> (raw)
In-Reply-To: <cover.1393781649.git.yann.morin.1998@free.fr>

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

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" <yann.morin.1998@free.fr>
---
 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 b83c7df..36dcfac 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}"
-- 
1.8.3.2

  parent reply	other threads:[~2014-03-02 17:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 17:51 [Buildroot] [PATCH 0/13 v2] some download-related changes Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 01/13] pkg-infra: DOWNLOAD is never called with two arguments Yann E. MORIN
2014-03-02 20:01   ` Thomas Petazzoni
2014-03-02 17:51 ` [Buildroot] [PATCH 02/13] Makefile: rename USER_HOOKS_EXTRA_ENV to EXTRA_ENV Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 03/13] Makefile: add BR2_DL_DIR " Yann E. MORIN
2014-03-05  6:29   ` Arnout Vandecappelle
2014-03-02 17:51 ` [Buildroot] [PATCH 04/13] pkg-infra: move the git download helper to a script Yann E. MORIN
2014-03-05  6:34   ` Arnout Vandecappelle
2014-03-02 17:51 ` [Buildroot] [PATCH 05/13] pkg-infra: move the svn " Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 06/13] pkg-infra: move the cvs " Yann E. MORIN
2014-03-02 17:51 ` Yann E. MORIN [this message]
2014-03-02 17:51 ` [Buildroot] [PATCH 08/13] pkg-infra: move the wget " Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 09/13] pkg-infra: don't use DL_DIR as scratchpad for temporary VCS checkouts Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 10/13] pkg-infra: also set PKGDIR for the download step Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 11/13] pkg-infra: add possiblity to check downloaded files against known hashes Yann E. MORIN
2014-03-02 20:10   ` Samuel Martin
2014-03-02 22:19     ` Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 12/13] manual: add documentation about packages' hashes Yann E. MORIN
2014-03-02 17:51 ` [Buildroot] [PATCH 13/13] package/ca-certificates: add tarball's hashes Yann E. MORIN
2014-03-02 20:14 ` [Buildroot] [PATCH 0/13 v2] some download-related changes Samuel Martin
2014-03-02 20:55   ` Thomas De Schampheleire
2014-03-02 22:32     ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7f0f6fd40c6e33c8b500c5a64ea4aecc22ba12c.1393781650.git.yann.morin.1998@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.