-
Notifications
You must be signed in to change notification settings - Fork 409
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
Do not use opam-installer to copy files #941
Conversation
bin/main.ml
Outdated
Io.copy_file () ~src ~dst | ||
~chmod:(match section with | ||
| Libexec -> (fun x -> x lor 0o111) | ||
| _ -> (fun x -> x)) |
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.
opam-installer
will clear the executable bit in the other cases, so it should be something like x land 0o666
. (I'd recommend extracting set_executable_bits
and clear_executable_bits
function as well)
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 for the pointer, I realized we also need to add Lib_root
and Libexec_root
. I updated the code
; man = Path.relative destdir "man" | ||
; lib = Path.relative libdir package | ||
; libexec = Path.relative libdir package | ||
; share = Path.relative destdir ("share/" ^ package) |
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.
Is it OK to concatenate paths like this? I guess package
is normalized already (so it does not contain slashes or ".."
), but also does it work on windows?
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.
There might be an issue here. However we were doing the same before and we have had no issue so far. I guess we could add a few more constraints on package names
bin/main.ml
Outdated
try | ||
f () | ||
with Unix.Unix_error (e, _, _) -> | ||
Format.fprintf err_ppf "@{<error>Error@}: %s@." |
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.
Out of curiosity, why is it not possible to print on stderr directly?
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.
actually, yes it's possible. I didn't remember stderr was configured to interpret styles
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.
Isn't this better to do it this way so that buffering is consistent?
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.
This is a synchronous call so it's not an issue
Could it be made to use |
we should do it in this PR if |
bin/main.ml
Outdated
if what = "install" then begin | ||
Printf.eprintf "Installing %s as %s\n%!" | ||
(Path.to_string src) | ||
(Path.to_string_maybe_quoted dst); |
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.
Just curious why we're printing paths differently here (not quoted vs maybe quoted)
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.
Actually I didn't mean to print src
as the lines are quite long already, it was just temporarily to debug something
bin/main.ml
Outdated
files_deleted_in := Path.Set.add !files_deleted_in dir; | ||
end; | ||
Path.Set.to_list !files_deleted_in | ||
|> List.rev |
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's the significance of doing it in this order?
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.
It is to make sure we delete sub-directories first. I added a comment
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
opam is currently not mandatory to use dune, however one still needs the external
opam-installer
binary in order to rundune install
ordune uninstall
. This is annoying, especially since this tool is quite simple.In order to make dune more self-contained, this PR reimplements
dune install
anddune uninstall
without calling out toopam-installer
.