Use tar library instead of tar tool for some operations#6945
Open
rjbou wants to merge 4 commits into
Open
Conversation
rjbou
commented
May 22, 2026
NathanReb
reviewed
May 27, 2026
| let tar = Tar_gz.out_gzipped ~level:4 ~mtime:0l Gz.Unix tar in | ||
| let buf = Buffer.create 10_485_760 in | ||
| to_buffer buf tar; | ||
| let str = Buffer.contents buf in |
Collaborator
There was a problem hiding this comment.
Do we have to go through this buffer to then allocate the whole string to then write to a Unix file descriptor?
Couldn't we write a to_fd function directly instead of the to_buffer one?
Is it so that we don't overwrite the original archive in case an error occurs? If so, then it's probably worth a comment or a bit of documentation.
Collaborator
Author
There was a problem hiding this comment.
Opening issue to follow up #6950, if there is performance benefit
| in | ||
| let entries = | ||
| let dispenser = | ||
| Map.fold (fun path content acc -> |
Collaborator
There was a problem hiding this comment.
How about using to_seq followed by Seq.map here?
Was the manual construction of the Seq intentional? Is it a performance issue?
Collaborator
Author
|
I've updated the PR taking into account some remarks. I'll let @kit-ty-kate answer |
e0283a1 to
aa32ae4
Compare
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds in the API functions to manipulate
tar.gzarchives and use it to create archives in the code.This new
OpamTarmodule will be used in #6625 to open and read archives (internal representation of some repositories) without io.Original work done by @kit-ty-kate
In the story of #6625