From: Xinglu Chen <public@yoctocell.xyz>
To: 52586@debbugs.gnu.org
Subject: [bug#52586] [PATCH] import: elpa: Support ‘upstream-name’ property.
Date: Fri, 17 Dec 2021 21:55:54 +0100 [thread overview]
Message-ID: <e48b9facb53a4e9853fbdc4520c93ec6d42ef1ec.1639774501.git.public@yoctocell.xyz> (raw)
* 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.
---
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 dd539cd945..edabb88b7a 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -46,6 +46,7 @@ (define-module (guix import elpa)
#: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 @@ (define* (elpa->guix-package name #:key (repo 'gnu) version)
;;; 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 01ef948b2e..1efdf2457f 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 @@ (define (eval-test-with-elpa pkg)
(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:
base-commit: d627fbad8f4e157103251b07d7543dd2f5647cea
--
2.33.1
next reply other threads:[~2021-12-17 20:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 20:55 Xinglu Chen [this message]
2021-12-18 20:00 ` bug#52586: [PATCH] import: elpa: Support ‘upstream-name’ property Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e48b9facb53a4e9853fbdc4520c93ec6d42ef1ec.1639774501.git.public@yoctocell.xyz \
--to=public@yoctocell.xyz \
--cc=52586@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).