Skip to content

vendor: ocaml vendoring utility - #13097

Closed
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-szwzooutqoux
Closed

vendor: ocaml vendoring utility#13097
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-szwzooutqoux

Conversation

@Alizter

@Alizter Alizter commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

desc todo

@Alizter
Alizter force-pushed the push-szwzooutqoux branch 2 times, most recently from 8464cef to 750cbe3 Compare December 29, 2025 09:30
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Comment thread doc/hacking.rst
$ dune exec vendor/vendor_updater.exe -- patch cmdliner

# Validate that all patches are up to date
$ dune exec vendor/vendor_updater.exe -- lint

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.

How about we make check this a rule in vendor that is attached to runtest?


#if defined(_MSC_VER)
#include <windows.h>
#include <Windows.h>

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.

is this change intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Was changed in #11940 but not upstream. So this pulls it back in line. The Microsoft sources ship uppercase however according to this https://stackoverflow.com/a/15466951/2604678 mingw ships windows.h (CI doesn't seem to mind). Windows is case insensitive but cross-compiling with mingw shows this problem.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We need to update upstream rather than doing this change here. Alternatively we could just keep a patch around using the new mechanism here.

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.

Yeah, let's move out this change out of here. #11940 should have introduced a patch file

Comment thread vendor/vendor_updater.ml
Dune_console.Backend.set Dune_console.Backend.progress
;;

let () =

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.

All of this code should be moved outside of vendor/. This directory is reserved for the actual stuff that we vendor rather than our utility that we use to manage this code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My original plan was to put it in a subdirectory of vendor but (vendored_dirs) cannot do set minus.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will move it to a tools/ directory of the main repo.

Comment thread vendor/packages.ml
; preserve_rules : string list
}

let all_packages =

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.

Could you move this binding to a separate module that doesn't have any other code or type definitions in it. Would be good to have the file that we actually need to edit be as pristine as possible.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will introduce a sexp-based config file for it to read in the vendor/ directory.

I want to also introduce some cram tests to test the various behaviours we have. Just having it in the repo doesn't mean we didn't break it. Having the extra config file will aid testing.

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.

Please don't do that. It seems like a poor trade-off to introduce a hefty amount of sexp conversions just to make it easy to write cram tests. Write a different type of tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What about having both allowing us to override the packages in the tests. That way we don't incur the cost of sexp in normal usage and it is easy to test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You know what, I'll try both expect tests and cram tests in parallel and see which one ends up being better.

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.

What about having both allowing us to override the packages in the tests. That way we don't incur the cost of sexp in normal usage and it is easy to test.

Why is that you need sexps to create mock data for your utility? I can see many different ways to mock this data without any sexps.

You know what, I'll try both expect tests and cram tests in parallel and see which one ends up being better.

Whatever you go for, please don't introduce sexp deoders.

Comment thread vendor/vendor_updater.ml
(* Initialize Path module and console backend *)
let () =
(* Find project root by looking for dune-project *)
let rec find_up 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.

Why can't we use our existing root finding?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's copy-pasted since I didn't want to move it out of bin. I can put it in dune_util however for reuse.

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.

How about just stdune?

Comment thread Makefile

.PHONY: vendor-lint
vendor-lint: $(BIN)
@$(BIN) exec -- vendor/vendor_updater.exe lint

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.

As mentioned earlier, these checks should be defined as part of the runtest alias.

Comment thread vendor/fetch.ml
Console.printf "Patch applied successfully")
else
let+ () = Fiber.return () in
Console.printf "No patch file found for %s" package_name

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 think this message is just noise

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I will double check how it is printed when testing.

@Alizter Alizter mentioned this pull request Dec 29, 2025
@Alizter

Alizter commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

This would have been nice, but the current implementation has some problems which I didn't get round to fixing. For now we are stuck with the status quo until sombebody decides its important enough to revive.

@Alizter Alizter closed this Jun 26, 2026
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.

2 participants