summary refs log tree commit diff
path: root/guix
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-07-11 15:23:34 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2023-07-18 18:16:54 +0200
commit32e48b8b43c7450f5d05f786d13fe62a71fcb068 (patch)
tree625cfc966bfb099ab253e0f7762ad2cdba156ae9 /guix
parenta8d937d1bb1f588db1a4e204d015248fe39f63cb (diff)
downloadguix-32e48b8b43c7450f5d05f786d13fe62a71fcb068.tar.gz
svn-download: Use download-nar in svn-multi-fetch.
This should help if there are issues fetching from the source repository.

* guix/svn-download.scm (svn-multi-fetch): Use download-nar and adjust
accordingly.
Diffstat (limited to 'guix')
-rw-r--r--guix/svn-download.scm67
1 files changed, 42 insertions, 25 deletions
diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index 6a53d5d2eb..78b13f62a4 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -160,33 +160,50 @@ HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
   "Return a fixed-output derivation that fetches REF, a <svn-multi-reference>
 object.  The output is expected to have recursive hash HASH of type
 HASH-ALGO (a symbol).  Use NAME as the file name, or a generic name if #f."
+
+  (define guile-json
+    (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4))
+
+  (define guile-lzlib
+    (module-ref (resolve-interface '(gnu packages guile)) 'guile-lzlib))
+
+  (define guile-gnutls
+    (module-ref (resolve-interface '(gnu packages tls)) 'guile-gnutls))
+
   (define build
-    (with-imported-modules '((guix build svn)
-                             (guix build utils))
-      #~(begin
-          (use-modules (guix build svn)
-                       (guix build utils)
-                       (srfi srfi-1)
-                       (ice-9 match))
+    (with-imported-modules
+        (source-module-closure '((guix build svn)
+                                 (guix build download-nar)
+                                 (guix build utils)))
+      (with-extensions (list guile-json guile-gnutls   ;for (guix swh)
+                             guile-lzlib)
+        #~(begin
+            (use-modules (guix build svn)
+                         (guix build utils)
+                         (guix build download-nar)
+                         (srfi srfi-1)
+                         (ice-9 match))
 
-          (for-each (lambda (location)
-                      ;; The directory must exist if we are to fetch only a
-                      ;; single file.
-                      (unless (string-suffix? "/" location)
-                        (mkdir-p (string-append #$output "/" (dirname location))))
-                      (svn-fetch (string-append (getenv "svn url") "/" location)
-                                 (string->number (getenv "svn revision"))
-                                 (if (string-suffix? "/" location)
-                                     (string-append #$output "/" location)
-                                     (string-append #$output "/" (dirname location)))
-                                 #:svn-command #+(file-append svn "/bin/svn")
-                                 #:recursive? (match (getenv "svn recursive?")
-                                                ("yes" #t)
-                                                (_ #f))
-                                 #:user-name (getenv "svn user name")
-                                 #:password (getenv "svn password")))
-                    (call-with-input-string (getenv "svn locations")
-                      read)))))
+            (or (every
+                 (lambda (location)
+                   ;; The directory must exist if we are to fetch only a
+                   ;; single file.
+                   (unless (string-suffix? "/" location)
+                     (mkdir-p (string-append #$output "/" (dirname location))))
+                   (svn-fetch (string-append (getenv "svn url") "/" location)
+                              (string->number (getenv "svn revision"))
+                              (if (string-suffix? "/" location)
+                                  (string-append #$output "/" location)
+                                  (string-append #$output "/" (dirname location)))
+                              #:svn-command #+(file-append svn "/bin/svn")
+                              #:recursive? (match (getenv "svn recursive?")
+                                             ("yes" #t)
+                                             (_ #f))
+                              #:user-name (getenv "svn user name")
+                              #:password (getenv "svn password")))
+                 (call-with-input-string (getenv "svn locations")
+                   read))
+                (download-nar #$output))))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "svn-checkout") build