From patchwork Sun Jul 20 22:42:22 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: 371947 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 B86BF14010F for ; Mon, 21 Jul 2014 08:42:59 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BFB7F31CE4; Sun, 20 Jul 2014 22:42:58 +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 s7h6LNEgoWug; Sun, 20 Jul 2014 22:42:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5603F3169B; Sun, 20 Jul 2014 22:42:43 +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 BCC1C1BFA7F for ; Sun, 20 Jul 2014 22:42:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B873F885A9 for ; Sun, 20 Jul 2014 22:42:35 +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 hy3y2qDfKjyB for ; Sun, 20 Jul 2014 22:42:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by fraxinus.osuosl.org (Postfix) with ESMTPS id EE2BC8853E for ; Sun, 20 Jul 2014 22:42:34 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id p10so6845113wes.16 for ; Sun, 20 Jul 2014 15:42:33 -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=R4gVOKtF95tIdwGxiw6LwDM8vOTQvtoBgoi+R4ywOW4=; b=vU0jWfC/Yf0C79kgryXPRMOaX5Zk1JRA6vYycpuY1q1dElC1lGG9ff3HItbxxPX/7i /w6xEWRrgYh++FN44H85BJo9wrHjjhD0IhhO6Ny3ErrwuT+gQgAgRnNpWD32b8VtaakL ZkQR2S7LkMFsY7X3X+ZPdtMlfgM2xCUmUr8Le3xBcXivJiZ32mrtTIp27adBj+/jOVGR d5mCiWoy+F5PiacqOtjy+apFo6+M4yil4OH4R7CIFyDWqVwciGR8xCUaULB1AusJigzV ay0kjO7JJub43z8teVGWtCjLI2AccUMP0p1wP76UR+8bIlStNeNawFYOzmRhyJ/H+doI OcCQ== X-Received: by 10.194.92.148 with SMTP id cm20mr17349310wjb.57.1405896153375; Sun, 20 Jul 2014 15:42:33 -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.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 20 Jul 2014 15:42:32 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 21 Jul 2014 00:42:22 +0200 Message-Id: <0e6a49a6da7926e3ef51f3e63cddcb2c9cff172d.1405895896.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 4/9 v3] support/download: convert cvs 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 cvs helper, as it no longer has to deal with atomically saving the downloaded archive. Signed-off-by: "Yann E. MORIN" Reviewed-by: Thomas De Schampheleire --- package/pkg-download.mk | 9 ++++++--- support/download/cvs | 50 ++++++++++++++----------------------------------- 2 files changed, 20 insertions(+), 39 deletions(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 94febab..235adcb 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -125,9 +125,12 @@ endef define DOWNLOAD_CVS test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - $(EXTRA_ENV) support/download/cvs $(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \ - $($(PKG)_DL_VERSION) $($(PKG)_RAWNAME) \ - $($(PKG)_BASE_NAME) $(DL_DIR)/$($(PKG)_SOURCE) + $(EXTRA_ENV) support/download/wrapper cvs \ + $(DL_DIR)/$($(PKG)_SOURCE) \ + $(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \ + $($(PKG)_DL_VERSION) \ + $($(PKG)_RAWNAME) \ + $($(PKG)_BASE_NAME) endef # Not all CVS servers support ls/rls, use login to see if we can connect diff --git a/support/download/cvs b/support/download/cvs index 9aeed79..b4b0acc 100755 --- a/support/download/cvs +++ b/support/download/cvs @@ -1,47 +1,25 @@ #!/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 cvs # Call it with: -# $1: cvs repo -# $2: cvs revision -# $3: package's name (eg. foobar) -# $4: package's basename (eg. foobar-1.2.3) -# $5: output file +# $1: output file +# $2: cvs repo +# $3: cvs revision +# $4: package's name (eg. foobar) +# $5: package's basename (eg. foobar-1.2.3) # And this environment: # CVS : the cvs command to call -# BUILD_DIR: path to Buildroot's build dir -repo="${1}" -rev="${2}" -rawname="${3}" -basename="${4}" -output="${5}" +output="${1}" +repo="${2}" +rev="${3}" +rawname="${4}" +basename="${5}" -repodir="${basename}.tmp-cvs-checkout" -tmp_output="$( mktemp "${output}.XXXXXX" )" +${CVS} -z3 -d":pserver:anonymous@${repo}" \ + co -d "${basename}" -r ":${rev}" -P "${rawname}" -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 ${CVS} -z3 -d":pserver:anonymous@${repo}" \ - co -d "${repodir}" -r ":${rev}" -P "${rawname}"; 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}"