guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: branch master updated: Revert "build: svn: Handle fetch errors."


From: zimoun
Subject: Re: branch master updated: Revert "build: svn: Handle fetch errors."
Date: Wed, 07 Oct 2020 01:48:22 +0200

Dear Paul, again :-)

(Finally, guix-commits is receiving this, not easy to not screw up with
raw Message-ID :-)

  <https://lists.gnu.org/archive/html/guix-commits/2020-10/msg00469.html>

anyway!  Back to the point.) 


On Tue, 06 Oct 2020 at 18:25, Paul Garlick 
<pgarlick@tourbillion-technology.com> wrote:

>>     svn: E155000: Destination directory exists; please remove the
>> directory  or use --force to overwrite
>
> This is caused by the line '(mkdir-p directory)', which creates the
> directory before 'svn export' uses the name of the directory as an
> argument.

It was because of ’with-directory-excursion’ and
’delete-file-recursively’.  But somehow the both are not necessary since
the creation/deletion is handled by “svn export”.  The attached patch v3
does that: remove ’mkdir-p’, ’delete-file-recursively’ and
’with-directory-excursion’, and so avoids ’–force’.

It passes the Guix 2 tests from the test-suite (simple tests about
texlive).  And I have tried on a couple of texlive packages (e.g., the 2
ones you recently submitted).  Please let me know if it is ok for you.


> I ran into a similar problem with the texlive importer which I fixed in
> commit 735808b12cc23909b421e10e212a07e7aa69a5eb.  In that case I was
> able to avoid using the '--force' argument by using a temporary
> subdirectory.

Nice trick ’(string-append directory “/svn”).  However, I am afraid that
would break all the ’svn-fetch’ packages because of hash mismatches.
The hash is computed by ’nar’-ing the directory so the addition of a
new directory would change it, if I understand correctly.


Thank you for your patience.

All the best,
simon

-- >8 -- v3.patch
>From 56c5d17b661941ed2616cebf9cc6d81bd45b8c34 Mon Sep 17 00:00:00 2001
From: zimoun <zimon.toutoune@gmail.com>
Date: Wed, 7 Oct 2020 01:05:21 +0200
Subject: [PATCH v3] build: svn: Fix handle fetch errors.

This fixes the revert 1ec67d5220b0ebac20263b44f4fefaf51ba8fdbb.

* guix/build/svn.scm (svn-fetch): Add 'guard' to handle errors.
---
 guix/build/svn.scm | 42 +++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 33783f3056..ee1834aba1 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)
+                     "hg-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
-- 
2.28.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]