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:
an title='2017-09-19 17:17:34 +0200'>2017-09-19doc: Add "Sending a Patch Series" subsection....Searching for `git send-email' took you to the end of `Submitting Patches' section which said You may use your email client or the ‘git send-email’ command. without further warning or remark. * doc/contributing.texi (Sending a Patch Series): Move information about debbugs bug 15361 to subsection. Add git-send-email index entries. (Submitting Patches): Reference it. Jan Nieuwenhuizen 2017-08-07Revert "doc: Suggest running guix-daemon with 'sudo -E'."...This change might not correct, so we revert it for now: https://lists.gnu.org/archive/html/guix-devel/2017-08/msg00057.html This reverts commit 6a4364335c967f841b53ed35c22f90445437e4b0. Leo Famulari 2017-08-06doc: Suggest running guix-daemon with 'sudo -E'....Suggested by Martin H. <maze@strahlungsfrei.de>. * doc/contributing.texi (Running Guix Before It Is Installed): Suggest 'sudo -E'. Ludovic Courtès 2017-07-20doc: Show the "git clone" command....Suggested by Joshua Branson <jbranso91@gmail.com>. * doc/contributing.texi (Building from Git): Add "git clone" command. Ludovic Courtès 2017-06-25doc: Encourage signature verification....* doc/contributing.texi (Submitting Patches): Remind contributors to verify cryptographic signatures. Ricardo Wurmus 2017-05-13doc: Document the branching and rebuild scheduling strategy....* doc/contributing.texi (Submitting Patches): Document the branching scheme. Ludovic Courtès 2017-05-04doc: Add references to Emacs-Guix manual....* doc/htmlxref.cnf: Add links to the real manual. * doc/contributing.texi (Formatting Code): Add reference to it. * doc/guix.texi (Package Management): Likewise. Alex Kost 2017-02-13doc: Update patch submission instructions....* doc/contributing.texi (Submitting Patches): Add paragraph on guix-patches@gnu.org. Ludovic Courtès 2017-01-13etc: Support indentation of whole files....* etc/indent-package.el.in: Rename to... * etc/indent-code.el.in: ... this. Add case for a single argument. * doc/contributing.texi (Formatting Code): Adjust accordingly. * configure.ac: Likewise. Ludovic Courtès 2017-01-12etc: Add 'indent-package.el' script....* configure.ac: Check for 'emacs', substitute 'EMACS', and emit 'etc/indent-package.el'. * etc/indent-package.el.in: New file. * doc/contributing.texi (Formatting Code): Mention 'etc/indent-package.el'. (Submitting Patches): Likewise, and link to the above node. Co-authored-by: Alex Kost <alezost@gmail.com> Ludovic Courtès 2016-12-29Remove Emacs interface....* emacs/guix-about.el: Remove file. * emacs/guix-backend.el: Likewise. * emacs/guix-base.el: Likewise. * emacs/guix-buffer.el: Likewise. * emacs/guix-build-log.el: Likewise. * emacs/guix-command.el: Likewise. * emacs/guix-config.el.in: Likewise. * emacs/guix-devel.el: Likewise. * emacs/guix-entry.el: Likewise. * emacs/guix-external.el: Likewise. * emacs/guix-geiser.el: Likewise. * emacs/guix-guile.el: Likewise. * emacs/guix-help-vars.el: Likewise. * emacs/guix-helper.scm.in: Likewise. * emacs/guix-history.el: Likewise. * emacs/guix-hydra-build.el: Likewise. * emacs/guix-hydra-jobset.el: Likewise. * emacs/guix-hydra.el: Likewise. * emacs/guix-info.el: Likewise. * emacs/guix-init.el: Likewise. * emacs/guix-license.el: Likewise. * emacs/guix-list.el: Likewise. * emacs/guix-location.el: Likewise. * emacs/guix-main.scm: Likewise. * emacs/guix-messages.el: Likewise. * emacs/guix-pcomplete.el: Likewise. * emacs/guix-popup.el: Likewise. * emacs/guix-prettify.el: Likewise. * emacs/guix-profiles.el: Likewise. * emacs/guix-read.el: Likewise. * emacs/guix-ui-generation.el: Likewise. * emacs/guix-ui-license.el: Likewise. * emacs/guix-ui-location.el: Likewise. * emacs/guix-ui-package.el: Likewise. * emacs/guix-ui-system-generation.el: Likewise. * emacs/guix-ui.el: Likewise. * emacs/guix-utils.el: Likewise. * emacs/local.mk: Likewise. * doc/emacs.texi: Likewise. * doc/guix.texi: Remove cross-references to Emacs nodes. (Package Management): Mention 'emacs-guix' package. * doc/contributing.texi (The Perfect Setup): Remove the reference. * doc/htmlxref.cnf: Add 'emacs-guix' URL. * Makefile.am: Remove Emacs stuff. * configure.ac: Likewise. * gnu/packages/package-management.scm (guix-0.12.0)[native-inputs]: Remove "emacs". [propagated-inputs]: Remove "geiser" and "emacs-magit-popup". Co-authored-by: Ludovic Courtès <ludo@gnu.org> Alex Kost 2016-12-14doc: Fix typo in Submitting Patches section....* doc/contributing.texi (Submitting Patches): Fix "could could" typo. Signed-off-by: Leo Famulari <leo@famulari.name> Maxim Cournoyer 2016-07-28doc: Discourage software bundling....Fixes <http://bugs.gnu.org/24008>. Suggested by ng0 <ng0@we.make.ritual.n0.is>. * doc/contributing.texi (Submitting Patches): Add item about bundling. Ludovic Courtès 2016-07-28doc: Send changes in your patch which are related....* doc/contributing.texi (Submitting Patches): New @item: This gives information about sending related changes and examples on what we view as related changes. Co-authored-by: Ludovic Courtès <ludo@gnu.org> ng0 2016-07-28doc: Mention separate branch for packages with many dependents....Suggested by ng0 <ng0@we.make.ritual.n0.is>. * doc/contributing.texi (Submitting Patches): Add note on packages with more than 100 dependents. Ludovic Courtès 2016-07-24doc: Point out preference of message format....* doc/contributing.texi (Submitting Patches): Includes a note on preference of plain text messages with either inline or MIME attachments and advise contributers to pay attention if their email client breaks the patches. Signed-off-by: Ludovic Courtès <ludo@gnu.org> ng0 2016-07-24doc: Explain that contributors can use a pseudonym....Suggested by ng0 <ng0@we.make.ritual.n0.is>. * doc/contributing.texi (Contributing): Explain that using a legal name is not required. Ludovic Courtès 2016-07-22doc: Add note on gender-neutral wording....Suggested by ng0 <ng0@we.make.ritual.n0.is>. * doc/contributing.texi (Submitting Patches): Add @item regarding gender-neutral wording. Ludovic Courtès 2016-04-16doc: Mention --localstatedir for when building from Git....Reported by Hartmut Goebel <h.goebel@crazy-compilers.com>. * doc/contributing.texi (Building from Git): Mention --localstatedir. Ludovic Courtès 2016-03-11doc: Add footnote about pointing ~/.config/guix/latest at user's checkout...* doc/contributing.texi (Running Guix Before It Is Installed): New footnote. Christopher Allan Webber 2016-02-24doc: Fix minor typos and add missing words....* doc/guix.texi (Shepherd Services): Add missing words. (Invoking guix system): Fix typo. (Service Types and Services): Fix typo. * doc/contributing.texi (Submitting Patches): Fix typo. Signed-off-by: Andreas Enge <andreas@enge.fr> Chris Marusich 2015-12-09doc: rephrase code of conduct....* doc/contributing.texi (Contributing): Rephrase 'code of conduct' section. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Alex Sassmannshausen 2015-12-09Add "Contributor Covenant"....* CODE-OF-CONDUCT: New file, adapted from <http://contributor-covenant.org/version/1/3/0/code_of_conduct.txt>. * doc/contributing.texi (Contributing): Mention it. * Makefile.am (EXTRA_DIST): Add it. Ludovic Courtès 2015-12-08guix build: Add '--rounds'....* guix/scripts/build.scm (show-build-options-help) (%standard-build-options): Add --rounds. (set-build-options-from-command-line): Honor it. * doc/guix.texi (Invoking guix build): Document it. * doc/contributing.texi (Submitting Patches): Mention it. Ludovic Courtès 2015-11-22doc: Mention 'guix environment guix'....* doc/contributing.texi (Building from Git): Mention 'guix environment guix'. Remove outdated description of ./bootstrap. Clarify a few things. Ludovic Courtès 2015-11-21doc: Remove extraneous "See."...* doc/contributing.texi (Building from Git): Remove extra "See" and use @xref instead of @pxref. Ludovic Courtès 2015-11-21doc: Fix 'geiser-guile-load-path' example....Reported by marusich on #guix. * doc/contributing.texi (The Perfect Setup): Wrap modifying 'geiser-guile-load-path' into 'with-eval-after-load'. Alex Kost 2015-11-03doc: './pre-inst-env guix pull' won't upgrade local source tree....* doc/contributing.texi (Running Guix Before It Is Installed): Clarify './pre-inst-env guix pull' won't upgrade local source tree. * doc/guix.texi (Invoking guix pull): Mention ~/.config/guix/latest. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Alex Vong 2015-10-28doc: Add texinfo to the requirements when building from git....* doc/contributing.texi (Building from Git): Add GNU Texinfo to the list of additional requirements. Mark H Weaver 2015-10-27doc: Add a REPL example....* doc/contributing.texi (Running Guix Before It Is Installed): Add REPL example. * doc/emacs.texi (Emacs General info): Add @cindex. Ludovic Courtès 2015-10-20Add 'guix challenge'....* guix/scripts/challenge.scm, tests/challenge.scm: New files. * Makefile.am (MODULES): Add the former. (SCM_TESTS): Add the latter. * doc.am (SUBCOMMANDS): Add 'challenge'. * doc/guix.texi (Substitutes): Add xref to 'guix challenge'. (Invoking guix challenge): New node. * doc/contributing.texi (Submitting Patches): Add note about using 'guix challenge'. * po/guix/POTFILES.in: Add guix/scripts/challenge.scm. Ludovic Courtès 2015-09-23emacs: Add development utils....* emacs/guix-guile.el (guix-guile-current-module): New function. * emacs/guix-devel.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Development): New node. (Emacs Interface): Add it. * doc/contributing.texi (The Perfect Setup): Mention it. * doc/guix.texi (Top): Add it. * emacs/guix-init.el: Add 'guix-devel-activate-mode-maybe' to 'scheme-mode-hook'. Alex Kost 2015-09-15doc: Add guidelines for synopses and descriptions....* doc/guix.texi (Synopses and Descriptions): New node. * doc/contributing.texi (Submitting Patches): Add item that cross-references it. Ludovic Courtès 2015-06-18Add 'guix size'....* guix/scripts/size.scm: New file. * Makefile.am (MODULES): Add it. (SCM_TESTS): Add tests/size.scm. * doc.am (SUBCOMMANDS): Add 'size'. * po/guix/POTFILES.in: Add guix/scripts/size.scm. * tests/size.scm: New file. * doc/guix.texi (Packages with Multiple Outputs): Add xref to "Invoking guix size". (Invoking guix size): New node. (Invoking guix gc): Add index for "closure" and xref to the above. * doc/contributing.texi (Submitting Patches): Use @enumerate for the check list. Add item about 'guix size'. Ludovic Courtès 2015-06-14doc: Move most 'HACKING' informations into the manual....* HACKING (Contributing): New section. (Building from Git, The Perfect Setup, Coding Style, Submitting Patches): Move to ... * doc/guix.texi (Running Guix Before It Is Installed): Likewise. * doc/contributing.texi: ... here. New file. * doc.am (EXTRA_DIST): Use it. * README (Installation): Adapt to it. * configure.ac (DOT): Likewise. Mathieu Lirzin