summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2023-06-14 10:28:55 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2023-07-18 18:15:03 +0200
commitecc1c3af11724ff95439b044244e733c997b8211 (patch)
tree6c1c4c6696eb7a83185dc7c1aed7d1a37a8465f9 /guix
parent520551a59699e0c23c429a83a50be057f0160f5c (diff)
guix: texlive importer: Set #:texlive-latex-bin? when appropriate.
* guix/import/texlive.scm (latex-bin-dependency-tree): New function. (tlpdb->package): Set #:TEXLIVE-LATEX-BIN? when appropriate. * tests/texlive.scm ("texlive->guix-package, lonely `hyphen-base' dependency and ARCH"): Update test.
Diffstat (limited to 'guix')
-rw-r--r--guix/import/texlive.scm77
1 files changed, 56 insertions, 21 deletions
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index a39e327d45..5458a43456 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -241,6 +241,29 @@ When TEXLIVE-ONLY is true, only TeX Live packages are returned."
(loop all (record key value current field-type) key))))
(loop all current #false))))))))))))
+;; Packages listed below are used to build "latex-bin" package, and therefore
+;; cannot provide it automatically as a native input. Consequently, the
+;; importer sets TEXLIVE-LATEX-BIN? argument to #F for all of them.
+(define latex-bin-dependency-tree
+ (memoize
+ (lambda (package-database)
+ ;; Start out with "latex-bin", but also provide native inputs, which do
+ ;; not appear as dependents, as roots for the search.
+ (let loop ((packages
+ (list "latex-bin" "metafont" "modes" "tex"))
+ (deps '()))
+ (if (null? packages)
+ ;; `translate-depends' will always translate "hyphen-base" into
+ ;; "hyphen-complete". Make sure plain hyphen-base appears in the
+ ;; dependency tree.
+ (cons "hyphen-base" (translate-depends deps))
+ (loop (append-map (lambda (name)
+ (let ((data (assoc-ref package-database name)))
+ (or (assoc-ref data 'depend)
+ '())))
+ packages)
+ (append packages deps)))))))
+
(define* (files-differ? directory package-name
#:key
(package-database tlpdb)
@@ -310,6 +333,7 @@ of those files are returned that are unexpectedly installed."
(append (or (assoc-ref data 'docfiles) (list))
(or (assoc-ref data 'runfiles) (list))
(or (assoc-ref data 'srcfiles) (list))))))
+ (texlive-name name)
(name (guix-name name))
;; TODO: we're ignoring the VERSION argument because that
;; information is distributed across %texlive-tag and
@@ -345,27 +369,38 @@ of those files are returned that are unexpectedly installed."
(build-system ,(if meta-package?
'trivial-build-system
'texlive-build-system))
- ;; Translate AddFormat execute actions into a `#:create-formats'
- ;; argument.
- ,@(cond
- (meta-package? '((arguments (list #:builder #~(mkdir #$output)))))
- ((and-let* ((actions (assoc-ref data 'execute))
- (formats
- (delete-duplicates
- (filter-map
- (lambda (action)
- (match (string-split action #\space)
- (("AddFormat" name . _)
- (string-drop name (string-length "name=")))
- (  #f)))
- actions)))
- ((not (null? formats))))
- formats)
- =>
- (lambda (formats)
- `((arguments
- (list #:create-formats #~(list ,@(reverse formats)))))))
- (else '()))
+ ,@(if meta-package?
+ '((arguments (list #:builder #~(mkdir #$output))))
+ (let* ((formats
+ ;; Translate AddFormat execute actions into
+ ;; a #:create-formats argument.
+ (and-let*
+ ((actions (assoc-ref data 'execute))
+ (formats
+ (delete-duplicates
+ (filter-map
+ (lambda (action)
+ (match (string-split action #\space)
+ (("AddFormat" fmt . _)
+ (string-drop fmt (string-length "name=")))
+ (_ #f)))
+ actions)))
+ ((pair? formats)))
+ (reverse formats)))
+ ;; Check if setting #:texlive-latex-bin? is appropriate.
+ (latex-bin-dependency?
+ (member texlive-name
+ (latex-bin-dependency-tree package-database)))
+ (arguments
+ (append (if latex-bin-dependency?
+ '(#:texlive-latex-bin? #f)
+ '())
+ (if formats
+ `(#:create-formats #~(list ,@formats))
+ '()))))
+ (if (pair? arguments)
+ `((arguments (list ,@arguments)))
+ '())))
;; Texlive build system generates font metrics whenever a font
;; metrics file has the same base name as a Metafont file.
,@(or (and-let* ((runfiles (assoc-ref data 'runfiles))