From patchwork Wed Mar 5 21:47:13 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: 327189 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 B59842C009F for ; Thu, 6 Mar 2014 08:47:57 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CA14B946C4; Wed, 5 Mar 2014 21:47:39 +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 xAkz8czKza0f; Wed, 5 Mar 2014 21:47:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id DA7B294D0A; Wed, 5 Mar 2014 21:47:38 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id AAE571CE473 for ; Wed, 5 Mar 2014 21:47:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A9BC3F725 for ; Wed, 5 Mar 2014 21:47:33 +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 Bt5unnIswhpV for ; Wed, 5 Mar 2014 21:47:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 72BB2F740 for ; Wed, 5 Mar 2014 21:47:32 +0000 (UTC) Received: by mail-we0-f170.google.com with SMTP id w61so1995081wes.29 for ; Wed, 05 Mar 2014 13:47:31 -0800 (PST) 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=yoB/+R6TPrrMIelKtzJ2KttZ5ocjEgUrkkb+KSYvqRI=; b=qCI12c8oo/JZ+UFmzT/JJdFB9BuIN/sdNMIZDTNJhD4CrfoMxDAnkT04sR3TM9fJsd DCedHdV9iIfJeCRb8fDpkaMoa4MeXE91x62x4os4b1RMNDqex+b56WqXnay0MdEux2BN vyfloQXvh7HP4DjuGkKF8MKqPMQO2BtOEQ7O6fCXPkQ4K5AjwsAcA5Znq9M21iCoyQDM cEyW2xVbVzJOleHmP7G5BAjKnXKpczrk65xfc4JQglVwe1R8Ev4GTAq08ApUlIs3ubxy VxoNYtN8q7978ViGtFPL96F2qQFfGRy9kmzVVoNH8XU06A78dPBGvCuTPweTGufCslFE TBLg== X-Received: by 10.194.158.136 with SMTP id wu8mr4268898wjb.91.1394056050897; Wed, 05 Mar 2014 13:47:30 -0800 (PST) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id f7sm6334887wjb.7.2014.03.05.13.47.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Mar 2014 13:47:30 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Wed, 5 Mar 2014 22:47:13 +0100 Message-Id: <46c87bc586c8fcf01ab538c6590c7a3cb4658344.1394055621.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 08/12] pkg-infra: don't use DL_DIR as scratchpad for temporary VCS checkouts 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" DL_DIR can be a very precious place for some users: they use it to store all the downloaded archives to share across all their Buildroot (and maybe non-Buildroot) builds. We do not want to trash this location with our temporary VCS (git, Hg, svn, cvs) repository clones/checkouts. Turns out that we already have some kind of scratchpad, the BUILD_DIR. Although it is not really a disposable location, that's the best we have so far. Note: we're using neither ${TMP} nor ${TMPDIR} since they are shared locations, sometime with little place (eg. tmpfs), and some of the repositories we clone/checkout can be very big. Signed-off-by: "Yann E. MORIN" --- package/fis/fis.mk | 2 +- support/download/cvs | 18 ++++++++++++------ support/download/git | 16 ++++++++++------ support/download/hg | 20 +++++++++++++------- support/download/svn | 19 ++++++++++++------- support/download/wget | 7 +++++-- 6 files changed, 53 insertions(+), 29 deletions(-) diff --git a/package/fis/fis.mk b/package/fis/fis.mk index e9426a1..d10fdd2 100644 --- a/package/fis/fis.mk +++ b/package/fis/fis.mk @@ -6,7 +6,7 @@ FIS_SITE = http://svn.chezphil.org/utils/trunk FIS_SITE_METHOD = svn -FIS_VERSION = 2892 +FIS_VERSION = 9852 define FIS_BUILD_CMDS $(TARGET_CC) $(TARGET_CFLAGS) -std=c99 -o $(@D)/fis \ diff --git a/support/download/cvs b/support/download/cvs index 06b8647..e4c1f32 100755 --- a/support/download/cvs +++ b/support/download/cvs @@ -11,8 +11,8 @@ set -e # $4: package's basename (eg. foobar-1.2.3) # $5: output file # And this environment: -# CVS : the cvs command to call -# BR2_DL_DIR: path to Buildroot's download dir +# CVS : the cvs command to call +# BUILD_DIR: path to Buildroot's build dir repo="${1}" rev="${2}" @@ -20,8 +20,14 @@ rawname="${3}" basename="${4}" output="${5}" -cd "${BR2_DL_DIR}" +repodir="${basename}.tmp-cvs-checkout" + +cd "${BUILD_DIR}" +# Remove leftovers from a previous failed run +rm -rf "${repodir}" "${output}.tmp" + ${CVS} -z3 -d":pserver:anonymous@${repo}" \ - co -d "${basename}" -r ":${rev}" -P "${rawname}" -tar czf "${output}" "${basename}" -rm -rf "${basename}" + co -d "${repodir}" -r ":${rev}" -P "${rawname}" +tar czf "${output}.tmp" "${repodir}" +mv "${output}.tmp" "${output}" +rm -rf "${repodir}" diff --git a/support/download/git b/support/download/git index 96db3a9..5ba26fb 100755 --- a/support/download/git +++ b/support/download/git @@ -10,15 +10,19 @@ set -e # $3: package's basename (eg. foobar-1.2.3) # $4: output file # And this environment: -# BR2_DL_DIR: path to Buildroot's download dir -# GIT : the git command to call +# GIT : the git command to call +# BUILD_DIR: path to Buildroot's build dir repo="${1}" cset="${2}" basename="${3}" output="${4}" -repodir="${BR2_DL_DIR}/${basename}" +repodir="${basename}.tmp-git-checkout" + +cd "${BUILD_DIR}" +# Remove leftovers from a previous failed run +rm -rf "${repodir}" "${output}.tmp" "${output}.tmp2" if [ -n "$(${GIT} ls-remote "${repo}" "${cset}" 2>&1)" ]; then printf "Doing shallow clone\n" @@ -30,8 +34,8 @@ fi pushd "${repodir}" ${GIT} archive --prefix="${basename}/" -o "${output}.tmp" --format=tar "${cset}" -gzip -c "${output}.tmp" >"${output}" -rm -f "${output}.tmp" +gzip -c "${output}.tmp" >"${output}.tmp2" +mv "${output}.tmp2" "${output}" popd -rm -rf "${repodir}" +rm -rf "${repodir}" "${output}.tmp" diff --git a/support/download/hg b/support/download/hg index 70b49cf..d96a0c5 100755 --- a/support/download/hg +++ b/support/download/hg @@ -10,16 +10,22 @@ set -e # $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 +# HG : the hg command to call +# BUILD_DIR: path to Buildroot's build 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}" +repodir="${basename}.tmp-hg-checkout" + +cd "${BUILD_DIR}" +# Remove leftovers from a previous failed run +rm -rf "${repodir}" "${output}.tmp" + +${HG} clone --noupdate --rev "${cset}" "${repo}" "${repodir}" +${HG} archive --repository "${repodir}" --type tgz --prefix "${basename}" \ + --rev "${cset}" "${output}.tmp" +mv "${output}.tmp" "${output}" +rm -rf "${repodir}" diff --git a/support/download/svn b/support/download/svn index c3ab32c..073709f 100755 --- a/support/download/svn +++ b/support/download/svn @@ -10,16 +10,21 @@ set -e # $3: package's basename (eg. foobar-1.2.3) # $4: output file # And this environment: -# SVN : the svn command to call -# BR2_DL_DIR: path to Buildroot's download dir +# SVN : the svn command to call +# BUILD_DIR: path to Buildroot's build dir repo="${1}" rev="${2}" basename="${3}" output="${4}" -pushd "${BR2_DL_DIR}" -${SVN} export -r "${rev}" "${repo}" "${basename}" -tar czf "${output}" "${basename}" -rm -rf "${basename}" -popd +repodir="${basename}.tmp-svn-checkout" + +cd "${BUILD_DIR}" +# Remove leftovers from a previous failed run +rm -rf "${repodir}" "${output}.tmp" + +${SVN} export -r "${rev}" "${repo}" "${repodir}" +tar czf "${output}.tmp" "${repodir}" +mv "${output}.tmp" "${output}" +rm -rf "${repodir}" diff --git a/support/download/wget b/support/download/wget index 7865517..7c941e4 100755 --- a/support/download/wget +++ b/support/download/wget @@ -8,14 +8,17 @@ set -e # $1: URL # $2: output file # And this environment: -# WGET : the wget command to call +# WGET : the wget command to call url="${1}" output="${2}" +# Remove leftovers from a previous failed run +rm -rf "${output}.tmp" + if ${WGET} -O "${output}.tmp" "${url}"; then mv "${output}.tmp" "${output}" else - rm -f "${output}.tmp" + rm -f "${tmpfile}" exit 1 fi