GNU bug report logs - #51888
[PATCH 0/1] import: opam: Warn instead of leave when fetching fails.

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Tue, 16 Nov 2021 10:11:02 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

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 51888 in the body.
You can then email your comments to 51888 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 julien <at> lepiller.eu, guix-patches <at> gnu.org:
bug#51888; Package guix-patches. (Tue, 16 Nov 2021 10:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to zimoun <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to julien <at> lepiller.eu, guix-patches <at> gnu.org. (Tue, 16 Nov 2021 10:11:02 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
Date: Tue, 16 Nov 2021 11:10:43 +0100
Hi,

It is possible to use another OPAM repository when importing, for instance
"guix import opam --repo=https://coq.inria.fr/opam/released" -- although Coq
packages are generally not built using OCaml or Dune build-system, another
story. :-)  Or even, a package using OCaml or Dune build system but not
included in Opam repositories supported by Guix.

However, if this package uses OCaml or Dune build system, then 'refresh'
leaves which is annoying.  For instance, consider:

--8<---------------cut here---------------start------------->8---
$ guix lint -L /tmp/pkgs example
/tmp/pkgs/mine.scm:8:2: example <at> 0 : champ de licence invalide
/tmp/pkgs/mine.scm:23:14: example <at> 0 : le synopsis ne devrait pas commencer par un nom de paquet
/tmp/pkgs/mine.scm:22:15: example <at> 0 : Erreur de certificat TLS : X.509 server certificate for 'exmaple.org' does not match: C=US,ST=California,L=test,O=testexample,OU=testexample,CN=testexp


guix lint: erreur : le paquet « example » est introuvable
--8<---------------cut here---------------end--------------->8---

The trivial patch instead turns this error to a warning which allows to run
all the checkers:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix lint -L /tmp/pkgs example
/tmp/pkgs/mine.scm:8:2: example <at> 0: invalid license field
/tmp/pkgs/mine.scm:23:14: example <at> 0: synopsis should not start with the package name
/tmp/pkgs/mine.scm:22:15: example <at> 0: TLS certificate error: X.509 server certificate for 'exmaple.org' does not match: C=US,ST=California,L=test,O=testexample,OU=testexample,CN=testexp


guix lint: warning: opam: package 'example' not found
/tmp/pkgs/mine.scm:12:6: warning: failed to fetch Git repository for example
/tmp/pkgs/mine.scm:12:6: example <at> 0: updater 'opam' failed to find upstream releases
/tmp/pkgs/mine.scm:12:6: example <at> 0: scheduled Software Heritage archival
--8<---------------cut here---------------end--------------->8---

here 'archival'.  Note that the failure is correctly handled by 'lint' when
the early leave skips.

Note that it could be better that 'opam-fetch' raises an error in order to be
catched by caller and thus make all the UI consistent.  However, this requires
a revamp of all inporters...


Cheers,
simon


Example of file /tmp/pkgs/mine.scm:

--8<---------------cut here---------------start------------->8---
(define-module (mine)
  #:use-module (guix packages)
  #:use-module (guix build-system ocaml)
  #:use-module (guix git-download))

(define-public example
  (package
    (name "example")
    (version "0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://example.org")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "0m5si9dsv96z92gy4xaqz8mzyz8zp7j1sp542l0wzsp5xgyfpc7i"))))
    (build-system ocaml-build-system)
    (home-page "https://exmaple.org")
    (synopsis "Example")
    (description "This is an exmaple.")
    (license #f)))
--8<---------------cut here---------------end--------------->8---


zimoun (1):
  import: opam: Warn instead of leave when fetching fails.

 guix/import/opam.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 122396075f12b013b6bde56dafb895587b95bc9d
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#51888; Package guix-patches. (Tue, 16 Nov 2021 10:13:01 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: 51888 <at> debbugs.gnu.org
Cc: julien <at> lepiller.eu, zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH 1/1] import: opam: Warn instead of leave when fetching fails.
Date: Tue, 16 Nov 2021 11:12:34 +0100
* guix/import/opam.scm (opam-featch): Warn instead of leave when fetching
fails.
---
 guix/import/opam.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index fe13d29f03..0804526e3a 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -318,7 +318,7 @@ (define* (opam-fetch name #:optional (repositories-specs '("opam")))
                 (_ others)))
             #f
             (filter-map get-opam-repository repositories-specs))
-      (leave (G_ "package '~a' not found~%") name)))
+      (warning (G_ "opam: package '~a' not found~%") name)))
 
 (define* (opam->guix-package name #:key (repo '()) version)
   "Import OPAM package NAME from REPOSITORIES (a list of names, URLs or local
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#51888; Package guix-patches. (Tue, 16 Nov 2021 13:04:01 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 51888 <at> debbugs.gnu.org
Subject: Re: [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave
 when fetching fails.
Date: Tue, 16 Nov 2021 14:02:48 +0100
Le Tue, 16 Nov 2021 11:10:43 +0100,
zimoun <zimon.toutoune <at> gmail.com> a écrit :

> Hi,
> 
> It is possible to use another OPAM repository when importing, for
> instance "guix import opam --repo=https://coq.inria.fr/opam/released"
> -- although Coq packages are generally not built using OCaml or Dune
> build-system, another story. :-)  Or even, a package using OCaml or
> Dune build system but not included in Opam repositories supported by
> Guix.
> 

Hi,

I already had a patch for that, which is a bit more complex, at
https://issues.guix.gnu.org/51091. WDYT?




Information forwarded to guix-patches <at> gnu.org:
bug#51888; Package guix-patches. (Tue, 16 Nov 2021 15:34:02 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 51888 <at> debbugs.gnu.org
Subject: Re: [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when
 fetching fails.
Date: Tue, 16 Nov 2021 16:33:28 +0100
Hi,

On Tue, 16 Nov 2021 at 14:03, Julien Lepiller <julien <at> lepiller.eu> wrote:

> I already had a patch for that, which is a bit more complex, at

Sorry, I missed it.

> https://issues.guix.gnu.org/51091. WDYT?

Your patch LGTM.  I am not convinced that all the complexity is worth;
compared to the proposed trivial change. ;-)
From my opinion, the way is a common error for the all importers and
raise it; all the catch happening in 'guix/scripts/'.  That's another
story. :-)

One minor comment, in 'latest-release' I would write "opam: package
'~a' not found~%" otherwise the message "guix lint: warning: package
'example' not found" looks odd (at least to me :-)).

Feel free to close this issue and the other once you pushed a fix.

Cheers,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#51888; Package guix-patches. (Fri, 19 Nov 2021 12:00:01 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 51888 <at> debbugs.gnu.org
Subject: Re: [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave
 when fetching fails.
Date: Fri, 19 Nov 2021 12:59:00 +0100
Pushed to master as b5d51bb19e790baee9b16a3325397ec92d8e7625, thanks!




Reply sent to Julien Lepiller <julien <at> lepiller.eu>:
You have taken responsibility. (Fri, 19 Nov 2021 12:01:02 GMT) Full text and rfc822 format available.

Notification sent to zimoun <zimon.toutoune <at> gmail.com>:
bug acknowledged by developer. (Fri, 19 Nov 2021 12:01:02 GMT) Full text and rfc822 format available.

Message #22 received at 51888-done <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
Cc: 51888-done <at> debbugs.gnu.org
Subject: Re: [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave
 when fetching fails.
Date: Fri, 19 Nov 2021 13:00:05 +0100
Forgot to close.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 17 Dec 2021 12:24:14 GMT) Full text and rfc822 format available.

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

Previous Next


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