summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2024-06-01 00:55:01 +0200
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:45:30 +0200
commitb4ce7359fbc74eeacc4c8e1c209b913a3ee3870b (patch)
tree2380dc3eee8824cb14723dd5b770fee3a5a418ad /tests
parent36c31674bfc3b227727005fa8eb0a421777fc44d (diff)
downloadguix-b4ce7359fbc74eeacc4c8e1c209b913a3ee3870b.tar.gz
guix: import texlive: Propagate binaries when necessary.
* guix/import/texlive.scm (no-bin-propagation-packages): New variable.
(list-binfiles): New function.
(linked-scripts): Renamed to...
(list-linked-scripts): ... this.  Now always return a list.
(tlpdb->package): Handle binary propagation.
* tests/texlive.scm (%fake-tlpdb): Add data for new tests.
("texlive->guix-package, propagated binaries, no script"):
("texlive->guix-package, propagated binaries and scripts"):
("texlive->guix-package, with skipped propagated binaries"): New tests.

Change-Id: I707ba33a10aa98ad27151724d3ecc4158db6b7cc
Diffstat (limited to 'tests')
-rw-r--r--tests/texlive.scm130
1 files changed, 128 insertions, 2 deletions
diff --git a/tests/texlive.scm b/tests/texlive.scm
index fac9faf714..bfd3f57f20 100644
--- a/tests/texlive.scm
+++ b/tests/texlive.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2022 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2023, 2024 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -162,6 +162,16 @@
       "texmf-dist/tex/lollipop/lollipop.ini"
       "texmf-dist/tex/lollipop/lollipop.tex")
      (catalogue-license . "gpl3"))
+    ("m-tx"
+     (name . "m-tx")
+     (shortdesc . "A preprocessor for pmx")
+     (longdesc . "M-Tx is a preprocessor to pmx")
+     (depend "m-tx.ARCH")
+     (runfiles "texmf-dist/scripts/m-tx/m-tx.lua"))
+    ("m-tx.x86_64-linux"
+     (name . "m-tx.x86_64-linux")
+     (binfiles "bin/x86_64-linux/m-tx"
+               "bin/x86_64-linux/prepmx"))
     ("pax"
      (name . "pax")
      (shortdesc . "Extract and reinsert PDF...")
@@ -329,7 +339,22 @@ completely compatible with Plain TeX.")
                "texmf-dist/fonts/tfm/public/trsym/trsy12.tfm"
                "texmf-dist/tex/latex/trsym/trsym.sty"
                "texmf-dist/tex/latex/trsym/utrsy.fd")
-     (catalogue-license . "lppl"))))
+     (catalogue-license . "lppl"))
+    ("vlna"
+     (name . "vlna")
+     (shortdesc . "Add ~ after non-syllabic preposition")
+     (longdesc . "Preprocessor for TeX source")
+     (depend "vlna.ARCH")
+     (docfiles "texmf-dist/doc/man/man1/vlna.1"))
+    ("vlna.x86_64-linux"
+     (shortdesc "x86_64-linux files of vlna")
+     (binfiles "bin/x86_64-linux/vlna"))
+    ("web"
+     (depend "web.ARCH")
+     (docfiles "texmf-dist/doc/man/man1/tangle.1"))
+    ("web.x86_64-linux"
+     (name . "web.x86_64-linux")
+     (binfiles "bin/x86_64-linux/tangle"))))
 
 (test-assert "texlive->guix-package, no docfiles"
   ;; Replace network resources with sample data.
@@ -798,4 +823,105 @@ completely compatible with Plain TeX.")
                (format #t "~s~%" result)
                (pk 'fail result #f)))))))
 
+(test-assert "texlive->guix-package, propagated binaries, no script"
+  ;; 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 "vlna"
+                                             #:package-database
+                                             (lambda _ %fake-tlpdb))))
+          (match result
+            (('package
+               ('name "texlive-vlna")
+               ('version _)
+               ('source _)
+               ('outputs _)
+               ('build-system 'texlive-build-system)
+               ('propagated-inputs
+                ('list 'texlive-vlna-bin))
+               ('home-page _)
+               ('synopsis _)
+               ('description _)
+               ('license _))
+             #true)
+            (_
+             (begin
+               (format #t "~s~%" result)
+               (pk 'fail result #f)))))))
+
+(test-assert "texlive->guix-package, propagated binaries and scripts"
+  ;; 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 "m-tx"
+                                             #:package-database
+                                             (lambda _ %fake-tlpdb))))
+          (match result
+            (('package
+               ('name "texlive-m-tx")
+               ('version _)
+               ('source _)
+               ('build-system 'texlive-build-system)
+               ('arguments
+                ('list '#:link-scripts ('gexp ('list "m-tx.lua"))))
+               ('propagated-inputs
+                ('list 'texlive-m-tx-bin))
+               ('home-page _)
+               ('synopsis _)
+               ('description _)
+               ('license _))
+             #true)
+            (_
+             (begin
+               (format #t "~s~%" result)
+               (pk 'fail result #f)))))))
+
+(test-assert "texlive->guix-package, with skipped propagated binaries"
+  ;; 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 "web"
+                                             #:package-database
+                                             (lambda _ %fake-tlpdb))))
+          (match result
+            (('package
+               ('name "texlive-web")
+               ('version _)
+               ('source _)
+               ('outputs _)
+               ('build-system 'texlive-build-system)
+               ('home-page _)
+               ('synopsis _)
+               ('description _)
+               ('license _))
+             #true)
+            (_
+             (begin
+               (format #t "~s~%" result)
+               (pk 'fail result #f)))))))
+
 (test-end "texlive")