ngz pushed a commit to branch tex-team
in repository guix.

commit 7a5030d2a7745a9dd9a5154f98811ebbb1cb9627
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Fri Jun 21 09:37:39 2024 +0200

    gnu: Factorize URLs relative to TeX Live.
    
    * guix/build-system/texlive.scm (%texlive-repository):
    (texlive-packages-repository): New variables.
    * guix/import/texlive.scm (texlive-repository-location):
    (texlive-repository): Remove variables.
    (version->revision):
    (latest-texlive-tag):
    (tlpdb):
    (texlive->svn-multi-reference): Use new variables.
    * gnu/packages/tex.scm (texlive-source):
    (texlive-scripts): Use new variables.
    
    Change-Id: Ibbb21f9869d7fcb5aa66f7d9dd2070d0d5d8682a
---
 gnu/packages/tex.scm          |  7 ++++---
 guix/build-system/texlive.scm | 15 ++++++++++++---
 guix/import/texlive.scm       | 31 +++++++++----------------------
 3 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index fa7428f820..f4361a4966 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -200,7 +200,8 @@
   (origin
     (method svn-fetch)
     (uri (svn-reference
-          (url "svn://www.tug.org/texlive/trunk/Build/source/")
+          (url (string-append %texlive-repository
+                              "tags/texlive-" %texlive-version 
"/Build/source/"))
           (revision %texlive-revision)))
     (file-name (git-file-name "texlive-source" %texlive-version))
     (sha256
@@ -378,8 +379,8 @@ of user-specified directories similar to how shells look up 
executables.")
     (source (origin
               (method svn-multi-fetch)
               (uri (svn-multi-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        "texlive-" version "/Master/"))
+                    (url (string-append %texlive-repository
+                                        "tags/texlive-" version "/Master/"))
                     (locations
                      (list "texmf-dist/doc/man/man1/fmtutil-sys.1"
                            "texmf-dist/doc/man/man1/fmtutil-sys.man1.pdf"
diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm
index 88372faa58..c3bed76d6c 100644
--- a/guix/build-system/texlive.scm
+++ b/guix/build-system/texlive.scm
@@ -29,12 +29,14 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix svn-download)
   #:export (%texlive-build-system-modules
+            %texlive-repository
+            %texlive-revision
+            %texlive-tag
             texlive-build
             texlive-build-system
-            texlive-ref
             texlive-origin
-            %texlive-tag
-            %texlive-revision))
+            texlive-packages-repository
+            texlive-ref))
 
 ;; Commentary:
 ;;
@@ -42,6 +44,13 @@
 ;;
 ;; Code:
 
+(define %texlive-repository "svn://www.tug.org/texlive/")
+
+(define (texlive-packages-repository version)
+  "Return URL for packages location in TeX Live repository, at VERSION."
+  (string-append
+   %texlive-repository "tags/texlive-" version "/Master/texmf-dist"))
+
 ;; These variables specify the SVN tag and the matching SVN revision.  They
 ;; are taken from https://www.tug.org/svn/texlive/tags/
 (define %texlive-tag "texlive-2023.0")
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index c69e82861c..aff69f1272 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -22,6 +22,7 @@
   #:use-module (gcrypt hash)
   #:use-module (guix base32)
   #:use-module (guix build-system)
+  #:use-module (guix build-system texlive)
   #:use-module (guix derivations)
   #:use-module (guix diagnostics)
   #:use-module (guix gexp)
@@ -56,20 +57,6 @@
 ;;;
 ;;; Code:
 
-(define texlive-repository "svn://www.tug.org/texlive")
-
-(define* (texlive-repository-location version #:optional location)
-  (format #f
-          "~a/tags/texlive-~a/~a"
-          texlive-repository
-          version
-          (cond
-           ((not location) "")
-           ((string-prefix? "/" location)
-            (string-drop location 1))
-           (else
-            location))))
-
 ;; Generic locations are parts of the tree shared by multiple packages.
 ;; Package definitions should single out files stored there, or all files in
 ;; the directory from all involved packages would be downloaded.
@@ -227,11 +214,10 @@ not succeed."
 (define version->revision
   ;; Return revision, as a number, associated to string VERSION.
   (lambda (version)
-    (let ((output (svn-command "info"
-                               (texlive-repository-location version)
-                               "--show-item 'last-changed-revision'"
-                               "--no-newline")))
-      (string->number output))))
+    (let ((url (string-append %texlive-repository "tags/texlive-" version)))
+      (string->number
+       (svn-command
+        "info" url "--show-item 'last-changed-revision'" "--no-newline")))))
 
 (define (current-day)
   "Return number of days since Epoch."
@@ -244,7 +230,7 @@ not succeed."
   (memoize
    (lambda* (#:key (day (current-day)))
      (let ((output
-            (svn-command "ls" (string-append texlive-repository "/tags") 
"-v")))
+            (svn-command "ls" (string-append %texlive-repository "tags") 
"-v")))
        ;; E.g. "70951 karl april 15 18:11 texlive-2024.2/\n\n"
        (and=> (string-match "texlive-([^/]+)/\n*$" output)
               (cut match:substring <> 1))))))
@@ -386,7 +372,8 @@ association list."
                          (list value))))))
               (acons key new (alist-delete key alist)))))
          (database-url
-          (texlive-repository-location version "Master/tlpkg/texlive.tlpdb")))
+          (string-append %texlive-repository "tags/texlive-" version
+                         "/Master/tlpkg/texlive.tlpdb")))
     (call-with-input-string (svn-command "cat" database-url)
       (lambda (port)
         (let loop
@@ -608,7 +595,7 @@ at VERSION."
                (map (cut string-drop <> (string-length "texmf-dist/"))
                     files)))))
     (svn-multi-reference
-     (url (texlive-repository-location version "Master/texmf-dist"))
+     (url (texlive-packages-repository version))
      (locations (sort locations string<))
      (revision (assoc-ref database 'database-revision)))))
 

Reply via email to