Versioning caches in Plasma

Harald Sitter sitter at kde.org
Fri Mar 3 12:25:33 UTC 2017


On Fri, Mar 3, 2017 at 12:48 PM, Kai Uwe Broulik <kde at privat.broulik.de> wrote:
> Hi,
>
> Since when? :o I made a patch for this [1] which I didn't ship exactly for that reason.
>
> We check mtime of theme files but they are preserved when installing updates and so it can happen it doesn't properly nuke it.

A bit off topic but that'd only be a problem for non-clean
source-installs though (i.e. make install without make uninstall
first, where cmake goes "ugh, you already have that file"). For binary
packages of any sort the mtime would always be different, same for
stuff from the kde store since that'd rm the old tree first (I am
guessing).

> Also, the Metadata.desktop has a version string but it's always forgotten to bump it when there are svg changes... maybe can be scripted?
>
> [1] ‎https://git.reviewboard.kde.org/r/126642/
>

I'll add some other anicent reviews for reference :P

https://git.reviewboard.kde.org/r/115326 (did not land)
https://git.reviewboard.kde.org/r/115397 (did land, didn't like it as
good as my version ;))

The problem with the cache code was (and probably still is) that it is
more complicated than it should be. Cleanup, in particular, ought to
be straight forward. Yes the theme versions should get bumped whenever
changed but that should not really matter because of the mtime safety
net :

- Get version of metadata.desktop
- If it has a version make it part of the cache name to not
runtime-switch artwork of the old $thing
- If not simply use a generic cache name with the disadvantage that
potentially new artwork will load immediately
- List all cache files that match the non-variable part of the file
name (e.g. glob("cache/plasma_theme_default*.kcache"))
- Remove *all* files that are not the newly constructed name

Cache cleanup can and really must be aggressive. At this point no
"old" cache file should be left (old := not the one under
consideration).

In addition to that the following needs to happen to handle bad
version bumping and/or absence of versions:
- Get mtime of metadata.desktop
- Get mtime of related cache file
- If metadata is newer than cache, kill the cache to force a regeneration

If cache cleanup again stumbles over versions then it is quite simply
not aggressive enough I'd say

HS


More information about the Plasma-devel mailing list