unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#71371] [PATCH] gnu: svn-fetch: Make revision field optional.
@ 2024-06-05  5:52 Nicolas Goaziou via Guix-patches via
  2024-06-05 16:09 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Nicolas Goaziou via Guix-patches via @ 2024-06-05  5:52 UTC (permalink / raw)
  To: 71371
  Cc: Nicolas Goaziou, Christopher Baines, Florian Pelz,
	Josselin Poiret, Ludovic Courtès, Mathieu Othacehe,
	Matthew Trzcinski, Maxim Cournoyer, Ricardo Wurmus,
	Simon Tournier, Tobias Geerinckx-Rice

* guix/svn-download.scm (<svn-reference>): Set default value for REVISION
field to #F.
(svn-fetch):
(svn-multi-fetch): Take into consideration the revision can be a number or #F.
* guix/build/svn.scm (svn-fetch): Skip "-r" argument when revision is #F.
* doc/guix.texi (origin Reference): Document changes about REVISION field.

Change-Id: Idb0eeb7ca4121db3caf789a9658ac79b321439d4
---
 doc/guix.texi         |  5 +++--
 guix/build/svn.scm    |  6 ++++--
 guix/svn-download.scm | 16 ++++++++++------
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9b60e6c603..5e1173b8c6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8263,8 +8263,9 @@ origin Reference
 @item @code{url}
 The URL of the Subversion repository to clone.
 
-@item @code{revision}
-This string denotes revision to fetch specified as a number.
+@item @code{revision} (default: @code{#f})
+This field denotes the revision to fetch, as a number.  It can also be
+set to @code{#f}, for example when @var{url} contains a tag reference.
 
 @item @code{recursive?} (default: @code{#f})
 This Boolean indicates whether to recursively fetch Subversion
diff --git a/guix/build/svn.scm b/guix/build/svn.scm
index 875d3c50ca..3ae6519628 100644
--- a/guix/build/svn.scm
+++ b/guix/build/svn.scm
@@ -46,8 +46,7 @@ (define* (svn-fetch url revision directory
            ;; 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)
-
+           "--trust-server-cert"
            ;; Disable keyword substitutions (keywords are CVS-like strings
            ;; like "$Date$", "$Id$", and so on) for two reasons: (1) some
            ;; expansions depend on the local time zone, and (2) SWH disables
@@ -61,6 +60,9 @@ (define* (svn-fetch url revision directory
              ,@(if recursive?
                    '()
                    (list "--ignore-externals"))
+             ,@(if revision
+                   (list "-r" (number->string revision))
+                   '())
              ,url ,directory))
     #t))
 
diff --git a/guix/svn-download.scm b/guix/svn-download.scm
index bdd9c39eb5..dc9856cfb1 100644
--- a/guix/svn-download.scm
+++ b/guix/svn-download.scm
@@ -63,7 +63,7 @@ (define-record-type* <svn-reference>
   svn-reference make-svn-reference
   svn-reference?
   (url        svn-reference-url)                    ; string
-  (revision   svn-reference-revision)               ; number
+  (revision   svn-reference-revision (default #f))  ; number or #f
   (recursive? svn-reference-recursive? (default #f))
   (user-name  svn-reference-user-name (default #f))
   (password   svn-reference-password (default #f)))
@@ -120,7 +120,9 @@ (define* (svn-fetch ref hash-algo hash
 
             (or (and (download-method-enabled? 'upstream)
                      (svn-fetch (getenv "svn url")
-                                (string->number (getenv "svn revision"))
+                                (match (getenv "svn revision")
+                                  ("#f" #f)
+                                  (s (string->number s)))
                                 #$output
                                 #:svn-command #+(file-append svn "/bin/svn")
                                 #:recursive? (match (getenv "svn recursive?")
@@ -145,7 +147,7 @@ (define* (svn-fetch ref hash-algo hash
                       #:env-vars
                       `(("svn url" . ,(svn-reference-url ref))
                         ("svn revision"
-                         . ,(number->string (svn-reference-revision ref)))
+                         . ,(object->string (svn-reference-revision ref)))
                         ,@(if (svn-reference-recursive? ref)
                               `(("svn recursive?" . "yes"))
                               '())
@@ -173,7 +175,7 @@ (define-record-type* <svn-multi-reference>
   svn-multi-reference make-svn-multi-reference
   svn-multi-reference?
   (url        svn-multi-reference-url)                 ; string
-  (revision   svn-multi-reference-revision)            ; number
+  (revision   svn-multi-reference-revision)            ; number or #f
   (locations  svn-multi-reference-locations)           ; list of strings
   (recursive? svn-multi-reference-recursive? (default #f))
   (user-name  svn-multi-reference-user-name (default #f))
@@ -233,7 +235,9 @@ (define* (svn-multi-fetch ref hash-algo hash
                      (mkdir-p (string-append #$output "/" (dirname location))))
                    (and (download-method-enabled? 'upstream)
                         (svn-fetch (string-append (getenv "svn url") "/" location)
-                                   (string->number (getenv "svn revision"))
+                                   (match (getenv "svn revision")
+                                     ("#f" #f)
+                                     (s (string-to-number s)))
                                    (if (string-suffix? "/" location)
                                        (string-append #$output "/" location)
                                        (string-append #$output "/" (dirname location)))
@@ -271,7 +275,7 @@ (define* (svn-multi-fetch ref hash-algo hash
                         ("svn locations"
                          . ,(object->string (svn-multi-reference-locations ref)))
                         ("svn revision"
-                         . ,(number->string (svn-multi-reference-revision ref)))
+                         . ,(object->string (svn-multi-reference-revision ref)))
                         ,@(if (svn-multi-reference-recursive? ref)
                               `(("svn recursive?" . "yes"))
                               '())

base-commit: bf202e8bdd10dbd01da391ef635d1a31197251c1
-- 
2.41.0







^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-25 15:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05  5:52 [bug#71371] [PATCH] gnu: svn-fetch: Make revision field optional Nicolas Goaziou via Guix-patches via
2024-06-05 16:09 ` Ludovic Courtès
2024-06-05 20:44   ` Nicolas Goaziou via Guix-patches via
2024-06-05 16:32 ` Simon Tournier
2024-06-18  8:30 ` [bug#71371] [PATCH v2] gnu: svn-fetch: Allow specifying revisions as strings Nicolas Goaziou via Guix-patches via
2024-06-18 12:11   ` Maxim Cournoyer
2024-06-18 13:26     ` Nicolas Goaziou via Guix-patches via
2024-06-18 18:26       ` Maxim Cournoyer
2024-06-19  7:27         ` bug#71371: " Nicolas Goaziou via Guix-patches via
2024-06-25 15:19         ` [bug#71371] " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).