dennisvang / tufup

Automated updates for stand-alone Python applications.
MIT License
90 stars 1 forks source link

remove old archives from client cache dir #92

Open dennisvang opened 10 months ago

dennisvang commented 10 months ago

On the client side, update archives are downloaded by tuf.ngclient.Updater into the target_dir, which in our case is the client cache dir, see

https://github.com/dennisvang/tufup/blob/981536a7f77df0b125f9ee6a83e50590c756dc9b/src/tufup/client.py#L42

A newly downloaded archive is extracted during install, and must remain in place afterwards, to enable us to do a patch update for the next version.

This means that, after installation, only the latest archive, i.e. the one corresponding to the newly installed app version, is ever used.

However, the current implementation does not remove the older archives that are no longer used.

To prevent waste of storage space, we should remove these old archives and only keep the archive for the currently installed version.

If we were to accidentally remove the latest archive, no problem: that just means we cannot do a patch update.

We could check for, and remove, "stale" archives at the start of the update check, for example.