GNU bug report logs - #63522
[PATCH 0/2] Fix return code of "guix import elpa"

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Mon, 15 May 2023 17:45:02 UTC

Severity: normal

Tags: patch

Done: Josselin Poiret <dev <at> jpoiret.xyz>

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 63522 in the body.
You can then email your comments to 63522 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 rekado <at> elephly.net, guix-patches <at> gnu.org:
bug#63522; Package guix-patches. (Mon, 15 May 2023 17:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to rekado <at> elephly.net, guix-patches <at> gnu.org. (Mon, 15 May 2023 17:45:02 GMT) Full text and rfc822 format available.

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

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 0/2] Fix return code of "guix import elpa"
Date: Mon, 15 May 2023 19:44:04 +0200
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 <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#63522; Package guix-patches. (Mon, 15 May 2023 17:47:02 GMT) Full text and rfc822 format available.

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

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 63522 <at> debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 1/2] scripts: import: elpa: Warn when version is specified.
Date: Mon, 15 May 2023 19:45:44 +0200
* 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 <at> gmail.com>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#63522; Package guix-patches. (Mon, 15 May 2023 17:47:02 GMT) Full text and rfc822 format available.

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

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 63522 <at> debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 2/2] scripts: import: elpa: Return consistent error code.
Date: Mon, 15 May 2023 19:45:45 +0200
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





Information forwarded to guix-patches <at> gnu.org:
bug#63522; Package guix-patches. (Wed, 17 May 2023 21:28:02 GMT) Full text and rfc822 format available.

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

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Simon Tournier <zimon.toutoune <at> gmail.com>, 63522 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: Re: [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa"
Date: Wed, 17 May 2023 23:27:47 +0200
[Message part 1 (text/plain, inline)]
Hi Simon,

Simon Tournier <zimon.toutoune <at> 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
[signature.asc (application/pgp-signature, inline)]

bug closed, send any further explanations to 63522 <at> debbugs.gnu.org and Simon Tournier <zimon.toutoune <at> gmail.com> Request was from Josselin Poiret <dev <at> jpoiret.xyz> to control <at> debbugs.gnu.org. (Wed, 17 May 2023 21:29:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 15 Jun 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 313 days ago.

Previous Next


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