From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJHRc-00085p-Ck for guix-patches@gnu.org; Fri, 09 Jun 2017 06:47:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJHRW-0000SP-FT for guix-patches@gnu.org; Fri, 09 Jun 2017 06:47:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:33273) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dJHRW-0000SI-CC for guix-patches@gnu.org; Fri, 09 Jun 2017 06:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dJHRW-0006Dz-5Y for guix-patches@gnu.org; Fri, 09 Jun 2017 06:47:02 -0400 Subject: bug#27296: [PATCH 01/35] guix: Add download-svn-to-store. References: <874lvpe91u.fsf@elephly.net> In-Reply-To: <874lvpe91u.fsf@elephly.net> Resent-Message-ID: From: Ricardo Wurmus Date: Fri, 9 Jun 2017 12:45:25 +0200 Message-Id: <20170609104559.17416-1-rekado@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 27296@debbugs.gnu.org Cc: Ricardo Wurmus * guix/svn-download.scm (download-svn-to-store): New procedure. --- guix/svn-download.scm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/guix/svn-download.scm b/guix/svn-download.scm index c1200fa0c..c118869af 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2014 Sree Harsha Totakura +;;; Copyright © 2017 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,12 +24,15 @@ #:use-module (guix store) #:use-module (guix monads) #:use-module (guix packages) + #:use-module (guix utils) + #:use-module ((guix build svn) #:prefix build:) #:use-module (ice-9 match) #:export (svn-reference svn-reference? svn-reference-url svn-reference-revision - svn-fetch)) + svn-fetch + download-svn-to-store)) ;;; Commentary: ;;; @@ -79,4 +83,21 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." #:guile-for-build guile #:local-build? #t))) +(define* (download-svn-to-store store ref + #:optional (name (basename (svn-reference-url ref))) + #:key (log (current-error-port))) + "Download from REF, a object to STORE. Write progress +reports to LOG." + (call-with-temporary-directory + (lambda (temp) + (let ((result + (parameterize ((current-output-port log)) + (build:svn-fetch (svn-reference-url ref) + (svn-reference-revision ref) + temp + #:user-name (svn-reference-user-name ref) + #:password (svn-reference-password ref))))) + (and result + (add-to-store store name #t "sha256" temp)))))) + ;;; svn-download.scm ends here -- 2.12.2