Skip to content

Commit

Permalink
Apt: Change update marking strategy
Browse files Browse the repository at this point in the history
The scheme for marking packages for update would iterate through each
package and query if the package had an update available for it. This
could result in a package which has an update available being marked
while another, more essential package could conflict with the first and
result in a broken state. Resolve this by using the dist-upgrade instead
of manually iterating through packages.
  • Loading branch information
tombettany committed Aug 14, 2018
1 parent 5204b66 commit dfa5cf1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kano_updater/apt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,14 @@ def upgradable_packages(self, priority=Priority.NONE):
yield pkg

def _mark_all_for_update(self, priority=Priority.NONE):
for pkg in self.upgradable_packages(priority=priority):
logger.debug("Marking {} ({}) for upgrade".format(
pkg.shortname, pkg.candidate.version
))
pkg.mark_upgrade()
if priority < Priority.URGENT:
self._cache.upgrade(dist_upgrade=True)
else:
for pkg in self.upgradable_packages(priority=priority):
logger.debug("Marking {} ({}) for upgrade".format(
pkg.shortname, pkg.candidate.version
))
pkg.mark_upgrade()

def packages_to_be_upgraded(self):
ret = {}
Expand Down

0 comments on commit dfa5cf1

Please sign in to comment.