From patchwork Mon Aug 27 04:54:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 180120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id BD47D2C00D7 for ; Mon, 27 Aug 2012 14:55:22 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0AA9B24B90; Mon, 27 Aug 2012 04:55:21 +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 YL-880-R1fHN; Mon, 27 Aug 2012 04:55:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id DA24424FB2; Mon, 27 Aug 2012 04:55:19 +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 8664E8F753 for ; Mon, 27 Aug 2012 04:55:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7152DA019D for ; Mon, 27 Aug 2012 04:55:18 +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 BrB90G0bwqUf for ; Mon, 27 Aug 2012 04:55:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ob0-f174.google.com (mail-ob0-f174.google.com [209.85.214.174]) by hemlock.osuosl.org (Postfix) with ESMTPS id C8EF4A0163 for ; Mon, 27 Aug 2012 04:55:13 +0000 (UTC) Received: by obbuo13 with SMTP id uo13so8739813obb.33 for ; Sun, 26 Aug 2012 21:55:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=JqKp4+HqECsI6k0cS/HFDLpe9MOzTnlnAIkTyedYPlA=; b=jqu/E9VZ30BPlEqV6qAEtE9gr+Gbp6aMPRMqA9SXBvY8BNnD0V42+6aFSl7h/VodQN xytm6gVEWsWf2ZbVJBN1B7zpyyYT6XDYaC8CGra45g/XwziKZPDdMC2mF8EdZtoxlivz rwzCm3H10KpBseBGdrDR+rjeBcpCZ1H0OTmt83mpV4HF/tFvWqGKKAVEMB8QsBrTJ/Pa ivATw4xS2m59MkYUMHjZYD8ybbxTcsRR9cjxKdJK5L0I+T4xElIk6muQGCt6yMRMnQc2 6fZWDSKT8KFpW3BoEYtZeBVTG1rquJ3u5DP7MGeTBnYDcKTvwKlUMj+T82EFB2tkgHXk auAw== Received: by 10.182.8.6 with SMTP id n6mr9018250oba.39.1346043312623; Sun, 26 Aug 2012 21:55:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.124.171 with HTTP; Sun, 26 Aug 2012 21:54:31 -0700 (PDT) In-Reply-To: <1346026375-15339-1-git-send-email-danomimanchego123@gmail.com> References: <1346026375-15339-1-git-send-email-danomimanchego123@gmail.com> From: Samuel Martin Date: Mon, 27 Aug 2012 06:54:31 +0200 Message-ID: To: Danomi Manchego Cc: buildroot@uclibc.org Subject: Re: [Buildroot] [PATCH] Replace DL_DIR refs in the GIT/SVN/HG download 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: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Hi Danomi, all, 2012/8/27 Danomi Manchego : > If DL_DIR is set to a relative path, then the download helpers > for GIT, SVN, and HG fail, because they reference DL_DIR or > $(PKG)_DL_DIR from within the DL_DIR directory. (But the > relative path is relative to TOPDIR.) All of these cases can > be avoided, since the location of the cloned repo is always > $(DL_DIR)/$($(PKG)_BASE_NAME), which can be used to make > the helpers simpler, as well as more friendly to the relative > DL_DIR definition. > > Signed-off-by: Danomi Manchego > --- > package/pkg-download.mk | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/package/pkg-download.mk b/package/pkg-download.mk > index 9e98581..a7cef0e 100644 > --- a/package/pkg-download.mk > +++ b/package/pkg-download.mk > @@ -68,11 +68,11 @@ define DOWNLOAD_GIT > test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ > (pushd $(DL_DIR) > /dev/null && \ > $(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ > - pushd $($(PKG)_BASE_NAME) > /dev/null && \ > + cd $($(PKG)_BASE_NAME) && \ > $(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \ > - gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \ > - popd > /dev/null && \ > - rm -rf $($(PKG)_DL_DIR) && \ > + gzip -c > ../$($(PKG)_SOURCE) && \ > + cd $($(PKG)_BASE_NAME) && \ [...] > + cd .. && \ If pushd/popd does not do the job, rather than these cd calls, I'd prefer: ( cd somewhere ; do something ) > + rm -rf $($(PKG)_BASE_NAME) && \ > popd > /dev/null) > endef > > @@ -104,9 +104,9 @@ endef > define DOWNLOAD_SVN > test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ > (pushd $(DL_DIR) > /dev/null && \ > - $(SVN) export -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_DL_DIR) && \ > + $(SVN) export -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ > $(TAR) czf $($(PKG)_SOURCE) $($(PKG)_BASE_NAME)/ && \ > - rm -rf $($(PKG)_DL_DIR) && \ > + rm -rf $($(PKG)_BASE_NAME) && \ > popd > /dev/null) > endef > > @@ -140,8 +140,8 @@ define DOWNLOAD_HG > (pushd $(DL_DIR) > /dev/null && \ > $(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) && \ > + --rev $($(PKG)_DL_VERSION) ./$($(PKG)_SOURCE) && \ > + rm -rf $($(PKG)_BASE_NAME) && \ > popd > /dev/null) > endef > Overall, I'd prefer a patch like the following, resolving a absolute path for DL_DIR, than a patch fixing everywhere DL_DIR is used. Regards, --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -26,6 +26,7 @@ DL_DIR=$(call qstrip,$(BR2_DL_DIR)) ifeq ($(DL_DIR),) DL_DIR:=$(TOPDIR)/dl endif +DL_DIR:=$(shell readlink -f $(DL_DIR)) or +DL_DIR:=$(shell cd $(DL_DIR); pwd)