all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: 63522@debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune@gmail.com>
Subject: [bug#63522] [PATCH 2/2] scripts: import: elpa: Return consistent error code.
Date: Mon, 15 May 2023 19:45:45 +0200	[thread overview]
Message-ID: <ccbc0c1c2d5901e494d26299b1451ecc0176bc7a.1684171669.git.zimon.toutoune@gmail.com> (raw)
In-Reply-To: <cover.1684171669.git.zimon.toutoune@gmail.com>

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





  parent reply	other threads:[~2023-05-15 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-05-17 21:27 ` [bug#63522] [PATCH 0/2] Fix return code of "guix import elpa" Josselin Poiret via Guix-patches via

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ccbc0c1c2d5901e494d26299b1451ecc0176bc7a.1684171669.git.zimon.toutoune@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=63522@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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.