Skip to content

fix(pkg): .files handling in lock rules #13403

Draft
Alizter wants to merge 5 commits intoocaml:mainfrom
Alizter:push-lttumllzuuuw
Draft

fix(pkg): .files handling in lock rules #13403
Alizter wants to merge 5 commits intoocaml:mainfrom
Alizter:push-lttumllzuuuw

Conversation

@Alizter
Copy link
Collaborator

@Alizter Alizter commented Jan 20, 2026

The rules we have for working with .files in pkg_rules.ml are incorrectly accessing the "source" location of the lock files rather than the common internal lock directory that gets either copied or generated. This means that dev tools and autolocking cannot work with extra files.

This PR is a rough attempt at making the rules inspect the correct place, but it is still drafty due to lack of time. @punchagan will instead take over and try to fix it up.

let+ file_set = Build_system.files_of ~dir:files_dir_path in
Some build_path, Filename_set.filenames file_set
| _ ->
let files_dir_path_no_version = Pkg.files_dir info.name None ~lock_dir in
Copy link
Collaborator

Choose a reason for hiding this comment

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

I pushed a fix to allow files to live in un-versioned directory. This fixes some of the failing tests.

let* exists = Build_system.file_exists files_dir_path in
match exists, Path.as_in_build_dir files_dir_path with
| true, Some build_path ->
let+ file_set = Build_system.files_of ~dir:files_dir_path in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build_system.files_of ignores any sub-directories and files in them. Only the top-level files are returned, which is a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the wrong thing to be using here unfortunately. I didn't have time to think about the correct way. Do you have examples of extra files with subdirectories?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The failing test in CI is an example.

test/blackbox-tests/test-cases/pkg/opam-package-with-patch-multiple.t

@Alizter Alizter changed the title fix: .files handling fix(pkg): .files handling in lock rules Jan 22, 2026
@punchagan punchagan self-assigned this Jan 22, 2026
Alizter and others added 5 commits February 4, 2026 16:28
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.

pkg: dune with pkg enabled fails to build an oxcaml project without a lock

2 participants