Skip to content

fix(package-deps): follow library-induced package closure - #16362

Open
Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:push-nqsuumtwqqly
Open

Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:push-nqsuumtwqqly

Conversation

@Alizter

@Alizter Alizter commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Include whole packages reached through library dependencies and track installed file changes. For packages in the lock directory, we have no easy way of getting the libraries directly, so instead we use the direct package closure which is already computed.

When we start loading sources directly, this distinction with the old "package universe" will no longer exist, so I think its fine for it to work like this for now.

Comment thread src/dune_rules/package_db.ml Outdated
Comment thread src/dune_rules/dep_conf_eval.ml Outdated
@Alizter
Alizter force-pushed the push-nqsuumtwqqly branch 12 times, most recently from 5480ec2 to ec579f2 Compare September 15, 2026 12:07
Include whole packages reached through library dependencies and track
installed file changes.

Fixes ocaml#15511

The melange closure is not traversed.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter
Alizter marked this pull request as ready for review September 16, 2026 11:22
@Alizter

Alizter commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

This currently breaks CI because nix is compressing man pages and making the dune-package manifest incorrect. There are a few ways we can fix this:

  1. Fix the nix derivations so they don't compress the man pages of the packages we depend on. This is tedious to maintain.
  2. Ignore invalid doc entries in package deps, as requested here Please ignore doc files in (package pkg) #14364. Seems sensible but could be a footgun for consumers of docs like odoc.
  3. Support compression of manpages directly. Seems sensible but a lot of work.

1 seems the best as a temporary solution. I don't know if there is anything else we can do here.

Library-induced package dependencies make (package utop) also track
lambda-term. Nix compression leaves its dune-package manifest pointing
to missing uncompressed manpages.

Extend the existing utop workaround to lambda-term so the CI shell keeps
the installed files consistent with the manifest.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Comment thread src/dune_rules/lib.ml
| Found of Lib_info.external_
| Hidden of Lib_info.external_ Hidden.t
| Found of Lib_info.external_ * Package.Name.t option
| Hidden of Lib_info.external_ Hidden.t * Package.Name.t option

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it become easier if you just put the data in the Lib_info.t? In fact, can't we use the package info that's already there. It might need augmenting for external libraries like you did here, but it's consistent with the rest of the code.

Comment thread src/dune_rules/lib.ml
let+ package =
let* lock_dir_active = Pkg_rules.lock_dir_active context_name in
if lock_dir_active
then Pkg_rules.find_package_by_installed_path context_name dir

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need to do this. Why not return package_name always?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In the future release, deps does not load package dependencies transitively

2 participants