elpa.scm 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
  3. ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (test-elpa)
  21. #:use-module (guix import elpa)
  22. #:use-module (guix tests http)
  23. #:use-module (srfi srfi-1)
  24. #:use-module (srfi srfi-64)
  25. #:use-module (ice-9 match)
  26. #:use-module (web client))
  27. (define elpa-mock-archive
  28. '(1
  29. (ace-window .
  30. [(0 9 0)
  31. ((avy
  32. (0 2 0)))
  33. "Quickly switch windows." single
  34. ((:url . "https://github.com/abo-abo/ace-window")
  35. (:keywords "window" "location"))])
  36. (auctex .
  37. [(11 88 6)
  38. nil "Integrated environment for *TeX*" tar
  39. ((:url . "http://www.gnu.org/software/auctex/"))])))
  40. (test-begin "elpa")
  41. (define (eval-test-with-elpa pkg)
  42. ;; Set up an HTTP server and use it as a pseudo-proxy so that
  43. ;; 'elpa->guix-package' talks to it.
  44. (with-http-server `((200 ,(object->string elpa-mock-archive))
  45. (200 "This is the description.")
  46. (200 "fake tarball contents"))
  47. (parameterize ((current-http-proxy (%local-url)))
  48. (match (elpa->guix-package pkg #:repo 'gnu/http)
  49. (('package
  50. ('name "emacs-auctex")
  51. ('version "11.88.6")
  52. ('source
  53. ('origin
  54. ('method 'url-fetch)
  55. ('uri ('string-append
  56. "http://elpa.gnu.org/packages/auctex-" 'version ".tar"))
  57. ('sha256 ('base32 (? string? hash)))))
  58. ('build-system 'emacs-build-system)
  59. ('home-page "http://www.gnu.org/software/auctex/")
  60. ('synopsis "Integrated environment for *TeX*")
  61. ('description "This is the description.")
  62. ('license 'license:gpl3+))
  63. #t)
  64. (x
  65. (pk 'fail x #f))))))
  66. (test-assert "elpa->guix-package test 1"
  67. (eval-test-with-elpa "auctex"))
  68. (test-end "elpa")
  69. ;; Local Variables:
  70. ;; eval: (put 'with-http-server 'scheme-indent-function 1)
  71. ;; End: