Add the CACHEDIR.TAG file to the cache directory
Implement the http://www.brynosaurus.com/cachedir/ specification for the Zig cache directory.
This change will make it easier to exclude Zig cached data from a backup, expecially when the directory is not a well-known cache directory, like ~/.cache/zig or zig-cache.
Closes #8210
For @r00ster91: I don't why I don't see your comment here (maybe you deleted it?). I used the link http://www.brynosaurus.com/cachedir/ instead of the actual link after a redirect (https://bford.info/cachedir/) because this is what the specification suggested.
While it is true that the specification has not been updated since 2004, some implementations like Kopia use the original link.
On Linux the CI scripts fail with unimplemented. I'm not sure if this is related to this changeset.
The error from the CI is
[15/21] Running zig1.wasm to produce /home/ci/actions-runner1/_work/zig/zig/build-new/compiler_rt.c
FAILED: compiler_rt.c
cd /home/ci/actions-runner1/_work/zig/zig && /home/ci/actions-runner1/_work/zig/zig/build-new/zig1 /home/ci/actions-runner1/_work/zig/zig/lib build-obj lib/compiler_rt.zig -ofmt=c -OReleaseSmall --name compiler_rt -femit-bin="/home/ci/actions-runner1/_work/zig/zig/build-new/compiler_rt.c" --mod build_options::/home/ci/actions-runner1/_work/zig/zig/build-new/config.zig --deps build_options -target x86_64-linux
unimplemented
Aborted
[16/21] Running zig1.wasm to produce /home/ci/actions-runner1/_work/zig/zig/build-new/zig2.c
FAILED: zig2.c
cd /home/ci/actions-runner1/_work/zig/zig && /home/ci/actions-runner1/_work/zig/zig/build-new/zig1 /home/ci/actions-runner1/_work/zig/zig/lib build-exe src/main.zig -ofmt=c -lc -OReleaseSmall --name zig2 -femit-bin="/home/ci/actions-runner1/_work/zig/zig/build-new/zig2.c" --mod build_options::/home/ci/actions-runner1/_work/zig/zig/build-new/config.zig --deps build_options -target x86_64-linux
unimplemented
Should the tagCacheDirectory function be a no op when the target is wasm?
Thanks.
@Vexu I don't think this should be merged as-is because it should not block the rest of the compilation pipeline. I think it should be done as an asynchronous job that gets completed by performAllTheWork().
Anyway, closing this now since it's an abandoned PR that never passed the CI checks. @perillo can ask for help in the issue corresponding to this PR. I like to keep the PR queue filled with only patches that are considered ready for review & merge by their authors.