--- Begin Message ---
Subject: |
[PATCH] gnu: svn-fetch: Make revision field optional. |
Date: |
Wed, 5 Jun 2024 07:52:02 +0200 |
* 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
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#71371] [PATCH v2] gnu: svn-fetch: Allow specifying revisions as strings. |
Date: |
Wed, 19 Jun 2024 09:27:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello,
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> Anyway, this patch is there to make my life less miserable while writing
>> a TeX Live updater. It is of no use (to me) if it is restricted to
>> internal projects. I'm not putting pressure on anyone though, if it
>> isn't accepted, I'll find other, probably more tedious, ways to complete
>> the updater.
> I see. I don't have a strong opinion, if it eases the maintenance of
> the many texlive packages we carry, but it seems to me that an updater
> could do the work of associating an immutable SVN reference to a tag at
> the time of the import.
That's indeed the plan B I had in mind when I wrote about other ways.
It's a bit more involved, though.
Fair enough. I'll close this door and open a new one.
Regards,
--
Nicolas Goaziou
--- End Message ---