import: composer: Handle parsing failures.

* guix/import/composer (latest-release): Handle parsing
failures. Rename package to composer-package for clarity.

Change-Id: I57f6fba7b05122b031177681e76cf0b5c9547736
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Nicolas Graves 2024-10-07 01:55:59 +02:00 committed by Ludovic Courtès
parent 979003c0f0
commit 92e4c0a00d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -243,16 +243,19 @@ (define (php-package? package)
(eq? (package-build-system package) composer-build-system)
(string-prefix? "php-" (package-name package))))
(define (latest-release package)
(define* (latest-release package #:key (version #f))
"Return an <upstream-source> for the latest release of PACKAGE."
(let* ((php-name (guix-package->composer-name package))
(package (composer-fetch php-name))
(version (composer-package-version package))
(url (composer-source-url (composer-package-source package))))
(upstream-source
(package (package-name package))
(version version)
(urls (list url)))))
(composer-package (composer-fetch php-name #:version version)))
(if composer-package
(upstream-source
(package (composer-package-name composer-package))
(version (composer-package-version composer-package))
(urls (list (composer-source-url
(composer-package-source composer-package)))))
(begin
(warning (G_ "failed to parse ~a~%") php-name)
#f))))
(define %composer-updater
(upstream-updater