[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/10: import: elpa: Support ‘upstream-name’ property.
From: |
guix-commits |
Subject: |
07/10: import: elpa: Support ‘upstream-name’ property. |
Date: |
Sat, 18 Dec 2021 16:54:09 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit f21c70bc9a41d000acf7d39a0813a3c7415517ca
Author: Xinglu Chen <public@yoctocell.xyz>
AuthorDate: Fri Dec 17 21:55:54 2021 +0100
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>
---
guix/import/elpa.scm | 15 ++++++++++-----
tests/elpa.scm | 12 ++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index dd539cd..edabb88 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -46,6 +46,7 @@
#:use-module (guix packages)
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
#:export (elpa->guix-package
+ guix-package->elpa-name
%elpa-updater
elpa-recursive-import))
@@ -412,13 +413,17 @@ type '<elpa-package>'."
;;; Updates.
;;;
+(define (guix-package->elpa-name package)
+ "Given a Guix package, PACKAGE, return the upstream name on ELPA."
+ (or (and=> (package-properties package)
+ (cut assq-ref <> 'upstream-name))
+ (if (string-prefix? "emacs-" (package-name package))
+ (string-drop (package-name package) 6)
+ (package-name package))))
+
(define (latest-release package)
"Return an <upstream-release> for the latest release of PACKAGE."
- (define name
- (if (string-prefix? "emacs-" (package-name package))
- (string-drop (package-name package) 6)
- (package-name package)))
-
+ (define name (guix-package->elpa-name package))
(define repo 'gnu)
(match (elpa-package-info name repo)
diff --git a/tests/elpa.scm b/tests/elpa.scm
index 01ef948..1efdf24 100644
--- a/tests/elpa.scm
+++ b/tests/elpa.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2020 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.
;;;
@@ -20,6 +21,7 @@
(define-module (test-elpa)
#:use-module (guix import elpa)
+ #:use-module (guix tests)
#:use-module (guix tests http)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-64)
@@ -71,6 +73,16 @@
(test-assert "elpa->guix-package test 1"
(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")
;; Local Variables:
- branch master updated (cfcfda5 -> f6e79ef), guix-commits, 2021/12/18
- 01/10: gnu: Add Guile-Plotutils., guix-commits, 2021/12/18
- 06/10: gnu: sssd: Fix build with glibc-2.33, guix-commits, 2021/12/18
- 05/10: gnu: Add xfoil., guix-commits, 2021/12/18
- 03/10: gnu: Move instrumentation tools to instrumentation module., guix-commits, 2021/12/18
- 09/10: style: Refer to source files by absolute file names., guix-commits, 2021/12/18
- 10/10: style: Gracefully handle errors such as EACCES when opening files., guix-commits, 2021/12/18
- 02/10: gnu: Add Dyninst., guix-commits, 2021/12/18
- 04/10: gnu: babeltrace, lttng-tools: Simplify inputs., guix-commits, 2021/12/18
- 07/10: import: elpa: Support ‘upstream-name’ property.,
guix-commits <=
- 08/10: gnu: go-ipfs: Update to 0.11.0., guix-commits, 2021/12/18