GNU bug report logs - #43817
[PATCH 0/1] guix: build: hg: Add 'guard' to handle error.

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Mon, 5 Oct 2020 16:36:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 43817 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: 43817 <at> debbugs.gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH 2/2] guix: build: svn: Add 'guard' to handle error.
Date: Mon,  5 Oct 2020 18:47:39 +0200
* guix/build/svn.scm (svn-fetch): Add 'guard' to handle error.
---
 guix/build/svn.scm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 33783f3056..0afe887487 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2014 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha <at> totakura.in>
 ;;; Copyright © 2018 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune <at> 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,7 +39,20 @@
                     (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
+  (mkdir-p directory)
+
+  (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) ;XXX: not quite accurate
+                         (invoke-error-stop-signal c)
+                         (invoke-error-term-signal c)))
+             (delete-file-recursively directory)
+             #f))
+    (with-directory-excursion directory
+      (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
@@ -50,6 +66,6 @@ valid Subversion revision.  Return #t on success, #f otherwise."
                  '()
                  (list "--ignore-externals"))
            ,url ,directory))
-  #t)
+      #t)))
 
 ;;; svn.scm ends here
-- 
2.28.0





This bug report was last modified 4 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.