[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
16/21: import: elpa: Updater provides input list.
From: |
guix-commits |
Subject: |
16/21: import: elpa: Updater provides input list. |
Date: |
Wed, 31 May 2023 17:52:50 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit d46d1bee1ea93d8fba97d7f8cadd142c493dc3bf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu May 18 16:33:37 2023 +0200
import: elpa: Updater provides input list.
* guix/import/elpa.scm (elpa-dependency->upstream-input): New
procedure.
(latest-release): Add 'inputs' field.
* tests/elpa.scm ("package-latest-release"): New test.
---
guix/import/elpa.scm | 30 ++++++++++++++++++++++++++++--
tests/elpa.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 1313a8aa67..e65cf6683b 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -272,6 +272,25 @@ the package named PACKAGE-NAME."
(assq-ref recipe ':fetcher))
#f)))
+(define (elpa-dependency->upstream-input dependency)
+ "Convert DEPENDENCY, an sexp as returned by 'elpa-package-inputs', into an
+<upstream-input>."
+ (match dependency
+ ((name version)
+ (and (not (emacs-standard-library? (symbol->string name)))
+ (upstream-input
+ (name (symbol->string name))
+ (downstream-name (elpa-guix-name name))
+ (type 'propagated)
+ (min-version (if (pair? version)
+ (string-join (map number->string version) ".")
+ #f))
+ (max-version (match version
+ (() #f)
+ ((_) #f)
+ ((_ _) #f)
+ (_ min-version))))))))
+
(define default-files-spec
;; This contains more than just the things contained in %default-include and
;; %default-exclude, presumably because this includes source files (*.in,
@@ -421,12 +440,19 @@ type '<elpa-package>'."
(elpa-version->string raw-version))))
(url (match info
((_ raw-version reqs synopsis kind . rest)
- (package-source-url kind name version repo)))))
+ (package-source-url kind name version repo))))
+ (inputs (match info
+ ((name raw-version reqs . _)
+ (filter-map elpa-dependency->upstream-input
+ (if (eq? 'nil reqs)
+ '()
+ reqs))))))
(upstream-source
(package (package-name package))
(version version)
(urls (list url))
- (signature-urls (list (string-append url ".sig"))))))))
+ (signature-urls (list (string-append url ".sig")))
+ (inputs inputs))))))
(define elpa-repository
(memoize
diff --git a/tests/elpa.scm b/tests/elpa.scm
index 1efdf2457f..56008fe014 100644
--- a/tests/elpa.scm
+++ b/tests/elpa.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
-;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
@@ -21,6 +21,8 @@
(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)
@@ -40,8 +42,20 @@
(auctex .
[(11 88 6)
nil "Integrated environment for *TeX*" tar
- ((:url . "http://www.gnu.org/software/auctex/";))])))
+ ((:url . "http://www.gnu.org/software/auctex/";))])
+ (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)
@@ -73,6 +87,36 @@
(test-assert "elpa->guix-package test 1"
(eval-test-with-elpa "auctex"))
+(test-equal "package-latest-release"
+ (list '("https://elpa.gnu.org/packages/taxy-magit-section-0.12.2.tar";)
+ '("https://elpa.gnu.org/packages/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
+ (package-latest-release
+ (dummy-package "emacs-taxy-magit-section"
+ (version "0.0.0")
+ (source (dummy-origin
+ (method url-fetch)
+ (uri "https://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")))
- branch master updated (60895810ad -> 654fcf9971), guix-commits, 2023/05/31
- 01/21: transformations: Add "--tune" to "--help-transform"., guix-commits, 2023/05/31
- 06/21: import: json: Add #:timeout to 'json-fetch'., guix-commits, 2023/05/31
- 08/21: upstream: Replace 'input-changes' field by 'inputs'., guix-commits, 2023/05/31
- 02/21: tests: pypi: Factorize tarball and wheel file creation., guix-commits, 2023/05/31
- 09/21: diagnostics: Factorize 'absolute-location'., guix-commits, 2023/05/31
- 07/21: doc: Mention 'guix refresh -u' for third-party channels., guix-commits, 2023/05/31
- 11/21: upstream: Remove <upstream-input-change> and related code., guix-commits, 2023/05/31
- 10/21: upstream: 'update-package-source' edits input fields., guix-commits, 2023/05/31
- 12/21: tests: upstream: Restore test that was skipped., guix-commits, 2023/05/31
- 16/21: import: elpa: Updater provides input list.,
guix-commits <=
- 20/21: gnu: Add updater input properties for R and Python packages., guix-commits, 2023/05/31
- 21/21: tests: Use quasiquoted 'match' patterns for package sexps., guix-commits, 2023/05/31
- 05/21: import: utils: 'call-with-networking-exception-handler' doesn't unwind., guix-commits, 2023/05/31
- 04/21: tests: pypi: Rewrite tests using a local HTTP server., guix-commits, 2023/05/31
- 14/21: import: cpan: Represent dependencies as <upstream-input> records., guix-commits, 2023/05/31
- 15/21: import: cpan: Updater provides input list., guix-commits, 2023/05/31
- 19/21: upstream: Honor package properties for ignored and extra inputs., guix-commits, 2023/05/31
- 13/21: import: cpan: Remove unary 'string-append' call., guix-commits, 2023/05/31
- 18/21: import: gem: Updater provides input list., guix-commits, 2023/05/31
- 03/21: tests: http: Allow responses to specify a path., guix-commits, 2023/05/31