guix: import: Fix multiple licenses output in texlive importer.
* guix/import/texlive.scm (string->license): Add missing case and try first to split license strings before giving up. * tests/texlive.scm (%fake-tlpdb): Add test data. ("texlive->guix-package, multiple licenses"): New test.
parent
308b3e83c3
commit
3fc925aa84
|
@ -109,7 +109,8 @@
|
||||||
("cc-by-nc-nd-2.5" 'non-free)
|
("cc-by-nc-nd-2.5" 'non-free)
|
||||||
("cc-by-nc-nd-3" 'non-free)
|
("cc-by-nc-nd-3" 'non-free)
|
||||||
("cc-by-nc-nd-4" 'non-free)
|
("cc-by-nc-nd-4" 'non-free)
|
||||||
((x) (string->license x))
|
((? string? x) (string->license (string-split x #\space)))
|
||||||
|
((x) `(error unknown-license ,x))
|
||||||
((lst ...) `(list ,@(map string->license lst)))
|
((lst ...) `(list ,@(map string->license lst)))
|
||||||
(x `(error unknown-license ,x))))
|
(x `(error unknown-license ,x))))
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,18 @@
|
||||||
(runfiles
|
(runfiles
|
||||||
. ("texmf-dist/tex/latex/12many/12many.sty"))
|
. ("texmf-dist/tex/latex/12many/12many.sty"))
|
||||||
(catalogue-license . "lppl")))
|
(catalogue-license . "lppl")))
|
||||||
|
("chs-physics-report"
|
||||||
|
. ((name . "ch-physics-report")
|
||||||
|
(shortdesc . "Physics lab reports...")
|
||||||
|
(longdesc . "This package may...")
|
||||||
|
(docfiles
|
||||||
|
.
|
||||||
|
("texmf-dist/doc/latex/chs-physics-report/README.txt"
|
||||||
|
"texmf-dist/doc/latex/chs-physics-report/chs-physics-report.pdf"))
|
||||||
|
(runfiles
|
||||||
|
.
|
||||||
|
("texmf-dist/tex/latex/chs-physics-report/chs-physics-report.sty"))
|
||||||
|
(catalogue-license . "pd cc-by-sa-3")))
|
||||||
("example"
|
("example"
|
||||||
. ((name . "example")
|
. ((name . "example")
|
||||||
(shortdesc . "Typeset examples...")
|
(shortdesc . "Typeset examples...")
|
||||||
|
@ -302,4 +314,40 @@ completely compatible with Plain TeX.")
|
||||||
(format #t "~s~%" result)
|
(format #t "~s~%" result)
|
||||||
(pk 'fail result #f)))))))
|
(pk 'fail result #f)))))))
|
||||||
|
|
||||||
|
(test-assert "texlive->guix-package, multiple licenses"
|
||||||
|
;; 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 "chs-physics-report"
|
||||||
|
#:package-database
|
||||||
|
(lambda _ %fake-tlpdb))))
|
||||||
|
(match result
|
||||||
|
(('package
|
||||||
|
('name "texlive-chs-physics-report")
|
||||||
|
('version _)
|
||||||
|
('source ('texlive-origin
|
||||||
|
'name 'version
|
||||||
|
('list "doc/latex/chs-physics-report/"
|
||||||
|
"tex/latex/chs-physics-report/")
|
||||||
|
('base32 (? string? hash))))
|
||||||
|
('outputs ''("out" "doc"))
|
||||||
|
('build-system 'texlive-build-system)
|
||||||
|
('home-page (? string?))
|
||||||
|
('synopsis (? string?))
|
||||||
|
('description (? string?))
|
||||||
|
('license ('list 'public-domain 'cc-by-sa3.0)))
|
||||||
|
#true)
|
||||||
|
(_
|
||||||
|
(begin
|
||||||
|
(format #t "~s~%" result)
|
||||||
|
(pk 'fail result #f)))))))
|
||||||
|
|
||||||
(test-end "texlive")
|
(test-end "texlive")
|
||||||
|
|
Reference in New Issue