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.

Full log


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





This bug report was last modified 2 years and 84 days ago.

Previous Next


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