fix(hw-oracle): ignore a relative XDG_CACHE_HOME when choosing the build cache #12815
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12815"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T10:59:18Z.
What
hw_oracle.pypicked its build cache asHW_ORACLE_CACHE, then$XDG_CACHE_HOME/anyps5-hw-oracle, then~/.cache/anyps5-hw-oracle, and it usedXDG_CACHE_HOMEexactly as given. The XDG Base Directory specification says a relative path in these variables is invalid and must be ignored. With a relative value, the oracle was built under whatever directory the tool happened to start in. This PR moves the choice intocache_directory(environment), which falls back to~/.cachewhenXDG_CACHE_HOMEis relative.HW_ORACLE_CACHEkeeps its current behaviour: it overrides everything, is used as given, and an empty value falls through.docs/dev/HW_ORACLE.md(the cache sentence from #12719) now says "unset, empty or relative".CacheDirectoryTestschecks 7 environments (unset, empty,relative/cache,., absolute, an override with a relative XDG value, an empty override with an absolute XDG value). It also checks the module-levelCACHEby importing it in a subprocess with a relativeXDG_CACHE_HOME. On main'shw_oracle.pythe new tests fail with 7 errors and 1 failure; with this change all pass.Tested
python -m unittest test_hw_oracleOK (skipped=3) on /usr/bin/python3 (3.9), Homebrew 3.13 and 3.15.ctest: 489/489.check_conventions.py --base upstream/mainpassed;pr_overlap.py --branch fix/hw-oracle-relative-xdg-cacheprobed 1388 open PRs. 3 share files and all 3 merge cleanly, so there is no overlap.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-29T11:25:43Z.
Review: APPROVED
Reviewed exact head 1a9ee6ff904b639c7584a2614fce91612a565c4a. I independently reproduced the base behavior with XDG_CACHE_HOME=relative/cache: current main selects relative\cache\anyps5-hw-oracle. On this head, Windows Python 3.12 falls back to C:\Users\Malek\.cache\anyps5-hw-oracle; the two CacheDirectoryTests pass; the full hw-oracle suite passes on Python 3.12 and 3.9 (50 tests, 4 platform skips each); conventions and diff-check are clean. I also copied the exact head into WSL/Python 3.12.3: relative XDG_CACHE_HOME falls back to /home/malek/.cache/anyps5-hw-oracle, both focused tests pass, and the full suite passes 50 tests with 2 expected skips. The explicit HW_ORACLE_CACHE override remains unchanged. I found no blocking issue in the cache-directory change.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T11:32:16Z.
Review: APPROVED
Re-checked exact current head da7dfe55c743f444fcb71ce67aae40919169c847. hw_oracle.py, test_hw_oracle.py and docs/dev/HW_ORACLE.md are byte-identical to the exact head I previously reviewed, so the cache-directory behavior and regression are unchanged. Current-main merge-tree is clean and git diff --check passes. My prior Windows/WSL relative-XDG_CACHE_HOME reproduction and full-suite validation still apply. No blocking issue found on this pure rebase.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T18:22:52Z.
Review: APPROVED
Re-checked exact current head
f45cb5f380after the latest rebase. The three reviewed files (tools/hw-oracle/hw_oracle.py, tools/hw-oracle/test_hw_oracle.py, docs/dev/HW_ORACLE.md) are byte-identical to previously approved head da7dfe55c743f444fcb71ce67aae40919169c847. Current-maincde94eb55amerge-tree is clean (tree 00c4fae78154de5e9ccf3c536719ba03947ba4e8), and git diff --check passes. My prior Windows/WSL reproduction and full-suite validation still apply. No blocking issue found on this pure rebase.