These are good remarks, there is room for improvement here.

> In my install command, I'd like to do something like "cp _build/*
> %{foo:lib}%". However, AFAICT there is no way to make opam interpret the
> glob pattern. For now, I'm putting the command in a shell script and having
> opam call that shell script. That's slightly roundabout, and I'm wondering
> if I can avoid it.

I'm quite wary of adding more interpretation to the handling of scripts, it's 
good to keep them as simple as possible, avoiding another layer or make-like 
tools. We could, however, provide a nicer way to provide shell interpretation, 
or running the script from a sub-directory though (the only way for that is 
`["sh "cd subdir/ && cmd"]`).

So currently, if you want to do it directly from the opam file, you're limited 
to:

    [ "sh" "-c" "cp _build/* %{foo:lib}%" ]

> Also in the above I'm using the package name "foo" explicitly. Is there any
> way to combine with %{name}%? I effectively want %{%{name}%:lib}%, but
> nested variables don't work.

Unqualified variables default to the current package (e.g. "name", "installed" 
are short for "foo:name", "foo:installed"), unless that clashes with a global 
variable. This is unfortunately the case for the "lib" variable; I'd be open to 
a better design (allow ":lib" ? "_:lib" ? Make it mandatory for all vars to 
avoid ambiguity ?)

I'm afraid you're stuck with 'foo:name' at the moment, but I agree it's not 
ideal.

Ideas to improve on these welcome!

Louis

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
opam-devel mailing list
[email protected]
http://lists.ocaml.org/listinfo/opam-devel

Reply via email to