aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2020, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-elpa)
  #:use-module (guix import elpa)
  #:use-module (guix upstream)
  #:use-module ((guix download) #:select (url-fetch))
  #:use-module (guix tests)
  #:use-module (guix tests http)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match)
  #:use-module (web client))

(define elpa-mock-archive
  '(1
    (ace-window .
                [(0 9 0)
                 ((avy
                   (0 2 0)))
                 "Quickly switch windows." single
                 ((:url . "https://github.com/abo-abo/ace-window")
                  (:keywords "window" "location"))])
    (auctex .
            [(11 88 6)
             nil "Integrated environment for *TeX*" tar
             ((:url . "http://www.gnu.org/software/auctex/"))])
    (fake-taxy-magit-section .
		             [(0 12 2)
		              ((emacs
			        (26 3))
		               (magit-section
			        (3 2 1))
		               (taxy
			        (0 10)))
		              "View Taxy structs in a Magit Section buffer" tar
		              ((:url . "https://github.com/alphapapa/taxy.el")
		               (:keywords "lisp"))])))


(test-begin "elpa")

(define (eval-test-with-elpa pkg)
  ;; Set up an HTTP server and use it as a pseudo-proxy so that
  ;; 'elpa->guix-package' talks to it.
  (with-http-server `((200 ,(object->string elpa-mock-archive))
                      (200 "This is the description.")
                      (200 "fake tarball contents"))
    (parameterize ((current-http-proxy (%local-url)))
      (match (elpa->guix-package pkg #:repo 'gnu/http)
        (`(package
            (name "emacs-auctex")
            (version "11.88.6")
            (source
             (origin
               (method url-fetch)
               (uri (string-append
                     "http://elpa.gnu.org/packages/auctex-" version ".tar"))
               (sha256 (base32 ,(? string? hash)))))
            (build-system emacs-build-system)
            (home-page "http://www.gnu.org/software/auctex/")
            (synopsis "Integrated environment for *TeX*")
            (description "This is the description.")
            (license license:gpl3+))
         #t)
        (x
         (pk 'fail x #f))))))

(test-assert "elpa->guix-package test 1"
  (eval-test-with-elpa "auctex"))

(test-equal "package-latest-release"
  (list '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar")
        '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar.sig")
        (list (upstream-input
               (name "magit-section")
               (downstream-name "emacs-magit-section")
               (type 'propagated)
               (min-version "3.2.1")
               (max-version min-version))
              (upstream-input
               (name "taxy")
               (downstream-name "emacs-taxy")
               (type 'propagated)
               (min-version "0.10")
               (max-version #f))))
  (with-http-server `((200 ,(object->string elpa-mock-archive)))
    (parameterize ((current-http-proxy (%local-url)))
      (define source
        ;; Note: Use 'http' URLs to the proxy is used.
        (package-latest-release
         (dummy-package "emacs-fake-taxy-magit-section"
                        (version "0.0.0")
                        (source (dummy-origin
                                 (method url-fetch)
                                 (uri "http://elpa.gnu.org/xyz"))))
         (list %elpa-updater)))

      (list (upstream-source-urls source)
            (upstream-source-signature-urls source)
            (upstream-source-inputs source)))))

(test-equal "guix-package->elpa-name: without 'upstream-name' property"
  "auctex"
  (guix-package->elpa-name (dummy-package "emacs-auctex")))

(test-equal "guix-package->elpa-name: with 'upstream-name' property"
  "project"
  (guix-package->elpa-name
   (dummy-package "emacs-fake-name"
     (properties '((upstream-name . "project"))))))

(test-end "elpa")

;; Local Variables:
;; eval: (put 'with-http-server 'scheme-indent-function 1)
;; End:
ter.Ludovic Courtès * guix/git.scm (auth-supported?): Remove. (clone*): Inline code that was dependent on AUTH-SUPPORTED?. (update-cached-checkout): Likewise. (resolve-reference): Remove check for 'object-lookup-prefix' and use it unconditionally. (load-git-submodules): Remove. (update-submodules): Use 'repository-submodules', 'submodule-lookup', etc. unconditionally. (update-cached-checkout): Use 'repository-close!' unconditionally. * m4/guix.m4 (GUIX_CHECK_GUILE_GIT): New macro. * configure.ac: Use it and error out when it fails. * doc/guix.texi (Requirements): Bump to Guile-Git 0.3.0. 2020-09-08Remove (guix json) and require Guile-JSON 4.3.0+.Ludovic Courtès This is a followup to 4071879c86d059ee087c8986915ea72b8c742b72. * guix/json.scm: Remove. * Makefile.am (MODULES): Adjust accordingly. * m4/guix.m4 (GUIX_CHECK_GUILE_JSON): Check for 'define-json-mapping'. * doc/guix.texi (Requirements): Require Guile-JSON 4.3.0+. * guix/ci.scm, guix/cve.scm, guix/import/cpan.scm, guix/import/crate.scm, guix/swh.scm: Remove (guix json) import. * guix/import/gem.scm, guix/import/pypi.scm: Likewise, and import (json). * guix/self.scm (specification->package): Switch to GUILE-JSON-4. * guix/git-download.scm (git-fetch): Likewise. 2020-08-29build: Remove check for Guile 2.2.1 bug.Ludovic Courtès This check is unnecessary since e688c2df3924423b67892cc9939ca099c729d1cb. * m4/guix.m4 (GUIX_ASSERT_SYNTAX_OBJECT_EQUAL): Remove. * configure.ac: Remove user. 2020-08-24Use "guile-zlib" and "guile-lzlib" instead of (guix config).Mathieu Othacehe * Makefile.am (MODULES): Remove guix/zlib.scm and guix/lzlib.scm, (SCM_TESTS): remove tests/zlib.scm, tests/lzlib.scm. * build-aux/build-self.scm (make-config.scm): Remove unused %libz variable. * configure.ac: Remove LIBZ and LIBLZ variables and check instead for Guile-zlib and Guile-lzlib. * doc/guix.texi ("Requirements"): Remove zlib requirement and add Guile-zlib and Guile-lzlib instead. * gnu/packages/package-management.scm (guix)[native-inputs]: Add "guile-zlib" and "guile-lzlib", [inputs]: remove "zlib" and "lzlib", [propagated-inputs]: ditto, [arguments]: add "guile-zlib" and "guile-lzlib" to Guile load path. * guix/config.scm.in (%libz, %liblz): Remove them. * guix/lzlib.scm: Remove it. * guix/man-db.scm: Use (zlib) instead of (guix zlib). * guix/profiles.scm (manual-database): Do not stub (guix config) in imported modules list, instead add "guile-zlib" to the extension list. * guix/scripts/publish.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), (string->compression-type, effective-compression): do not check for zlib and lzlib availability. * guix/scripts/substitute.scm (%compression-methods): Do not check for lzlib availability. * guix/self.scm (specification->package): Add "guile-zlib" and "guile-lzlib" and remove "zlib" and "lzlib", (compiled-guix): remove "zlib" and "lzlib" arguments and add guile-zlib and guile-lzlib to the dependencies, also do not pass "zlib" and "lzlib" to "make-config.scm" procedure, (make-config.scm): remove "zlib" and "lzlib" arguments as well as %libz and %liblz variables. * guix/utils.scm (lzip-port): Use (lzlib) instead of (guix lzlib) and do not check for lzlib availability. * guix/zlib.scm: Remove it. * m4/guix.m4 (GUIX_LIBZ_LIBDIR, GUIX_LIBLZ_FILE_NAME): Remove them. * tests/lzlib.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), and do not check for zlib and lzlib availability. * tests/publish.scm: Ditto. * tests/substitute.scm: Do not check for lzlib availability. * tests/utils.scm: Ditto. * tests/zlib.scm: Remove it. 2020-07-20ssh: Speed up RPCs by using #:nodelay.Lars-Dominik Braun Partly fixes <https://bugs.gnu.org/41702>. * guix/ssh.scm (open-ssh-session): Enable #:nodelay. * m4/guix.m4 (GUIX_CHECK_GUILE_SSH): Add feature check for this new parameter. * doc/guix.texi (Requirements): Adjust. Co-authored-by: Ludovic Courtès <ludo@gnu.org> 2020-05-28doc: Remove explicit support for mips64el-linux.Efraim Flashner It's been a good run, but no one is maintaining the architecture. So long, and thanks for all the fish. * doc/guix.texi (GNU Distribution): Change text for mips64el-linux to denote it is deprecated. (Daemon Offload Setup): Change occurrences of mips64el-linux to aarch64-linux and adjust local code snippets. (Guix Environment)[cross-compilation]: Change mips64el-linux-gnu to aarch64-linux-gnu. (GNU Build System)(package-cross-derivation]: Same. (G-Expressions)[cross compilation]: Same. (Additional Build Options)[cross-compilation, build logs]: Same. (qemu-binfmt-service-type): Remove mips64el. * doc/contributing.texi (Submitting Patches): Same. * m4/guix.m4: (GUIX_ASSERT_SUPPORTED_SYSTEM): Remove mips64el-linux. 2020-05-28maint: Check whether Guile-Gcrypt is recent enough.Ludovic Courtès Suggested by Danny Milosavljevic <dannym@scratchpost.org> in <https://bugs.gnu.org/41494>. * m4/guix.m4 (GUIX_CHECK_GUILE_GCRYPT): New macro. * configure.ac: Use it. 2020-02-22build: Depend on guile-ssh 0.12.0Lars-Dominik Braun This is a followup to 35f35111678e6622301b414f3d464acb71e106bb. * m4/guix.m4 (GUIX_CHECK_GUILE_SSH): Check for userauth-gssapi! * doc/guix.texi: Document version requirement Signed-off-by: Ludovic Courtès <ludo@gnu.org>