[PATCH 0/1] import: opam: Warn instead of leave when fetching fails.

  • Done
  • quality assurance status badge
Details
2 participants
  • Julien Lepiller
  • zimoun
Owner
unassigned
Submitted by
zimoun
Severity
normal
Z
Z
zimoun wrote on 16 Nov 2021 11:10
(address . guix-patches@gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20211116101043.58471-1-zimon.toutoune@gmail.com
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:

Toggle snippet (9 lines)
$ guix lint -L /tmp/pkgs example
/tmp/pkgs/mine.scm:8:2: example@0 : champ de licence invalide
/tmp/pkgs/mine.scm:23:14: example@0 : le synopsis ne devrait pas commencer par un nom de paquet
/tmp/pkgs/mine.scm:22:15: example@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

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

Toggle snippet (12 lines)
$ ./pre-inst-env guix lint -L /tmp/pkgs example
/tmp/pkgs/mine.scm:8:2: example@0: invalid license field
/tmp/pkgs/mine.scm:23:14: example@0: synopsis should not start with the package name
/tmp/pkgs/mine.scm:22:15: example@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@0: updater 'opam' failed to find upstream releases
/tmp/pkgs/mine.scm:12:6: example@0: scheduled Software Heritage archival

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:

Toggle snippet (27 lines)
(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)))


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
Z
Z
zimoun wrote on 16 Nov 2021 11:12
[PATCH 1/1] import: opam: Warn instead of leave when fetching fails.
(address . 51888@debbugs.gnu.org)
20211116101234.58528-1-zimon.toutoune@gmail.com
* 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(-)

Toggle diff (15 lines)
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
J
J
Julien Lepiller wrote on 16 Nov 2021 14:02
Re: [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 51888@debbugs.gnu.org)
20211116140248.1dcf61e5@tachikoma.lepiller.eu
Le Tue, 16 Nov 2021 11:10:43 +0100,
zimoun <zimon.toutoune@gmail.com> a écrit :

Toggle quote (10 lines)
> 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
Z
Z
zimoun wrote on 16 Nov 2021 16:33
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 51888@debbugs.gnu.org)
CAJ3okZ2Ldj_x3DLM85zP1+jKp8YnSGCa5EvpVC-VDRMNzpZynQ@mail.gmail.com
Hi,

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

Toggle quote (2 lines)
> I already had a patch for that, which is a bit more complex, at

Sorry, I missed it.

Toggle quote (2 lines)
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
J
J
Julien Lepiller wrote on 19 Nov 2021 12:59
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 51888@debbugs.gnu.org)
20211119125900.621b1975@tachikoma.lepiller.eu
Pushed to master as b5d51bb19e790baee9b16a3325397ec92d8e7625, thanks!
J
J
Julien Lepiller wrote on 19 Nov 2021 13:00
(address . 51888-done@debbugs.gnu.org)
20211119130005.25118216@tachikoma.lepiller.eu
Forgot to close.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 51888@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51888
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch