Interaction between opam and dune broken w/ (opam_file_location inside_opam_directory)
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Expected Behavior
I realize that (opam_file_location inside_opam_directory) is not being advertised, but I think the opam_file_location feature will cause problems if people start using it. Consider this a tracking issue. This is marginally related to open issue #7534 as well.
With a dune-project file:
(lang dune 3.12)
(name DkSDKMetatype)
(version 1.0.0)
(generate_opam_files true)
(opam_file_location inside_opam_directory)
(package
(name DkSDKMetatype_Common)
(depends
(ocaml (>= 4.14.0))
(semver2 (>= 1.2.0))))
and a basic dune file:
(documentation
(package DkSDKMetatype_Common))
(include_subdirs unqualified)
(library
(name DkSDKMetatype_Common)
(public_name DkSDKMetatype_Common)
(libraries semver2)
(instrumentation (backend bisect_ppx)))
when I run:
opam exec -- dune build '@opam/all' # generates opam/ folder correctly
opam install ./opam/DkSDKMetatype_Common.opam --verbose --debug-level 2
I expect the OPAMSWITCH/lib/DkSDKMetatype_Common/ folder to be populated with compiled artifacts like DkSDKMetatype_Common.cma.
Actual Behavior
Instead, I get only three files:
Y:\SOURCE\DKSDK-TYPE\_OPAM\LIB\DKSDKMETATYPE_COMMON
dune-package
META
opam
What is happening is obvious from the opamlog.txt opam install logs:
rsync ... /y/source/dksdk-type/opam/ /y/source/dksdk-type/_opam/.opam-switch/sources/DkSDKMetatype_Common
Instead of copying the real source folder, opam is copying the opam/ subfolder. And then launching a dune build from inside that (incorrect) source folder.
Mitigation
Either:
opam install .works. But that installs all of the packages in the source tree which is sometimes undesirable.- Pinning the packages to the source directory (ie.
git+file://$PWD/.git) and then installing whichever packages you want.
Specifications
- Version of
dune(output ofdune --version): 3.12.1 - Version of
ocaml(output ofocamlc --version) - opam version:
2.2.0~alpha0~20221228 - Operating system (distribution and version): Windows 11 Pro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied dune-project and dune files, then reproduce the issue using dune build '@opam/all' followed by the shown opam install command. Compare the opam install log with the generated source layout and verify that installing the selected package uses the real source directory and populates its switch library directory with compiled artifacts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100