Skip to content

Commit

Permalink
removes old archives from client cache dir
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaTegner committed Oct 11, 2024
1 parent 8dad64b commit 37f329f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tufup/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ def check_for_updates(
sys.exit()
return None
# check for new target files (archives and patches)
# look through all files in self.current_archive_local_path.parent, and remove all that is not self.current_archive_local_path
# this is to save space
for file in self.current_archive_local_path.parent.iterdir():
metadata_for_file = TargetMeta.parse_filename(file.name)
if TargetMeta(name=metadata_for_file["name"], version=metadata_for_file["version"], is_archive=metadata_for_file["suffix"]) < self.current_archive:
file.unlink()
logger.debug(f'current archive: {self.current_archive.filename}')
all_new_targets = dict(
(target_meta, self.get_targetinfo(target_meta))
Expand Down

0 comments on commit 37f329f

Please sign in to comment.