summary refs log tree commit diff
diff options
context:
space:
mode:
authorzimoun <zimon.toutoune@gmail.com>2020-10-07 01:05:21 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-10-08 12:38:43 +0200
commitdb9e4af0ead4b02e1a70f358de995c43249b8bcf (patch)
tree9ada9a4639a44214d7b2316dbb5d7c11cea9b6d2
parent44e65a75886282a01001179e01bff2b9e957eb0a (diff)
downloadguix-db9e4af0ead4b02e1a70f358de995c43249b8bcf.tar.gz
build: svn: Fix handle fetch errors.
This fixes the revert 1ec67d5220b0ebac20263b44f4fefaf51ba8fdbb.

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

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--guix/build/svn.scm42
1 files changed, 27 insertions, 15 deletions
diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 33783f3056..f6b4ca0776 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
 ;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,8 @@
 
 (define-module (guix build svn)
   #:use-module (guix build utils)
+  #:use-module (srfi srfi-34)
+  #:use-module (ice-9 format)
   #:export (svn-fetch))
 
 ;;; Commentary:
@@ -36,20 +39,29 @@
                     (password #f))
   "Fetch REVISION from URL into DIRECTORY.  REVISION must be an integer, and a
 valid Subversion revision.  Return #t on success, #f otherwise."
-  (apply invoke svn-command
-         "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)
+  (guard (c ((invoke-error? c)
+             (format (current-error-port)
+                     "svn-fetch: '~a~{ ~a~}' failed with exit code ~a~%"
+                     (invoke-error-program c)
+                     (invoke-error-arguments c)
+                     (or (invoke-error-exit-status c)
+                         (invoke-error-stop-signal c)
+                         (invoke-error-term-signal c)))
+             #f))
+    (apply invoke svn-command
+           "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