summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2023-06-06 13:49:00 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2023-07-18 18:12:55 +0200
commit5f51601bd90ae05547313a36cce590c26bd6a6b2 (patch)
tree60bddc05a8a7ffbe3cc3c03471a4c7ef6f3072e2 /tests
parentc769425a71c42113caced0ed497970fcb3ee70e1 (diff)
downloadguix-5f51601bd90ae05547313a36cce590c26bd6a6b2.tar.gz
guix: texlive importer ignores dependencies unnecessary in Guix.
* guix/import/texlive.scm (translate-depends): New function.
(tlpdb->package): Use new function.
* tests/texlive.scm (%fake-tlpdb): Add test data.
("texlive->guix-package, translate dependencies"):
("texlive->guix-package, lonely `hyphen-base' dependency and ARCH"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/texlive.scm83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/texlive.scm b/tests/texlive.scm
index 6633895ae1..975f36c1be 100644
--- a/tests/texlive.scm
+++ b/tests/texlive.scm
@@ -81,6 +81,12 @@
          .
          ("texmf-dist/tex/latex/chs-physics-report/chs-physics-report.sty"))
         (catalogue-license . "pd cc-by-sa-3")))
+    ("collection-basic"
+     (name . "collection-basic")
+     (shortdesc . "Essential programs and files")
+     (longdesc . "These files are regarded as basic...")
+     (depend "amsfonts" "hyph-utf8" "hyphen-base" "texlive-common"
+             "texlive.infra" "tlshell"))
     ("collection-texworks"
      (name . "collection-texworks")
      (shortdesc . "TeXworks editor...")
@@ -146,6 +152,17 @@ stuff like \\newcommand\\pi'12{\\pi '_{12}}.")
          . ("texmf-dist/tex/lualatex/stricttex/stricttex.lua"
             "texmf-dist/tex/lualatex/stricttex/stricttex.sty"))
         (catalogue-license . "lppl1.3c")))
+    ("tex"
+     (name . "tex")
+     (shortdesc . "A sophisticated typesetting engine")
+     (longdesc . "TeX is a typesetting system that incorporates...")
+     (depend "cm" "hyphen-base" "tex.ARCH")
+     (docfiles
+      "texmf-dist/doc/man/man1/initex.1"
+      "texmf-dist/doc/man/man1/initex.man1.pdf"
+      "texmf-dist/doc/man/man1/tex.1"
+      "texmf-dist/doc/man/man1/tex.man1.pdf")
+     (catalogue-license . "knuth"))
     ("texsis"
      . ((name
          . "texsis")
@@ -561,4 +578,70 @@ completely compatible with Plain TeX.")
                (format #t "~s~%" result)
                (pk 'fail result #f)))))))
 
+(test-assert "texlive->guix-package, translate dependencies"
+  ;; 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 "collection-basic"
+                                             #:package-database
+                                             (lambda _ %fake-tlpdb))))
+          (match result
+            (('package
+               ('name "texlive-collection-basic")
+               ('version _)
+               ('source _)
+               ('build-system 'texlive-build-system)
+               ('propagated-inputs
+                ('list 'texlive-amsfonts 'texlive-hyphen-complete))
+               ('home-page (? string?))
+               ('synopsis (? string?))
+               ('description (? string?))
+               ('license _))
+             #true)
+            (_
+             (begin
+               (format #t "~s~%" result)
+               (pk 'fail result #f)))))))
+
+(test-assert "texlive->guix-package, lonely `hyphen-base' dependency and ARCH"
+  ;; 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 "tex"
+                                             #:package-database
+                                             (lambda _ %fake-tlpdb))))
+          (match result
+            (('package
+               ('name "texlive-tex")
+               ('version _)
+               ('source _)
+               ('build-system 'texlive-build-system)
+               ('propagated-inputs
+                ('list 'texlive-cm 'texlive-hyphen-base))
+               ('home-page (? string?))
+               ('synopsis (? string?))
+               ('description (? string?))
+               ('license _))
+             #true)
+            (_
+             (begin
+               (format #t "~s~%" result)
+               (pk 'fail result #f)))))))
+
 (test-end "texlive")