Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with opam2 info -f #2980

Closed
dbuenzli opened this issue Jul 2, 2017 · 6 comments · Fixed by #3867
Closed

Problems with opam2 info -f #2980

dbuenzli opened this issue Jul 2, 2017 · 6 comments · Fixed by #3867

Comments

@dbuenzli
Copy link
Contributor

dbuenzli commented Jul 2, 2017

  1. Cannot query a field in two version the same package and yields a dubious error message.
bash-4.3$ opam info -f license: react.1.0.0 react.1.2.0 
[ERROR] No package matching react.1.0.0 or react.1.2.0 found
  1. Not sure what the rationale is but it seems that a colon has to be added at the end of field names and while this is helpful:
bash-4.3$ opam info -f license react.1.0.0 
[ERROR] No printer for "license". Did you mean the opam field "license:" (with a colon) ?

This is not:

bash-4.3$ opam info -f url.src react.1.0.0 
[ERROR] No printer for "url.src"

bash-4.3$ opam info -f url.src: react.1.0.0 
http://erratique.ch/software/react/releases/react-1.0.0.tbz
@dbuenzli
Copy link
Contributor Author

dbuenzli commented Jul 2, 2017

Forgot to add

bash-4.3$ opam --version 
2.0.0~beta3

@dbuenzli
Copy link
Contributor Author

dbuenzli commented Jul 2, 2017

Not sure what the rationale is but it seems that a colon has to be added at the end of field names

Also this is inconsistent with other opam related tools, e.g. opam-ed.

@rjbou
Copy link
Collaborator

rjbou commented Jun 11, 2019

opam show is written in a way only one package is choose on the set of corresponding packages (opam show react is a 7 packages set). It avoid printing duplicated information. Another way to do, is if a package is present several times in command line print all matching one. While when querying fields, it's clear :

$ ./opam show react.1.2.1 react.1.2.0 -f license:
"BSD3"
"ISC"

It makes standard output quite over-verbose by its redundancy:

./opam show react.1.2.1 react.1.2.0 
dune build --profile=release  opam-installer.install opam.install

<><> react: information on all versions <><><><><><><><><><><><><><><><><><><><>
name                   react
all-installed-versions 1.2.1 
all-versions           0.9.3  0.9.4  1.0.0  1.0.1  1.1.0  1.2.0  1.2.1

<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version       1.2.0
repository    mirror
url.src:      "http://erratique.ch/software/react/releases/react-1.2.0.tbz"
url.checksum: "md5=f071a1308b6cad131c55cda8677823c3"
homepage:     "http://erratique.ch/software/react"
bug-reports:  "https://github.com/dbuenzli/react/issues"
dev-repo:     "git+http://erratique.ch/repos/react.git"
authors:      "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
maintainer:   "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
license:      "BSD3"
tags:         "reactive" "declarative" "signal" "event" "frp" "org:erratique"
depends:      "ocaml" {>= "4.00.0" & < "4.06.0"} "ocamlfind" "ocamlbuild" {build}
synopsis      Declarative events and signals for OCaml
description   React is an OCaml module for functional reactive programming (FRP). It
              provides support to program with time varying values : declarative
              events and signals. React doesn't define any primitive event or
              signal, it lets the client chooses the concrete timeline.
              React is made of a single, independent, module and distributed under
              the BSD3 license.

<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version       1.2.1
repository    mirror
url.src:      "http://erratique.ch/software/react/releases/react-1.2.1.tbz"
url.checksum: "md5=ce1454438ce4e9d2931248d3abba1fcc"
homepage:     "http://erratique.ch/software/react"
bug-reports:  "https://github.com/dbuenzli/react/issues"
dev-repo:     "git+http://erratique.ch/repos/react.git"
authors:      "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
maintainer:   "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
license:      "ISC"
tags:         "reactive" "declarative" "signal" "event" "frp" "org:erratique"
depends:      "ocaml" {>= "4.01.0"}
              "ocamlfind" {build}
              "ocamlbuild" {build}
              "topkg" {build & >= "0.9.0"}
synopsis      Declarative events and signals for OCaml
description   Release %%VERSION%%
              React is an OCaml module for functional reactive programming (FRP). It
              provides support to program with time varying values : declarative
              events and signals. React doesn't define any primitive event or
              signal, it lets the client chooses the concrete timeline.
              React is made of a single, independent, module and distributed under
              the ISC license.

It's more consistent although...

@dbuenzli
Copy link
Contributor Author

Mmmh that was opened two years ago. I'm not sure what problem I was trying to solve here.

However from an UI perspective I still don't understand why the final : is needed to query fields and as far as I'm concerned I still have:

> opam --version
2.0.4
> opam show react.1.2.1 react.1.2.0 -f license:
[ERROR] No package matching react.1.2.1 or react.1.2.0 found

@AltGr
Copy link
Member

AltGr commented Jun 12, 2019

The reason is that the package specification is interpreted as for opam install or constraints: a package matches if its named and all version constraints match, i.e. it's an or between package names, but an and for constraints on the same name. So e.g. opam show react'>='1.2.0' here would have worked, except for the point that @rjbou already mentionned.

This behaviour indeed makes much less sense for opam show, though, which could behave more like opam list (with a similar --all-versions) option.

@rjbou
Copy link
Collaborator

rjbou commented Jun 12, 2019

For several packages, there is #3867.
For the colon issue, discussion better take place in #3664, as duplicated & dedicated.

@rjbou rjbou added this to the 2.1.0 milestone Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants