unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa"
@ 2023-05-15 17:44 Simon Tournier
  2023-05-15 17:45 ` [bug#63522] [PATCH 1/2] scripts: import: elpa: Warn when version is specified Simon Tournier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Simon Tournier @ 2023-05-15 17:44 UTC (permalink / raw)
  To: 63522; +Cc: Simon Tournier, rekado

Hi,

This fixes issue #58308 [1]:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix import elpa syslog
guix import: error: failed to download meta-data for package 'syslog'
$ echo $?
1

$ ./pre-inst-env guix import elpa syslog -r
guix import: error: failed to download meta-data for package 'syslog'
$ echo $?
1
--8<---------------cut here---------------end--------------->8---

In addition, since Elpa importer does not support the specification of the
version, the first patch warns about that:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix import elpa -a melpa magit@12
guix import: warning: this importer does not consider the version
(package
  ((name "emacs-magit")
   (version "20230510.2139")
[...]
--8<---------------cut here---------------end--------------->8---

1: https://issues.guix.gnu.org/issue/58308


Cheers,
simon


Simon Tournier (2):
  scripts: import: elpa: Warn when version is specified.
  scripts: import: elpa: Return consistent error code.

 guix/scripts/import/elpa.scm | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)


base-commit: 6e38ec447f98383e0722ac300734f8d7c8c5c7b0
-- 
2.38.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#63522] [PATCH 1/2] scripts: import: elpa: Warn when version is specified.
  2023-05-15 17:44 [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Simon Tournier
@ 2023-05-15 17:45 ` Simon Tournier
  2023-05-15 17:45 ` [bug#63522] [PATCH 2/2] scripts: import: elpa: Return consistent error code Simon Tournier
  2023-05-17 21:27 ` [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Josselin Poiret via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Tournier @ 2023-05-15 17:45 UTC (permalink / raw)
  To: 63522; +Cc: Simon Tournier

* guix/scripts/import/elpa.scm (guix-import-elpa): Warn when version is
specified.
---
 guix/scripts/import/elpa.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm
index 052b0cc0e7..a71478d3c8 100644
--- a/guix/scripts/import/elpa.scm
+++ b/guix/scripts/import/elpa.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -91,7 +92,11 @@ (define (guix-import-elpa . args)
                             (_ #f))
                            (reverse opts))))
     (match args
-      ((package-name)
+      ((spec)
+       (define-values (package-name version)
+         (package-name->name+version spec))
+       (when version
+         (warning (G_ "this importer does not consider the version~%")))
        (if (assoc-ref opts 'recursive)
            (with-error-handling
              (map (match-lambda
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#63522] [PATCH 2/2] scripts: import: elpa: Return consistent error code.
  2023-05-15 17:44 [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Simon Tournier
  2023-05-15 17:45 ` [bug#63522] [PATCH 1/2] scripts: import: elpa: Warn when version is specified Simon Tournier
@ 2023-05-15 17:45 ` Simon Tournier
  2023-05-17 21:27 ` [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Josselin Poiret via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Tournier @ 2023-05-15 17:45 UTC (permalink / raw)
  To: 63522; +Cc: Simon Tournier

Fixes <https://bug.gnu.org/58308>.
Reported by Ricardo Wurmus.

* guix/scripts/import/elpa.scm (guix-import-elpa): Return consistent error
code independently of the 'recursive' option.
---
 guix/scripts/import/elpa.scm | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm
index a71478d3c8..f587eeb243 100644
--- a/guix/scripts/import/elpa.scm
+++ b/guix/scripts/import/elpa.scm
@@ -97,20 +97,21 @@ (define (guix-import-elpa . args)
          (package-name->name+version spec))
        (when version
          (warning (G_ "this importer does not consider the version~%")))
-       (if (assoc-ref opts 'recursive)
-           (with-error-handling
-             (map (match-lambda
-                    ((and ('package ('name name) . rest) pkg)
-                     `(define-public ,(string->symbol name)
-                        ,pkg))
-                    (_ #f))
+       (match (if (assoc-ref opts 'recursive)
                   (elpa-recursive-import package-name
-                                         (or (assoc-ref opts 'repo) 'gnu))))
-           (let ((sexp (elpa->guix-package package-name
-                                           #:repo (assoc-ref opts 'repo))))
-             (unless sexp
-               (leave (G_ "failed to download package '~a'~%") package-name))
-             sexp)))
+                                         (or (assoc-ref opts 'repo) 'gnu))
+                  (elpa->guix-package package-name
+                                      #:repo (assoc-ref opts 'repo)))
+         ((or #f '())
+          (leave (G_ "failed to download meta-data for package '~a'~%") package-name))
+         (('package etc ...) `(package ,etc))
+         ((? list? sexps) (map
+                           (match-lambda
+                             ((and ('package ('name name) . rest) pkg)
+                              `(define-public ,(string->symbol name)
+                                 ,pkg))
+                             (_ #f))
+                           sexps))))
       (()
        (leave (G_ "too few arguments~%")))
       ((many ...)
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa"
  2023-05-15 17:44 [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Simon Tournier
  2023-05-15 17:45 ` [bug#63522] [PATCH 1/2] scripts: import: elpa: Warn when version is specified Simon Tournier
  2023-05-15 17:45 ` [bug#63522] [PATCH 2/2] scripts: import: elpa: Return consistent error code Simon Tournier
@ 2023-05-17 21:27 ` Josselin Poiret via Guix-patches via
  2 siblings, 0 replies; 4+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2023-05-17 21:27 UTC (permalink / raw)
  To: Simon Tournier, 63522; +Cc: rekado, Simon Tournier

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Simon Tournier (2):
>   scripts: import: elpa: Warn when version is specified.
>   scripts: import: elpa: Return consistent error code.
>
>  guix/scripts/import/elpa.scm | 34 ++++++++++++++++++++--------------
>  1 file changed, 20 insertions(+), 14 deletions(-)

LGTM, applied as d81701a85aa8aa96f4a853f06fe28693fa8bee12.

Thanks!

Best,
-- 
Josselin Poiret

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 682 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-17 21:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15 17:44 [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Simon Tournier
2023-05-15 17:45 ` [bug#63522] [PATCH 1/2] scripts: import: elpa: Warn when version is specified Simon Tournier
2023-05-15 17:45 ` [bug#63522] [PATCH 2/2] scripts: import: elpa: Return consistent error code Simon Tournier
2023-05-17 21:27 ` [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Josselin Poiret via Guix-patches via

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