Respect chained symlink structure when copying files to the nix-gl-host cache
# Issue
When copying libraries to the `nix-gl-host` cache, the current code uses `shutil.copyfile()` which follows symlinks and copies the actual file content.
This breaks in some situations where code expects the typical chains of symlinks (e.g. `libcuda.so` -> `libcuda.so.1` -> `libcuda.so.565.57.01`).
# Patch
The changes in this PR basically make sure to only copy the *actual* library and then simply reproduce the symlinks chains, which are usually relative to the current directory:
```
> ls -la /usr/lib/x86_64-linux-gnu/ | grep libcuda.so
lrwxrwxrwx 1 root root 12 Oct 15 2024 libcuda.so -> libcuda.so.1
lrwxrwxrwx 1 root root 20 Oct 15 2024 libcuda.so.1 -> libcuda.so.565.57.01
-rw-r--r-- 1 root root 49554296 Oct 10 2024 libcuda.so.565.57.01
```
The `nix-gl-host` cache now looks like this:
```
> cd ~/.cache/nix-gl-host/.../cuda && ls -la | grep libcuda.so
lrwxrwxrwx 1 me me 12 Oct 3 13:00 libcuda.so -> libcuda.so.1
lrwxrwxrwx 1 me me 20 Oct 3 13:00 libcuda.so.1 -> libcuda.so.565.57.01
-rw-rw-r-- 1 me me 49576080 Oct 3 13:00 libcuda.so.565.57.01
```
合并状态:未合并 0 条评论