GNU bug report logs - #67898
[PATCH] guix: import: composer: Handle parsing failures.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Tue, 19 Dec 2023 11:21:02 UTC

Severity: normal

Tags: patch

Done: Nicolas Graves <ngraves <at> ngraves.fr>

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 67898 in the body.
You can then email your comments to 67898 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 guix-patches <at> gnu.org:
bug#67898; Package guix-patches. (Tue, 19 Dec 2023 11:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 19 Dec 2023 11:21:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Cc: ludo <at> gnu.org, ngraves <at> ngraves.fr
Subject: [PATCH] guix: import: composer: Handle parsing failures.
Date: Tue, 19 Dec 2023 12:19:31 +0100
* guix/import/composer (latest-release): Handle parsing failures.

Change-Id: I14936c2c6e6a850a32fe56891766ae92b693a295
---
 guix/import/composer.scm | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index 069a950f90..b40285620d 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -246,13 +246,18 @@ (define (php-package? 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 version))
-         (version (composer-package-version package))
-         (url (composer-source-url (composer-package-source package))))
-    (upstream-source
-     (package (composer-package-name package))
-     (version version)
-     (urls (list url)))))
+         (package (composer-fetch php-name #:version version)))
+    (match package
+      (#f
+       (format (current-error-port)
+               "warning: failed to parse ~a~%"
+               php-name)
+       #f)
+      (_
+       (upstream-source
+        (package (composer-package-name package))
+        (version (composer-package-version package))
+        (urls (composer-source-url (composer-package-source package))))))))
 
 (define %composer-updater
   (upstream-updater
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67898; Package guix-patches. (Tue, 19 Dec 2023 11:40:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 67898 <at> debbugs.gnu.org
Cc: ludo <at> gnu.org, ngraves <at> ngraves.fr
Subject: [PATCH v2] guix: import: composer: Handle parsing failures.
Date: Tue, 19 Dec 2023 12:38:56 +0100
* guix/import/composer (latest-release): Handle parsing
failures. Rename package to composer-package for clarity.

Change-Id: I14936c2c6e6a850a32fe56891766ae92b693a295
---
 guix/import/composer.scm | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index 069a950f90..b23af1b91f 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -246,13 +246,19 @@ (define (php-package? 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 version))
-         (version (composer-package-version package))
-         (url (composer-source-url (composer-package-source package))))
-    (upstream-source
-     (package (composer-package-name package))
-     (version version)
-     (urls (list url)))))
+         (composer-package (composer-fetch php-name #:version version)))
+    (match composer-package
+      (#f
+       (format (current-error-port)
+               "warning: failed to parse ~a~%"
+               php-name)
+       #f)
+      (_
+       (upstream-source
+        (package (composer-package-name composer-package))
+        (version (composer-package-version composer-package))
+        (urls (list (composer-source-url
+                     (composer-package-source composer-package)))))))))
 
 (define %composer-updater
   (upstream-updater
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67898; Package guix-patches. (Fri, 05 Apr 2024 20:11:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 67898 <at> debbugs.gnu.org
Subject: Re: [bug#67898] [PATCH v2] guix: import: composer: Handle parsing
 failures.
Date: Fri, 05 Apr 2024 22:09:46 +0200
Hi,

Nicolas Graves <ngraves <at> ngraves.fr> skribis:

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

[...]

> +    (match composer-package
> +      (#f
> +       (format (current-error-port)
> +               "warning: failed to parse ~a~%"
> +               php-name)

Please use ‘warning’ from (guix diagnostics) instead.

Does #f necessarily indicate a parse error?  Couldn’t we have more
detailed info about the error?  (Not a blocker but it would be nice.)

> +       #f)
> +      (_
> +       (upstream-source

Nitpick: I’d suggest using a plain ‘if’ rather than ‘match’ in this case
since it’s a binary choice without destructuring.

Could you send an updated patch?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#67898; Package guix-patches. (Sat, 06 Apr 2024 00:56:03 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 67898 <at> debbugs.gnu.org
Subject: Re: [bug#67898] [PATCH v2] guix: import: composer: Handle parsing
 failures.
Date: Sat, 06 Apr 2024 02:55:08 +0200
On 2024-04-05 22:09, Ludovic Courtès wrote:

>> +    (match composer-package
>> +      (#f
>> +       (format (current-error-port)
>> +               "warning: failed to parse ~a~%"
>> +               php-name)
>
> Does #f necessarily indicate a parse error?  Couldn’t we have more
> detailed info about the error?  (Not a blocker but it would be nice.)
>

Well if go through the changes, it could fail on each step of the let*,
so we could indeed be more precise, though it eventually comes down to
a fetch or parsing error. Will fix this in a later patch.

Actually I'm probably going to merge the different patches in a single
patch series, that would make it more convenient to review on your side.


>> +       #f)
>> +      (_
>> +       (upstream-source
>
> Nitpick: I’d suggest using a plain ‘if’ rather than ‘match’ in this case
> since it’s a binary choice without destructuring.
>
> Could you send an updated patch?
>
> Thanks,
> Ludo’.

-- 
Best regards,
Nicolas Graves




bug closed, send any further explanations to 67898 <at> debbugs.gnu.org and Nicolas Graves <ngraves <at> ngraves.fr> Request was from Nicolas Graves <ngraves <at> ngraves.fr> to control <at> debbugs.gnu.org. (Sat, 06 Apr 2024 01:50:03 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. (Sat, 04 May 2024 11:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified today.

Previous Next


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