me
/
guix
Archived
1
0
Fork 0

guix: import: Update texlive importer according to new build system.

* guix/import/texlive.scm (tlpdb->package): Generate a package that doesn't
need SIMPLE-TEXLIVE-PACKAGE.
* guix/import/utils.scm (package->definition): Remove special case for
`simple-texlive-package'.
* tests/texlive.scm (%fake-tlpdb): Add test data.
("texlive->guix-package"): Update test.
("texlive->guix-package, no docfiles"): New test.
Nicolas Goaziou 2023-05-05 17:22:03 +02:00
parent bc3384923e
commit 4a245129ff
No known key found for this signature in database
GPG Key ID: DA00B4F048E92F2D
3 changed files with 89 additions and 42 deletions

View File

@ -275,33 +275,37 @@ of those files are returned that are unexpectedly installed."
store ref (string-append name "-svn-multi-checkout"))))) store ref (string-append name "-svn-multi-checkout")))))
(values (values
`(package `(package
(inherit (simple-texlive-package (name ,name)
,name (version (number->string %texlive-revision))
(list ,@dirs) (source (texlive-origin
(base32 name version
,(bytevector->nix-base32-string (list ,@(sort locs string<))
(let-values (((port get-hash) (open-sha256-port))) (base32
(write-file source port) ,(bytevector->nix-base32-string
(force-output port) (let-values (((port get-hash) (open-sha256-port)))
(get-hash)))) (write-file source port)
,@(if (assoc-ref data 'srcfiles) '() '(#:trivial? #true)))) (force-output port)
;; package->definition in (guix import utils) expects to see a (get-hash))))))
;; version field. ,@(if (assoc-ref data 'docfiles)
(version ,version) '((outputs '("out" "doc")))
'())
(build-system texlive-build-system)
,@(match filtered-depends ,@(match filtered-depends
(() '()) (() '())
(inputs (inputs
`((propagated-inputs `((propagated-inputs
(list ,@(map (list ,@(map-in-order
(lambda (tex-name) (lambda (tex-name)
(let ((name (guix-name tex-name))) (let ((name (guix-name tex-name)))
(string->symbol name))) (string->symbol name)))
inputs)))))) ;; Sort inputs alphabetically.
,@(or (and=> (assoc-ref data 'name) (reverse inputs)))))))
(home-page
,(or (and=> (or (assoc-ref data 'catalogue)
(assoc-ref data 'name))
(lambda (name) (lambda (name)
`((home-page ,(string-append "https://ctan.org/pkg/" (string-append "https://ctan.org/pkg/" name)))
name))))) "https://www.tug.org/texlive/"))
'((home-page "https://www.tug.org/texlive/")))
(synopsis ,(assoc-ref data 'shortdesc)) (synopsis ,(assoc-ref data 'shortdesc))
(description ,(and=> (assoc-ref data 'longdesc) beautify-description)) (description ,(and=> (assoc-ref data 'longdesc) beautify-description))
(license ,(and=> (assoc-ref data 'catalogue-license) (license ,(and=> (assoc-ref data 'catalogue-license)

View File

@ -436,10 +436,7 @@ APPEND-VERSION?/string is a string, append this string."
(match guix-package (match guix-package
((or ((or
('package ('name name) ('version version) . rest) ('package ('name name) ('version version) . rest)
('package ('inherit ('simple-texlive-package name . _))
('version version) . rest)
('let _ ('package ('name name) ('version version) . rest))) ('let _ ('package ('name name) ('version version) . rest)))
`(define-public ,(string->symbol `(define-public ,(string->symbol
(cond (cond
((string? append-version?/string) ((string? append-version?/string)

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2022 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -31,7 +32,15 @@
(test-begin "texlive") (test-begin "texlive")
(define %fake-tlpdb (define %fake-tlpdb
'(("stricttex" '(("example"
. ((name . "example")
(shortdesc . "Typeset examples...")
(longdesc . "The package makes it easier...")
(runfiles
.
("texmf-dist/tex/latex/example/example.sty"))
(catalogue-license . "gpl")))
("stricttex"
. ((name . ((name
. "stricttex") . "stricttex")
(shortdesc (shortdesc
@ -69,7 +78,7 @@ theorems and proofs, centered or non-justified text, and listing computer
code; Specialized macros for easily constructing ruled tables. TeXsis was code; Specialized macros for easily constructing ruled tables. TeXsis was
originally developed for physicists, but others may also find it useful. It is originally developed for physicists, but others may also find it useful. It is
completely compatible with Plain TeX.") completely compatible with Plain TeX.")
(depend . ("cm" "hyphen-base" "knuth-lib" "plain" "tex")) (depend . ("tex" "plain" "knuth-lib" "hyphen-base" "cm"))
(docfiles (docfiles
. ("texmf-dist/doc/man/man1/texsis.1" . ("texmf-dist/doc/man/man1/texsis.1"
"texmf-dist/doc/man/man1/texsis.man1.pdf" "texmf-dist/doc/man/man1/texsis.man1.pdf"
@ -158,6 +167,40 @@ completely compatible with Plain TeX.")
"texmf-dist/tex/texsis/config/texsis.ini")) "texmf-dist/tex/texsis/config/texsis.ini"))
(catalogue-license . "lppl"))))) (catalogue-license . "lppl")))))
(test-assert "texlive->guix-package, no docfiles"
;; Replace network resources with sample data.
(mock ((guix build svn) svn-fetch
(lambda* (url revision directory
#:key (svn-command "svn")
(user-name #f)
(password #f)
(recursive? #t))
(mkdir-p directory)
(with-output-to-file (string-append directory "/foo")
(lambda ()
(display "source")))))
(let ((result (texlive->guix-package "example"
#:package-database
(lambda _ %fake-tlpdb))))
(match result
(('package
('name "texlive-example")
('version _)
('source ('texlive-origin
'name 'version
('list "tex/latex/example/")
('base32 (? string? hash))))
('build-system 'texlive-build-system)
('home-page (? string?))
('synopsis (? string?))
('description (? string?))
('license _))
#true)
(_
(begin
(format #t "~s~%" result)
(pk 'fail result #f)))))))
(test-assert "texlive->guix-package" (test-assert "texlive->guix-package"
;; Replace network resources with sample data. ;; Replace network resources with sample data.
(mock ((guix build svn) svn-fetch (mock ((guix build svn) svn-fetch
@ -174,27 +217,30 @@ completely compatible with Plain TeX.")
#:package-database #:package-database
(lambda _ %fake-tlpdb)))) (lambda _ %fake-tlpdb))))
(match result (match result
(`(package (('package
(inherit (simple-texlive-package ('name "texlive-texsis")
"texlive-texsis" ('version _)
(list "bibtex/bst/texsis/" ('source ('texlive-origin
"doc/man/man1/" 'name 'version
('list "bibtex/bst/texsis/"
"doc/man/man1/texsis.1"
"doc/man/man1/texsis.man1.pdf"
"doc/otherformats/texsis/base/" "doc/otherformats/texsis/base/"
"tex/texsis/base/" "tex/texsis/base/"
"tex/texsis/config/") "tex/texsis/config/")
(base32 ,(? string? hash)) ('base32 (? string? hash))))
#:trivial? #t)) ('outputs ''("out" "doc"))
(version ,_) ('build-system 'texlive-build-system)
(propagated-inputs ('propagated-inputs
(list texlive-cm ('list 'texlive-cm
texlive-hyphen-base 'texlive-hyphen-base
texlive-knuth-lib 'texlive-knuth-lib
texlive-plain 'texlive-plain
texlive-tex)) 'texlive-tex))
(home-page ,(? string?)) ('home-page (? string?))
(synopsis ,(? string?)) ('synopsis (? string?))
(description ,(? string?)) ('description (? string?))
(license lppl)) ('license 'lppl))
#true) #true)
(_ (_
(begin (begin