-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support package pinning via http+tar #11446
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The ZIP file changes can be added in a separate PR if you want, but I think that it would be useful to support it given it is a rather common format, especially on Windows.
2182db3
to
5992d48
Compare
@maiste I've looked into the |
@@ -23,6 +23,29 @@ let of_opam_url loc url = | |||
>>| User_error.ok_exn | |||
in | |||
Git rev | |||
| `Tar -> | |||
let dir = Path.Build.(L.relative root [ "_fetch"; "url" ]) |> Path.build in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we put this into _fetch? Is this to attempt to make the build system to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. Is there a better to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a way to do this at the moment. Whatever you write here will be removed by dune anyway. Might as well use a temp dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to respect the structure for Dune so it doesn't have to redo the work twice. Isn't it supposed to consider it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that will work. Dune writes a metadata file describing its state of the workspace local cache. If you didn't update this file, it will just delete what you have put in there.
src/dune_pkg/mount.ml
Outdated
raise (User_error.E message) | ||
| Ok output -> | ||
let target = | ||
let file_digest = Digest.file (Path.to_string output) |> Digest.to_hex in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.to_string |> Digest.file |> Digest.to_hex
@@ -46,3 +46,14 @@ let extract ~archive ~target = | |||
Path.rename target_in_temp target; | |||
Ok () | |||
;; | |||
|
|||
let load_or_untar ~target ~archive = | |||
match Path.exists target with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the tar file is updated remotely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand the point of this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we plan to support tarballs on the file system?
No, we expect people to untar directory themselves on the file system and point to the path. I don't think it is worth adding the machinery for this as there is already one for
If the file is updated remotely:
I don't think we have a proper when to address it. If we checked on every run, people would have to download the tar file every time they run I would expect people to want to be aware when the checksum change, but having to explicitly state when they want to synchronize the checksum. It would prevent them from downloading tar they don't expect to change. |
I think we should re-download the tarball and construct the checksum every time we run You could still avoid re-downloading if you use curl with the correct e-tag incantations. |
I agree with you, and this is what happens in the current situation. If you run Regarding the |
Okay, thanks. Is there a test that demonstrates that subsequent |
I'm rewriting my test to show the behavior. It should be ready for a next review round by the end of the day 👍 |
Signed-off-by: Etienne Marais <[email protected]>
Co-authored-by: ArthurW <[email protected]> Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
Co-authored-by: Marek Kubica <[email protected]> Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
Signed-off-by: Etienne Marais <[email protected]>
5992d48
to
6a41320
Compare
This PR reduces the gap between opam and dune package management functionnalities. It allows users to ping a tar file (gz or bz) using
http
(andhttps
) protocol.Closes #10121