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.
parent
520551a596
commit
ecc1c3af11
|
@ -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 (record key value current field-type) key))))
|
||||||
(loop all current #false))))))))))))
|
(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
|
(define* (files-differ? directory package-name
|
||||||
#:key
|
#:key
|
||||||
(package-database tlpdb)
|
(package-database tlpdb)
|
||||||
|
@ -310,6 +333,7 @@ of those files are returned that are unexpectedly installed."
|
||||||
(append (or (assoc-ref data 'docfiles) (list))
|
(append (or (assoc-ref data 'docfiles) (list))
|
||||||
(or (assoc-ref data 'runfiles) (list))
|
(or (assoc-ref data 'runfiles) (list))
|
||||||
(or (assoc-ref data 'srcfiles) (list))))))
|
(or (assoc-ref data 'srcfiles) (list))))))
|
||||||
|
(texlive-name name)
|
||||||
(name (guix-name name))
|
(name (guix-name name))
|
||||||
;; TODO: we're ignoring the VERSION argument because that
|
;; TODO: we're ignoring the VERSION argument because that
|
||||||
;; information is distributed across %texlive-tag and
|
;; 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?
|
(build-system ,(if meta-package?
|
||||||
'trivial-build-system
|
'trivial-build-system
|
||||||
'texlive-build-system))
|
'texlive-build-system))
|
||||||
;; Translate AddFormat execute actions into a `#:create-formats'
|
,@(if meta-package?
|
||||||
;; argument.
|
'((arguments (list #:builder #~(mkdir #$output))))
|
||||||
,@(cond
|
(let* ((formats
|
||||||
(meta-package? '((arguments (list #:builder #~(mkdir #$output)))))
|
;; Translate AddFormat execute actions into
|
||||||
((and-let* ((actions (assoc-ref data 'execute))
|
;; a #:create-formats argument.
|
||||||
(formats
|
(and-let*
|
||||||
(delete-duplicates
|
((actions (assoc-ref data 'execute))
|
||||||
(filter-map
|
(formats
|
||||||
(lambda (action)
|
(delete-duplicates
|
||||||
(match (string-split action #\space)
|
(filter-map
|
||||||
(("AddFormat" name . _)
|
(lambda (action)
|
||||||
(string-drop name (string-length "name=")))
|
(match (string-split action #\space)
|
||||||
( #f)))
|
(("AddFormat" fmt . _)
|
||||||
actions)))
|
(string-drop fmt (string-length "name=")))
|
||||||
((not (null? formats))))
|
(_ #f)))
|
||||||
formats)
|
actions)))
|
||||||
=>
|
((pair? formats)))
|
||||||
(lambda (formats)
|
(reverse formats)))
|
||||||
`((arguments
|
;; Check if setting #:texlive-latex-bin? is appropriate.
|
||||||
(list #:create-formats #~(list ,@(reverse formats)))))))
|
(latex-bin-dependency?
|
||||||
(else '()))
|
(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
|
;; Texlive build system generates font metrics whenever a font
|
||||||
;; metrics file has the same base name as a Metafont file.
|
;; metrics file has the same base name as a Metafont file.
|
||||||
,@(or (and-let* ((runfiles (assoc-ref data 'runfiles))
|
,@(or (and-let* ((runfiles (assoc-ref data 'runfiles))
|
||||||
|
|
|
@ -633,6 +633,7 @@ completely compatible with Plain TeX.")
|
||||||
('source _)
|
('source _)
|
||||||
('outputs _)
|
('outputs _)
|
||||||
('build-system 'texlive-build-system)
|
('build-system 'texlive-build-system)
|
||||||
|
('arguments ('list '#:texlive-latex-bin? #f))
|
||||||
('propagated-inputs
|
('propagated-inputs
|
||||||
('list 'texlive-cm 'texlive-hyphen-base))
|
('list 'texlive-cm 'texlive-hyphen-base))
|
||||||
('home-page (? string?))
|
('home-page (? string?))
|
||||||
|
|
Reference in New Issue