GNU bug report logs - #52586
[PATCH] import: elpa: Support ‘upstream-name’ property.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Fri, 17 Dec 2021 20:57:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52586 in the body.
You can then email your comments to 52586 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#52586; Package guix-patches. (Fri, 17 Dec 2021 20:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 17 Dec 2021 20:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] import: elpa: Support ‘upstream-name’ property.
Date: Fri, 17 Dec 2021 21:55:54 +0100
* 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 <at> fbengineering.ch>
 ;;; Copyright © 2020 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
+;;; Copyright © 2021 Xinglu Chen <public <at> 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






Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 18 Dec 2021 20:01:02 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Sat, 18 Dec 2021 20:01:02 GMT) Full text and rfc822 format available.

Message #10 received at 52586-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 52586-done <at> debbugs.gnu.org
Subject: Re: bug#52586: [PATCH] import: elpa: Support ‘upstream-name’ property.
Date: Sat, 18 Dec 2021 21:00:34 +0100
Hi,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

> * 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.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Jan 2022 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.