Fix #700: invalidate provider cache when its config changes#777
Open
phverg wants to merge 1 commit into
Open
Conversation
``Provider.status()`` only checked whether the cache directory existed on disk. Once a core had been fetched, FuseSoC happily reused the cached files for every subsequent run, even if the user had since changed the core's ``provider`` block — most notably the ``version`` field. So flipping ``version: v1.0.4-rc0`` to ``version: v1.0.4-rc1`` silently kept building against the rc0 sources, with the only workaround being to bump the core's own VLNV version. Persist a ``.fusesoc-provider-config.json`` marker inside the cache directory after each successful fetch. ``status()`` now reads it and flags the cache as ``outofdate`` whenever the current provider config no longer matches what was cached, which then triggers the existing clean-and-refetch path. Caches written by older FuseSoC versions don't have a marker; treat those as valid for backward compatibility and let the next fetch write a fresh marker so any future drift will be caught. Fixes olofk#700. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
This makes sense, but I need to think if there are some other implications of this. About to release a new FuseSoC version, so this fix will likely land after that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #700.
Provider.status()only checks whether the cache directory exists ondisk. Once a core has been fetched, FuseSoC happily reuses the cached
files for every subsequent run, even if the user has since changed the
core's
provider:block — most notably theversionfield. So flippingversion: v1.0.4-rc0→version: v1.0.4-rc1silently keeps buildingagainst the rc0 sources, with the only workaround being to bump the
core's own VLNV version (which then cascades through dependents).
Solution
After a successful fetch, write a
.fusesoc-provider-config.jsonmarkerinside the cache directory containing a normalised JSON copy of the
provider config.
status()reads it back on subsequent runs and flagsthe cache as
outofdatewhenever the current config no longer matches,which then triggers the existing clean-and-refetch path.
Caches written by older FuseSoC don't have the marker; treat those as
valid for backward compatibility (no surprise refetch on upgrade) and
let the next fetch write a fresh marker so any future drift is caught.
Test plan
test_provider_cache_invalidates_on_config_change— confirms achanged
versionflips status fromdownloadedtooutofdate.test_provider_legacy_cache_without_marker_is_valid— confirms apre-marker cache is still treated as
downloaded.test_git_provider,test_url_provider,test_uncachable, etc.) still pass.pre-commit run -aclean.