Skip to content
Snippets Groups Projects
Unverified Commit 2fb12dd1 authored by zimoun's avatar zimoun Committed by Mathieu Othacehe
Browse files

build: svn: Handle fetch errors.


* guix/build/svn.scm (svn-fetch): Add 'guard' to handle errors.

Signed-off-by: default avatarMathieu Othacehe <othacehe@gnu.org>
parent a5a3f813
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in> ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
...@@ -20,6 +21,8 @@ ...@@ -20,6 +21,8 @@
(define-module (guix build svn) (define-module (guix build svn)
#:use-module (guix build utils) #:use-module (guix build utils)
#:use-module (srfi srfi-34)
#:use-module (ice-9 format)
#:export (svn-fetch)) #:export (svn-fetch))
;;; Commentary: ;;; Commentary:
...@@ -36,20 +39,33 @@ (define* (svn-fetch url revision directory ...@@ -36,20 +39,33 @@ (define* (svn-fetch url revision directory
(password #f)) (password #f))
"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
valid Subversion revision. Return #t on success, #f otherwise." valid Subversion revision. Return #t on success, #f otherwise."
(apply invoke svn-command (mkdir-p directory)
"export" "--non-interactive"
;; Trust the server certificate. This is OK as we (guard (c ((invoke-error? c)
;; verify the checksum later. This can be removed when (format (current-error-port)
;; ca-certificates package is added. "svn-fetch: '~a~{ ~a~}' failed with exit code ~a~%"
"--trust-server-cert" "-r" (number->string revision) (invoke-error-program c)
`(,@(if (and user-name password) (invoke-error-arguments c)
(list (string-append "--username=" user-name) (or (invoke-error-exit-status c)
(string-append "--password=" password)) (invoke-error-stop-signal c)
'()) (invoke-error-term-signal c)))
,@(if recursive? (delete-file-recursively directory)
'() #f))
(list "--ignore-externals")) (with-directory-excursion directory
,url ,directory)) (apply invoke svn-command
#t) "export" "--non-interactive"
;; Trust the server certificate. This is OK as we
;; verify the checksum later. This can be removed when
;; ca-certificates package is added.
"--trust-server-cert" "-r" (number->string revision)
`(,@(if (and user-name password)
(list (string-append "--username=" user-name)
(string-append "--password=" password))
'())
,@(if recursive?
'()
(list "--ignore-externals"))
,url ,directory))
#t)))
;;; svn.scm ends here ;;; svn.scm ends here
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment