gnu: r-igraph: Move to (gnu packages cran).
[jackhill/guix/guix.git] / guix / build / svn.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
4 ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (guix build svn)
22 #:use-module (guix build utils)
23 #:export (svn-fetch))
24
25 ;;; Commentary:
26 ;;;
27 ;;; This is the build-side support code of (guix svn-download). It allows a
28 ;;; Subversion repository to be cloned and checked out at a specific revision.
29 ;;;
30 ;;; Code:
31
32 (define* (svn-fetch url revision directory
33 #:key (svn-command "svn")
34 (recursive? #t)
35 (user-name #f)
36 (password #f))
37 "Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a
38 valid Subversion revision. Return #t on success, #f otherwise."
39 (apply invoke svn-command
40 "export" "--non-interactive"
41 ;; Trust the server certificate. This is OK as we
42 ;; verify the checksum later. This can be removed when
43 ;; ca-certificates package is added.
44 "--trust-server-cert" "-r" (number->string revision)
45 `(,@(if (and user-name password)
46 (list (string-append "--username=" user-name)
47 (string-append "--password=" password))
48 '())
49 ,@(if recursive?
50 '()
51 (list "--ignore-externals"))
52 ,url ,directory))
53 #t)
54
55 ;;; svn.scm ends here