Skip to content

Commit

Permalink
Cache: Add method to completely refresh the cache
Browse files Browse the repository at this point in the history
When grabbing an instance to the apt wrapper handle, currently it will
always return the same cache instance and will never fully refresh. This
can cause a problem when the underlying sources change as it will not
re-read these when it updates. Add a method to refresh this and utilise
for the Stretch upgrade.
  • Loading branch information
tombettany committed Aug 22, 2018
1 parent 1e383ab commit 7ec798f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kano_updater/apt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def __init__(self):
else:
AptWrapper._singleton_instance = self

self._cache = None
self.refresh_instance()

def refresh_instance(self):
apt.apt_pkg.init_config()

# We disable downloading translations, because we don't have them
Expand Down
1 change: 1 addition & 0 deletions kano_updater/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ def beta_3_15_0_to_beta_3_16_0(self, progress):
# Proceeding to update to 4.x.x - add new sources and relaunch
shutil.copy(REFERENCE_STRETCH_LIST, STRETCH_MIGRATION_LIST)
apt_handle = AptWrapper.get_instance()
apt_handle.refresh_instance()
apt_handle.update(progress)
progress.relaunch()

Expand Down

0 comments on commit 7ec798f

Please sign in to comment.