summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2024-06-21 09:37:39 +0200
committerChristopher Baines <mail@cbaines.net>2024-06-27 10:09:33 +0100
commit10874630b9dfc08e1d885cb0a26c25bd6613b5b0 (patch)
treefbe0de6603734a3e45b77d59609521fd11011bdb
parent563e604d4b0a3817db795e11578595cfda324a7a (diff)
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
-rw-r--r--gnu/packages/tex.scm7
-rw-r--r--guix/build-system/texlive.scm15
-rw-r--r--guix/import/texlive.scm31
3 files changed, 25 insertions, 28 deletions
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 114726510d..337bc6518b 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 2baa35466b..1c1eb25454 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 411e345f2d..109bfc07e9 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
@@ -613,7 +600,7 @@ at VERSION."
(string-drop file (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)))))