From patchwork Sun Jul 20 22:42:26 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: 371951 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 8B5F914012E for ; Mon, 21 Jul 2014 08:43:18 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C91DD31323; Sun, 20 Jul 2014 22:43:17 +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 0Wqiav+FwokT; Sun, 20 Jul 2014 22:43:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 332C9319F6; Sun, 20 Jul 2014 22:42:55 +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 3DAA71BFA7F for ; Sun, 20 Jul 2014 22:42:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 39DE588F0B for ; Sun, 20 Jul 2014 22:42:44 +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 2+bIAGzFSrJ0 for ; Sun, 20 Jul 2014 22:42:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by hemlock.osuosl.org (Postfix) with ESMTPS id 4231488DBD for ; Sun, 20 Jul 2014 22:42:40 +0000 (UTC) Received: by mail-wi0-f175.google.com with SMTP id ho1so3202888wib.14 for ; Sun, 20 Jul 2014 15:42:38 -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=uSuIEQt675PCQQjuliAfc27Nwn1OD/EBBf9SkoR0tFE=; b=YwWIH2s7KoinUkNwXrKqtpdNUCTxNy8G8jO15ZesYa3XkK8vYFEfqOyv5kyPYpIPwE SqL75inroswgqH54YWkK+3UmHpfOUdSFakSiggXxoBZUklv9BZGaYJ6TJAJcBlj2UcM7 b09H4H98ys5w4HtFDkfWhOTjKW+kqx9pE/4A7MHu4EFab/r1Xc8ZmNEt6sWuBUHM+ksa pfPVyv4iiwWan6Y4S6FBK+692cwUjo2p7snGgPGNDJtOHdURAf2syx00XZsMSbIm370A abFGUr1cLuVkeri6vTRJ9imlpO/ExEt2W6zRldVl7dfbUZ0uFmaeMh5ZKZcGlKocQzJY T5rg== X-Received: by 10.180.81.103 with SMTP id z7mr45047602wix.23.1405896158689; Sun, 20 Jul 2014 15:42:38 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id ft17sm32902084wjc.14.2014.07.20.15.42.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 20 Jul 2014 15:42:37 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 21 Jul 2014 00:42:26 +0200 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 8/9 v3] support/download: convert svn to use the wrapper 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 This drastically simplifies the svn helper, as it no longer has to deal with atomically saving the downloaded archive. Signed-off-by: "Yann E. MORIN" Tested-by: Thomas De Schampheleire --- package/pkg-download.mk | 6 ++++-- support/download/svn | 44 +++++++++++--------------------------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 434eeaf..b18864e 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -147,8 +147,10 @@ endef define DOWNLOAD_SVN test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - $(EXTRA_ENV) support/download/svn $($(PKG)_SITE) $($(PKG)_DL_VERSION) \ - $($(PKG)_BASE_NAME) $(DL_DIR)/$($(PKG)_SOURCE) + $(EXTRA_ENV) support/download/wrapper svn \ + $(DL_DIR)/$($(PKG)_SOURCE) \ + $($(PKG)_SITE) $($(PKG)_DL_VERSION) \ + $($(PKG)_BASE_NAME) endef define SOURCE_CHECK_SVN diff --git a/support/download/svn b/support/download/svn index 39cbbcb..36ba520 100755 --- a/support/download/svn +++ b/support/download/svn @@ -1,44 +1,22 @@ #!/bin/bash -# We want to catch any command failure, and exit immediately +# We want to catch any unexpected failure, and exit immediately set -e # Download helper for svn # Call it with: -# $1: svn repo -# $2: svn revision -# $3: package's basename (eg. foobar-1.2.3) -# $4: output file +# $1: output file +# $2: svn repo +# $3: svn revision +# $4: package's basename (eg. foobar-1.2.3) # And this environment: # SVN : the svn command to call -# BUILD_DIR: path to Buildroot's build dir -repo="${1}" -rev="${2}" -basename="${3}" -output="${4}" +output="${1}" +repo="${2}" +rev="${3}" +basename="${4}" -repodir="${basename}.tmp-svn-checkout" -tmp_output="$( mktemp "${output}.XXXXXX" )" +${SVN} export "${repo}@${rev}" "${basename}" -cd "${BUILD_DIR}" -# Remove leftovers from a previous failed run -rm -rf "${repodir}" - -# Play tic-tac-toe with temp files -# - first, we download to a trashable location (the build-dir) -# - then we create a temporary tarball in the final location, so it is -# on the same filesystem as the final file -# - finally, we atomically rename to the final file - -ret=1 -if ${SVN} export "${repo}@${rev}" "${repodir}"; then - if tar czf "${tmp_output}" "${repodir}"; then - mv "${tmp_output}" "${output}" - ret=0 - fi -fi - -# Cleanup -rm -rf "${repodir}" "${tmp_output}" -exit ${ret} +tar czf "${output}" "${basename}"