[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:30:09 +0200 |
Dear Paul,
For the transparency, I have pasted my first email and your answer
because I have initially missed the ’Reply-To’ and so the messages do
not appear in ’guix-commits’ mailing list, see:
<https://lists.gnu.org/archive/html/guix-commits/2020-10/msg00455.html>
I do not know if I have not failed with this one, again. :-)
Then I will send you another reply containing a fix. Sorry for spamming
your inbox.
All the best,
simon
--
On Tue, 6 Oct 2020 at 17:18, zimoun <zimon.toutoune@gmail.com> wrote:
>
> Dear Paul,
>
> > commit 1ec67d5220b0ebac20263b44f4fefaf51ba8fdbb
> > Author: Paul Garlick <pgarlick@tourbillion-technology.com>
> > AuthorDate: Tue Oct 6 14:44:09 2020 +0100
> >
> > Revert "build: svn: Handle fetch errors."
>
> Sorry for the annoyance.
>
>
> > This reverts commit 2fb12dd1bb725592e1561ac8f4b32fb68accb161, which
> > causes the 'svn export' command to fail with:
> >
> > svn: E155000: Destination directory exists; please remove the directory
> > or use --force to overwrite
>
> Could you provide which command fails? Then I could check the fix.
> It is about texlive I guess, since that’s the main user of ’svn-fetch’.
> The attached patch works for the texlive packages I have tried.
>
>
> > ---
> > guix/build/svn.scm | 46 +++++++++++++++-------------------------------
>
> [...]
>
> > - (with-directory-excursion directory
> > - (apply invoke svn-command
> > - "export" "--non-interactive"
>
> Adding here the option “–force” fixes the issue. See patch attached.
>
>
>
> Again, sorry for the annoyance.
>
> All the best,
> simon
>
> -- >8 --
>From ef0df02c45e8e386ac8d54f1f7f304722db97d93 Mon Sep 17 00:00:00 2001
From: zimoun <zimon.toutoune@gmail.com>
Date: Mon, 5 Oct 2020 18:45:22 +0200
Subject: [PATCH v2] guix: build: svn: Add 'guard' to handle error.
* guix/build/svn.scm (svn-fetch): Add 'guard' to handle error.
---
guix/build/svn.scm | 51 ++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 15 deletions(-)
diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 33783f3056..19bbf051fb 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,38 @@
(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)
+ (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"
+ ;; This is OK since we are creating. If the directory is not
+ ;; created, then 'with-directory-excursion' fails or 'guard' is
+ ;; inactive. Without the option and with the created directory,
+ ;; 'svn' fails with "E155000: Destination directory exists".
+ "--force"
+ ;; 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
--
On Tue, 06 Oct 2020 at 18:25, Paul Garlick
<pgarlick@tourbillion-technology.com> wrote:
> Hi Simon,
>
>> Revert "build: svn: Handle fetch errors."
>>
>> Sorry for the annoyance.
>
> No worries.
>
> I spotted the problem this morning when I attempted to build a new
> texlive package. The command was './pre-inst-env guix build -K
> texlive-mathpazo'. The 'fetch' stage fails with the given error:
>
>> 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.
>
> 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.
>
> Best regards,
>
> Paul.