-
Notifications
You must be signed in to change notification settings - Fork 410
/
run.t
123 lines (99 loc) · 3.18 KB
/
run.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
`dune install` should handle destination directories that don't exist
$ cat > dune <<EOF
> (install
> (section man)
> (files
> (man-page-a.1 as man-page-a.%{context_name}.1) ; incorrect usage!
> (man-page-b.1 as man1/man-page-b.%{context_name}.1)
> another-man-page.3)
> )
> EOF
$ dune build @install
$ dune install --prefix install --libdir $PWD/install/lib
Installing $TESTCASE_ROOT/install/lib/foo/META
Installing $TESTCASE_ROOT/install/lib/foo/dune-package
Installing $TESTCASE_ROOT/install/lib/foo/opam
Installing install/man/man-page-a.default.1
Installing install/man/man1/man-page-b.default.1
Installing install/man/man3/another-man-page.3
$ dune_cmd cat _build/default/foo.install | grep man
man: [
"_build/install/default/man/man-page-a.default.1" {"man-page-a.default.1"}
"_build/install/default/man/man1/man-page-b.default.1"
"_build/install/default/man/man3/another-man-page.3"
Some variables are restricted in [dst] of [bin] section because evaluating
them could cause a dependency cycle (also, most of them make no sense in [dst] anyway).
$ cat > dune <<EOF
> (install
> (section bin)
> (files (foobar.txt as "%{env:FOO=foobar}/foo.txt"))
> )
> EOF
$ dune build @install
File "dune", line 3, characters 25-42:
3 | (files (foobar.txt as "%{env:FOO=foobar}/foo.txt"))
^^^^^^^^^^^^^^^^^
Error: %{env:..} isn't allowed in this position.
[1]
This is not a problem outside of bin section:
$ cat > dune <<EOF
> (install
> (section man)
> (files (foobar.txt as "%{env:FOO=foobar}/foo.txt"))
> )
> EOF
$ dune build @install
Extension of [src] can't use the restricted variables either because
addition of .exe suffix to dst on Windows is conditional on the
extension of [src]:
$ cat > dune <<EOF
> (install
> (section bin)
> (files (%{env:FOO=foobar.txt} as foo.txt))
> )
> EOF
$ dune build @install
File "dune", line 3, characters 10-31:
3 | (files (%{env:FOO=foobar.txt} as foo.txt))
^^^^^^^^^^^^^^^^^^^^^
Error: Because this file is installed in the 'bin' section, you cannot use
the macro %{env:..} in its basename.
[1]
This is fine if the destination extension is already .exe:
$ cat > dune <<EOF
> (install
> (section bin)
> (files (%{env:FOO=foobar.txt} as foo.exe))
> )
> EOF
$ dune build @install
Or if the extension of source is clearly not .exe:
$ cat > dune <<EOF
> (install
> (section bin)
> (files (%{env:FOO=foobar}.txt as foo))
> )
> EOF
$ dune build @install
Exe basename needs to be fully known if dst is missing though:
$ cat > dune <<EOF
> (install
> (section bin)
> (files %{env:FOO=foobar}.txt)
> )
> EOF
$ dune build @install
File "dune", line 3, characters 9-26:
3 | (files %{env:FOO=foobar}.txt)
^^^^^^^^^^^^^^^^^
Error: Because this file is installed in the 'bin' section, you cannot use
the macro %{env:..} in its basename.
[1]
When basename is fully known, all is well:
$ cat > dune <<EOF
> (install
> (section bin)
> (files %{env:FOO=.}/foobar.txt)
> )
> EOF
$ dune build @install