Subject: [PATCH] guix: import: composer: Improve composer-fetch.

From: Nicolas Graves <[email-masked]>
Date: Wed, 16 Oct 2024 07:29:49 +0200

* guix/import/composer.scm (composer-fetch): Handle a case where
packages are #f. This improves composer-fetch behavior, which was
sometimes buggy.
---
 guix/import/composer.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index abc9023be4..febde97791 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -111,7 +111,7 @@ (define* (composer-fetch name #:key (version #f))
                             (let ((pkgs (assoc-ref pkg "packages")))
                               (or (assoc-ref pkgs name) pkg))))))
     (if packages
-        (json->composer-package
+        (and=>
          (if version
              (assoc-ref packages version)
              (cdr
@@ -125,7 +125,8 @@ (define* (composer-fetch name #:key (version #f))
                         cur-max))
                    (_ cur-max)))
                (cons* "0.0.0" #f)
-               packages))))
+               packages)))
+         json->composer-package)
         #f)))
 
 (define (php-package-name name)
-- 
2.46.0