mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-02-07 11:29:59 +01:00
import: elpa: Support ‘upstream-name’ property.
* guix/import/elpa.scm: (guix-package->elpa-name): New procedure. (latest-release): Use it. * tests/elpa.scm ("guix-package->elpa-name: without 'upstream-name' property") ("guix-package->elpa-name: with 'upstream-name' property"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
08b0f5c2a5
commit
f21c70bc9a
2 changed files with 22 additions and 5 deletions
|
@ -46,6 +46,7 @@
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
|
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
|
||||||
#:export (elpa->guix-package
|
#:export (elpa->guix-package
|
||||||
|
guix-package->elpa-name
|
||||||
%elpa-updater
|
%elpa-updater
|
||||||
elpa-recursive-import))
|
elpa-recursive-import))
|
||||||
|
|
||||||
|
@ -412,13 +413,17 @@ type '<elpa-package>'."
|
||||||
;;; Updates.
|
;;; Updates.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define (latest-release package)
|
(define (guix-package->elpa-name package)
|
||||||
"Return an <upstream-release> for the latest release of PACKAGE."
|
"Given a Guix package, PACKAGE, return the upstream name on ELPA."
|
||||||
(define name
|
(or (and=> (package-properties package)
|
||||||
|
(cut assq-ref <> 'upstream-name))
|
||||||
(if (string-prefix? "emacs-" (package-name package))
|
(if (string-prefix? "emacs-" (package-name package))
|
||||||
(string-drop (package-name package) 6)
|
(string-drop (package-name package) 6)
|
||||||
(package-name package)))
|
(package-name package))))
|
||||||
|
|
||||||
|
(define (latest-release package)
|
||||||
|
"Return an <upstream-release> for the latest release of PACKAGE."
|
||||||
|
(define name (guix-package->elpa-name package))
|
||||||
(define repo 'gnu)
|
(define repo 'gnu)
|
||||||
|
|
||||||
(match (elpa-package-info name repo)
|
(match (elpa-package-info name repo)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
||||||
;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
|
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
|
||||||
|
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
|
|
||||||
(define-module (test-elpa)
|
(define-module (test-elpa)
|
||||||
#:use-module (guix import elpa)
|
#:use-module (guix import elpa)
|
||||||
|
#:use-module (guix tests)
|
||||||
#:use-module (guix tests http)
|
#:use-module (guix tests http)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-64)
|
#:use-module (srfi srfi-64)
|
||||||
|
@ -71,6 +73,16 @@
|
||||||
(test-assert "elpa->guix-package test 1"
|
(test-assert "elpa->guix-package test 1"
|
||||||
(eval-test-with-elpa "auctex"))
|
(eval-test-with-elpa "auctex"))
|
||||||
|
|
||||||
|
(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")
|
(test-end "elpa")
|
||||||
|
|
||||||
;; Local Variables:
|
;; Local Variables:
|
||||||
|
|
Loading…
Add table
Reference in a new issue