texlive.scm 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (test-texlive)
  19. #:use-module (gnu packages tex)
  20. #:use-module (guix import texlive)
  21. #:use-module (guix tests)
  22. #:use-module (guix tests http)
  23. #:use-module (guix build utils)
  24. #:use-module (srfi srfi-1)
  25. #:use-module (srfi srfi-64)
  26. #:use-module (srfi srfi-26)
  27. #:use-module (web client)
  28. #:use-module (ice-9 match))
  29. (test-begin "texlive")
  30. (define xml
  31. "\
  32. <entry id=\"foo\">
  33. <name>foo</name>
  34. <caption>Foomatic frobnication in LuaLaTeX</caption>
  35. <authorref id=\"rekado\"/>
  36. <license type=\"lppl1.3\"/>
  37. <version number=\"2.6a\"/>
  38. <description>
  39. <p>
  40. Foo is a package for LuaLaTeX. It provides an interface to frobnicate gimbals
  41. in a foomatic way with the LuaTeX engine.
  42. </p>
  43. <p>
  44. The package requires the bar and golly
  45. bundles for extremely special specialties.
  46. </p>
  47. </description>
  48. <ctan path=\"/macros/latex/contrib/foo\" file=\"true\"/>
  49. <texlive location=\"foo\"/>
  50. <keyval key=\"topic\" value=\"tests\"/>
  51. null
  52. </entry>")
  53. (define sxml
  54. '(*TOP* (entry (@ (id "foo"))
  55. (name "foo")
  56. (caption "Foomatic frobnication in LuaLaTeX")
  57. (authorref (@ (id "rekado")))
  58. (license (@ (type "lppl1.3")))
  59. (version (@ (number "2.6a")))
  60. (description
  61. (p "\n Foo is a package for LuaLaTeX. It provides an interface to frobnicate gimbals\n in a foomatic way with the LuaTeX engine.\n ")
  62. (p "\n The package requires the bar and golly\n bundles for extremely special specialties.\n "))
  63. (ctan (@ (path "/macros/latex/contrib/foo") (file "true")))
  64. (texlive (@ (location "foo")))
  65. (keyval (@ (value "tests") (key "topic")))
  66. "\n null\n")))
  67. ;; Avoid collisions with other tests.
  68. (%http-server-port 10200)
  69. (test-equal "fetch-sxml: returns SXML for valid XML"
  70. sxml
  71. (with-http-server `((200 ,xml))
  72. (parameterize ((current-http-proxy (%local-url)))
  73. (fetch-sxml "foo"))))
  74. ;; TODO:
  75. (test-assert "sxml->package"
  76. ;; Replace network resources with sample data.
  77. (mock ((guix build svn) svn-fetch
  78. (lambda* (url revision directory
  79. #:key (svn-command "svn")
  80. (user-name #f)
  81. (password #f))
  82. (mkdir-p directory)
  83. (with-output-to-file (string-append directory "/foo")
  84. (lambda ()
  85. (display "source")))))
  86. (let ((result (sxml->package sxml)))
  87. (match result
  88. (('package
  89. ('name "texlive-latex-foo")
  90. ('version "2.6a")
  91. ('source ('origin
  92. ('method 'svn-fetch)
  93. ('uri ('texlive-ref "latex" "foo"))
  94. ('sha256
  95. ('base32
  96. (? string? hash)))))
  97. ('build-system 'texlive-build-system)
  98. ('arguments ('quote (#:tex-directory "latex/foo")))
  99. ('home-page "http://www.ctan.org/pkg/foo")
  100. ('synopsis "Foomatic frobnication in LuaLaTeX")
  101. ('description
  102. "Foo is a package for LuaLaTeX. It provides an interface to \
  103. frobnicate gimbals in a foomatic way with the LuaTeX engine. The package \
  104. requires the bar and golly bundles for extremely special specialties.")
  105. ('license 'lppl1.3+))
  106. #t)
  107. (_
  108. (begin
  109. (format #t "~s\n" result)
  110. (pk 'fail result #f)))))))
  111. (test-end "texlive")