-
Notifications
You must be signed in to change notification settings - Fork 358
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
[WIP] Move most of the external tools calls to a single module #3217
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,125 @@ | |||
(**************************************************************************) | |||
(* *) | |||
(* Copyright 2018 OCamlPro *) |
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 isn't copyright ocamlpro :)
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 was just copying the header from the other files. Should I put my name instead ?
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, in this instance I think it depends - is the module predominantly just refactoring?
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, I think so.
|
||
let to_string (cmd, args) = | ||
(* TODO: Add backslashs to quotes for each args *) | ||
let quote x = if String.contains x ' ' then "'" ^ x ^ "'" else x 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.
This quoting logic seems like it might be replicated elsewhere in opam. Bos
also has 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.
Thanks, I'll look around. I tried to be as close as the original code as possible (modulo quoting that is added because that seemed broken anyway)
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.
Note that backslash-quoting in single quotes doesn't work for the shell. You have to write e.g. 'foo'\''bar
; and tabs should also be supported.
Thanks. I would have liked to discuss this beforehand, but I think it's a good idea. A few comments:
These are details, but gathering the commands like this is a good thing and changing from a list to a One last thing, if you find the combination of |
Also in the medium term, it would be good to start vendoring in things like ocaml-tar or ocaml-git to reduce the dependency on external tools by default. That might affect the consideration of names for this module... |
This PR aims at improving the way of describing and looking for external programs calls. This should also ease portability checks for Windows (cc @dra27) and minimal distributions such as Alpine Linux for example by checking which packages to install, what options are not available on the distribution/OS you want to port opam on.
Related to #3197
This is WIP because of some
assert false
to fill up insrc/format/opamFile.ml
and calls toOpamExternalTools.custom
for Git/Hg/Darcs/…Also I would know if the change to the API is ok before continuing further.