unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
@ 2021-11-16 10:10 zimoun
  2021-11-16 10:12 ` [bug#51888] [PATCH 1/1] " zimoun
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: zimoun @ 2021-11-16 10:10 UTC (permalink / raw)
  To: 51888; +Cc: zimoun, julien

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@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
--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@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
--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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#51888] [PATCH 1/1] import: opam: Warn instead of leave when fetching fails.
  2021-11-16 10:10 [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails zimoun
@ 2021-11-16 10:12 ` zimoun
  2021-11-16 13:02 ` [bug#51888] [PATCH 0/1] " Julien Lepiller
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: zimoun @ 2021-11-16 10:12 UTC (permalink / raw)
  To: 51888; +Cc: julien, zimoun

* 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
  2021-11-16 10:10 [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails zimoun
  2021-11-16 10:12 ` [bug#51888] [PATCH 1/1] " zimoun
@ 2021-11-16 13:02 ` Julien Lepiller
  2021-11-16 15:33   ` zimoun
  2021-11-19 11:59 ` Julien Lepiller
  2021-11-19 12:00 ` bug#51888: " Julien Lepiller
  3 siblings, 1 reply; 6+ messages in thread
From: Julien Lepiller @ 2021-11-16 13:02 UTC (permalink / raw)
  To: zimoun; +Cc: 51888

Le Tue, 16 Nov 2021 11:10:43 +0100,
zimoun <zimon.toutoune@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?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
  2021-11-16 13:02 ` [bug#51888] [PATCH 0/1] " Julien Lepiller
@ 2021-11-16 15:33   ` zimoun
  0 siblings, 0 replies; 6+ messages in thread
From: zimoun @ 2021-11-16 15:33 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 51888

Hi,

On Tue, 16 Nov 2021 at 14:03, Julien Lepiller <julien@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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
  2021-11-16 10:10 [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails zimoun
  2021-11-16 10:12 ` [bug#51888] [PATCH 1/1] " zimoun
  2021-11-16 13:02 ` [bug#51888] [PATCH 0/1] " Julien Lepiller
@ 2021-11-19 11:59 ` Julien Lepiller
  2021-11-19 12:00 ` bug#51888: " Julien Lepiller
  3 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2021-11-19 11:59 UTC (permalink / raw)
  To: zimoun; +Cc: 51888

Pushed to master as b5d51bb19e790baee9b16a3325397ec92d8e7625, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#51888: [PATCH 0/1] import: opam: Warn instead of leave when fetching fails.
  2021-11-16 10:10 [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails zimoun
                   ` (2 preceding siblings ...)
  2021-11-19 11:59 ` Julien Lepiller
@ 2021-11-19 12:00 ` Julien Lepiller
  3 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2021-11-19 12:00 UTC (permalink / raw)
  Cc: 51888-done

Forgot to close.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-19 12:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-16 10:10 [bug#51888] [PATCH 0/1] import: opam: Warn instead of leave when fetching fails zimoun
2021-11-16 10:12 ` [bug#51888] [PATCH 1/1] " zimoun
2021-11-16 13:02 ` [bug#51888] [PATCH 0/1] " Julien Lepiller
2021-11-16 15:33   ` zimoun
2021-11-19 11:59 ` Julien Lepiller
2021-11-19 12:00 ` bug#51888: " Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).