mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
import: Enable recursive import for texlive packages.
* guix/import/texlive.scm (tlpdb->package): Add VERSION argument; include explicit version field in output. (texlive->guix-package): Set default value for VERSION argument; adjust call of tlpdb->package. (texlive-recursive-import): Accept REPO and VERSION keyword arguments. * guix/import/utils.scm (package->definition): Add a clause to deal with output from tlpdb->package. * guix/scripts/import/texlive.scm (%options): Add "recursive" option. (guix-import-texlive): Honor "recursive" option. * doc/guix.texi (Using TeX and LaTeX): Mention "recursive" option.
This commit is contained in:
parent
22530b2645
commit
be7b314f3f
4 changed files with 46 additions and 11 deletions
|
@ -40965,6 +40965,16 @@ package, you can try and import it (@pxref{Invoking guix import}):
|
|||
guix import texlive @var{package}
|
||||
@end example
|
||||
|
||||
Additional options include:
|
||||
|
||||
@table @code
|
||||
@item --recursive
|
||||
@itemx -r
|
||||
Traverse the dependency graph of the given upstream package recursively
|
||||
and generate package expressions for all those packages that are not yet
|
||||
in Guix.
|
||||
@end table
|
||||
|
||||
@quotation Note
|
||||
@TeX{} Live packaging is still very much work in progress, but you can
|
||||
help! @xref{Contributing}, for more information.
|
||||
|
|
|
@ -246,7 +246,7 @@ (define name->parts (cut string-split <> #\/))
|
|||
;; entries with the same prefix.
|
||||
(lambda (x y) (every equal? x y)))))
|
||||
|
||||
(define (tlpdb->package name package-database)
|
||||
(define (tlpdb->package name version package-database)
|
||||
(and-let* ((data (assoc-ref package-database name))
|
||||
(dirs (files->directories
|
||||
(map (lambda (dir)
|
||||
|
@ -255,7 +255,9 @@ (define (tlpdb->package name package-database)
|
|||
(or (assoc-ref data 'runfiles) (list))
|
||||
(or (assoc-ref data 'srcfiles) (list))))))
|
||||
(name (guix-name name))
|
||||
(version (number->string %texlive-revision))
|
||||
;; TODO: we're ignoring the VERSION argument because that
|
||||
;; information is distributed across %texlive-tag and
|
||||
;; %texlive-revision.
|
||||
(ref (svn-multi-reference
|
||||
(url (string-append "svn://www.tug.org/texlive/tags/"
|
||||
%texlive-tag "/Master/texmf-dist"))
|
||||
|
@ -276,6 +278,9 @@ (define (tlpdb->package name package-database)
|
|||
(force-output port)
|
||||
(get-hash))))
|
||||
,@(if (assoc-ref data 'srcfiles) '() '(#:trivial? #true))))
|
||||
;; package->definition in (guix import utils) expects to see a
|
||||
;; version field.
|
||||
(version ,version)
|
||||
,@(or (and=> (assoc-ref data 'depend)
|
||||
(lambda (inputs)
|
||||
`((propagated-inputs
|
||||
|
@ -297,13 +302,18 @@ (define (tlpdb->package name package-database)
|
|||
|
||||
(define texlive->guix-package
|
||||
(memoize
|
||||
(lambda* (name #:key repo version (package-database tlpdb))
|
||||
(lambda* (name #:key
|
||||
repo
|
||||
(version (number->string %texlive-revision))
|
||||
(package-database tlpdb))
|
||||
"Find the metadata for NAME in the tlpdb and return the `package'
|
||||
s-expression corresponding to that package, or #f on failure."
|
||||
(tlpdb->package name (package-database)))))
|
||||
(tlpdb->package name version (package-database)))))
|
||||
|
||||
(define (texlive-recursive-import name)
|
||||
(define* (texlive-recursive-import name #:key repo version)
|
||||
(recursive-import name
|
||||
#:repo repo
|
||||
#:version version
|
||||
#:repo->guix-package texlive->guix-package
|
||||
#:guix-name guix-name))
|
||||
|
||||
|
|
|
@ -341,6 +341,8 @@ (define* (package->definition guix-package #:optional append-version?/string)
|
|||
(match guix-package
|
||||
((or
|
||||
('package ('name name) ('version version) . rest)
|
||||
('package ('inherit ('simple-texlive-package name . _))
|
||||
('version version) . rest)
|
||||
('let _ ('package ('name name) ('version version) . rest)))
|
||||
|
||||
`(define-public ,(string->symbol
|
||||
|
|
|
@ -22,11 +22,13 @@ (define-module (guix scripts import texlive)
|
|||
#:use-module (guix utils)
|
||||
#:use-module (guix scripts)
|
||||
#:use-module (guix import texlive)
|
||||
#:use-module (guix import utils)
|
||||
#:use-module (guix scripts import)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (srfi srfi-71)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-texlive))
|
||||
|
@ -58,6 +60,9 @@ (define %options
|
|||
(option '(#\V "version") #f #f
|
||||
(lambda args
|
||||
(show-version-and-exit "guix import texlive")))
|
||||
(option '(#\r "recursive") #f #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'recursive #t result)))
|
||||
%standard-import-options))
|
||||
|
||||
|
||||
|
@ -78,12 +83,20 @@ (define (parse-options)
|
|||
(_ #f))
|
||||
(reverse opts))))
|
||||
(match args
|
||||
((name)
|
||||
(let ((sexp (texlive->guix-package name)))
|
||||
((spec)
|
||||
(let ((name version (package-name->name+version spec)))
|
||||
(if (assoc-ref opts 'recursive)
|
||||
;; Recursive import
|
||||
(with-error-handling
|
||||
(map package->definition
|
||||
(filter identity (texlive-recursive-import name
|
||||
#:version version))))
|
||||
;; Single import
|
||||
(let ((sexp (texlive->guix-package name #:version version)))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to import package '~a'~%")
|
||||
(leave (G_ "failed to download description for package '~a'~%")
|
||||
name))
|
||||
sexp))
|
||||
sexp))))
|
||||
(()
|
||||
(leave (G_ "too few arguments~%")))
|
||||
((many ...)
|
||||
|
|
Loading…
Reference in a new issue