ocaml / oasis2opam

Tool to convert OASIS metadata to OPAM package descriptions
27 stars 11 forks source link

Default flag value and depopt/test #29

Closed gildor478 closed 7 years ago

gildor478 commented 7 years ago

See https://github.com/ocaml/opam-repository/pull/8031

I have the following in my _oasis:

Flag quickstart_tests                                                           
  Description: Build test-quickstart                                            
  Default: true   

[...]

Executable "test-quickstart"                                                    
  Path: test/test-quickstart                                                    
  MainIs: TestQuickstart.ml                                                     
  Install: false                                                                
  CompiledObject: best                                                          
  Build$: flag(tests) && flag(quickstart_tests)                                 
  BuildDepends: oUnit (>= 2.0.0), findlib, fileutils (>= 0.4.2),                
                expect.pcre (>= 0.0.4), oasis, oasis.builtin-plugins,           
                test-common 

The generated opam:

build-test: [
  ["ocaml" "setup.ml" "-configure" "--enable-tests"]
  ["ocaml" "setup.ml" "-build"]
  ["ocaml" "setup.ml" "-test"]
]
build-doc: [ "ocaml" "setup.ml" "-doc" ]
depends: [
  "base-unix"
  "camlp4" {test}
  "fileutils" {test & >= "0.4.2"}
  "ocamlbuild"
  "ocamlfind" {>= "1.3.1"}
  "ocamlify" {build}
  "ocamlmod" {build}
  "omake" {test}
  "ounit" {test & >= "2.0.0"}
  "pcre" {test}
]
depopts: [
  "benchmark"
  "expect"
]
conflicts: [
  "benchmark" {< "1.2"}
  "expect" {< "0.0.4"}
  "oasis-mirage" {= "0.3.0"}
  "oasis-mirage" {= "0.3.0a"}
]

And the following error when building:

# ocamlfind: Package `expect.pcre' not found
# W: Field 'pkg_expect_pcre' is not set: Command ''/home/travis/.opam/4.03.0/bin/ocamlfind' query -format %d expect.pcre > '/tmp/oasis-402383.txt'' terminated with error code 2
# E: Cannot find findlib package expect.pcre (>= 0.0.4)
# E: Failure("1 configuration error")

What I expect is to have either:

Chris00 commented 7 years ago

The dev version of oasis2opam generates:

depends: [
  "base-unix"
  "camlp4" {test}
  "expect" {test & >= "0.0.4"}
  "fileutils" {test & >= "0.4.2"}
  "ocamlbuild"
  "ocamlfind" {>= "1.3.1"}
  "ocamlify" {build}
  "ocamlmod" {build & test}
  "omake" {test}
  "ounit" {test & >= "2.0.0"}
  "pcre" {test}
]
depopts: [
  "benchmark"
]
conflicts: [
  "benchmark" {< "1.2"}
  "oasis-mirage" {= "0.3.0"}
  "oasis-mirage" {= "0.3.0a"}
]
Chris00 commented 7 years ago

Notice that oasis2opam issue warnings on https://forge.ocamlcore.org/frs/download.php/1669/oasis-0.4.8.tar.gz about oasis.install and _oasis_remove_.ml. It would be good to add those files to the tarball.

Chris00 commented 7 years ago

See https://github.com/ocaml/opam-repository/pull/8040

Chris00 commented 7 years ago

It seems build & test is causing a problem, not implying build (even though the manual seem to say so).

gildor478 commented 7 years ago

_oasis_remove_.ml was the thing used to "chdir" ? If this is the case, it should not be useful anymore and it would be better to remove it.

Concerning the the oasis.install, I thought it belonged to the packaging and should be in opam/files (I read it in the manual). Why would the upstream author have to provide this file?

Chris00 commented 7 years ago

About _oasis_remove_.ml, good to know that the -C flag is available in the latest release. I've updated oasis2opam and the PR for oasis.

For oasis.install, the OPAM manual indeed talks about that file without expressing a clear preference. A discussion — somewhere on Github I think — made clear however that <pkg>.install files are not welcome in the opam-repository in order not to "pollute" everybody with extra files that may not be useful for them.

gildor478 commented 7 years ago

Forking the discussion in #30 and #31 so that we can close this bug.