pmb.helpers.pmaports: Add must_exist to cache signature for find()

As must_exist affects the return value of this function by changing it
from returning None to raising an exception, we need to include it in
the cache key. Otherwise, the must_exist value effectively gets "stuck"
on whatever value it was set to when the given cache key was created.

This causes weird issues, see [1] and [2]. As such, include it in the
cache signature to fix this.

 [1]: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2601
 [2]: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6507#note_481093

Supersedes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2601
Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2610

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2604
This commit is contained in:
Newbyte 2025-05-21 22:30:02 +02:00 committed by Oliver Smith
parent 740a5717d9
commit 15007e17d2
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -206,7 +206,7 @@ def find(
) -> Path | None: ...
@Cache("package", "subpackages", "with_extra_repos")
@Cache("package", "must_exist", "subpackages", "with_extra_repos")
def find(
package: str,
must_exist: bool = True,