File guix/build/svn.scm changed (mode: 100644) (index 33783f3056..48d28f0327) |
2 |
2 |
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> |
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> |
3 |
3 |
;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in> |
;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in> |
4 |
4 |
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org> |
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org> |
|
5 |
|
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com> |
5 |
6 |
;;; |
;;; |
6 |
7 |
;;; This file is part of GNU Guix. |
;;; This file is part of GNU Guix. |
7 |
8 |
;;; |
;;; |
|
20 |
21 |
|
|
21 |
22 |
(define-module (guix build svn) |
(define-module (guix build svn) |
22 |
23 |
#:use-module (guix build utils) |
#:use-module (guix build utils) |
|
24 |
|
#:use-module (srfi srfi-34) |
|
25 |
|
#:use-module (ice-9 format) |
23 |
26 |
#:export (svn-fetch)) |
#:export (svn-fetch)) |
24 |
27 |
|
|
25 |
28 |
;;; Commentary: |
;;; Commentary: |
|
36 |
39 |
(password #f)) |
(password #f)) |
37 |
40 |
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a |
"Fetch REVISION from URL into DIRECTORY. REVISION must be an integer, and a |
38 |
41 |
valid Subversion revision. Return #t on success, #f otherwise." |
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) |
|
|
42 |
|
(mkdir-p directory) |
|
43 |
|
|
|
44 |
|
(guard (c ((invoke-error? c) |
|
45 |
|
(format (current-error-port) |
|
46 |
|
"svn-fetch: '~a~{ ~a~}' failed with exit code ~a~%" |
|
47 |
|
(invoke-error-program c) |
|
48 |
|
(invoke-error-arguments c) |
|
49 |
|
(or (invoke-error-exit-status c) |
|
50 |
|
(invoke-error-stop-signal c) |
|
51 |
|
(invoke-error-term-signal c))) |
|
52 |
|
(delete-file-recursively directory) |
|
53 |
|
#f)) |
|
54 |
|
(with-directory-excursion directory |
|
55 |
|
(apply invoke svn-command |
|
56 |
|
"export" "--non-interactive" |
|
57 |
|
;; Trust the server certificate. This is OK as we |
|
58 |
|
;; verify the checksum later. This can be removed when |
|
59 |
|
;; ca-certificates package is added. |
|
60 |
|
"--trust-server-cert" "-r" (number->string revision) |
|
61 |
|
`(,@(if (and user-name password) |
|
62 |
|
(list (string-append "--username=" user-name) |
|
63 |
|
(string-append "--password=" password)) |
|
64 |
|
'()) |
|
65 |
|
,@(if recursive? |
|
66 |
|
'() |
|
67 |
|
(list "--ignore-externals")) |
|
68 |
|
,url ,directory)) |
|
69 |
|
#t))) |
54 |
70 |
|
|
55 |
71 |
;;; svn.scm ends here |
;;; svn.scm ends here |