| 1 |
Test installing files from inside a symlinked directory. |
| 2 |
The source has a symlink to a directory, we install files from inside it (via the symlink), |
| 3 |
but don't install the directory symlink itself. |
| 4 |
|
| 5 |
$ export DUNE_CACHE=enabled |
| 6 |
$ export DUNE_CACHE_ROOT=$PWD/_cache |
| 7 |
|
| 8 |
$ make_lockdir |
| 9 |
|
| 10 |
Create a source with a directory symlink. We install files through the symlink |
| 11 |
but not the symlink itself. Use cp -P to preserve symlinks so our resolution |
| 12 |
code is exercised: |
| 13 |
|
| 14 |
$ make_lockpkg foo <<EOF |
| 15 |
> (version 0.0.1) |
| 16 |
> (build |
| 17 |
> (system "\ |
| 18 |
> true BUILDING_FOO_PACKAGE \ |
| 19 |
> && mkdir -p real_dir \ |
| 20 |
> && printf 'real content\n' > real_dir/real.txt \ |
| 21 |
> && ln -s real.txt real_dir/link.txt \ |
| 22 |
> && ln -s real_dir link_to_dir \ |
| 23 |
> && mkdir -p %{lib}/%{pkg-self:name} \ |
| 24 |
> && cp link_to_dir/real.txt %{lib}/%{pkg-self:name}/ \ |
| 25 |
> && cp -P link_to_dir/link.txt %{lib}/%{pkg-self:name}/ \ |
| 26 |
> && touch %{lib}/%{pkg-self:name}/META")) |
| 27 |
> EOF |
| 28 |
|
| 29 |
$ cat > dune-project <<EOF |
| 30 |
> (lang dune 3.22) |
| 31 |
> (package |
| 32 |
> (name x) |
| 33 |
> (allow_empty) |
| 34 |
> (depends foo)) |
| 35 |
> EOF |
| 36 |
|
| 37 |
$ build_pkg foo |
| 38 |
|
| 39 |
$ count_trace BUILDING_FOO_PACKAGE |
| 40 |
1 |
| 41 |
|
| 42 |
The symlink is resolved by dune's symlink resolution code: |
| 43 |
|
| 44 |
$ dune_cmd stat kind $(get_build_pkg_dir foo)/target/lib/foo/link.txt |
| 45 |
regular file |
| 46 |
|
| 47 |
$ dune_cmd stat hardlinks $(get_build_pkg_dir foo)/target/lib/foo/real.txt |
| 48 |
3 |
| 49 |
|
| 50 |
Caching works: |
| 51 |
|
| 52 |
$ rm -rf _build |
| 53 |
$ build_pkg foo |
| 54 |
$ count_trace BUILDING_FOO_PACKAGE |
| 55 |
0 |