Skip to content

Commit 4ceaa04

Browse files
committed
rel_upgrade: Fix small issues
- Only call the update once (else we end up with 2 concurrent operations. It didn't matter much since one waits for the other, but it produced two dialogs, even though one was hidden by the other). - Don't call remove on pkgs which aren't installed. Aptkit produces an error dialog for these.
1 parent 8dab286 commit 4ceaa04

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

usr/lib/linuxmint/mintUpdate/rel_upgrade_root.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def update_cache(self):
5757
subprocess.run(["cp", sources_list, "/etc/apt/sources.list.d/official-package-repositories.list"])
5858

5959
# STEP 2: UPDATE APT CACHE
60-
self.client.update_cache()
6160
self.client.set_finished_callback(self.on_cache_updated)
6261
self.client.update_cache()
6362

@@ -96,9 +95,15 @@ def on_install_finished(self, transaction=None, exit_state=None):
9695

9796
def on_additions_finished(self, transaction=None, exit_state=None):
9897
# STEP 5: REMOVE PACKAGES
99-
if len(self.removals) > 0:
98+
removals = []
99+
cache = apt.Cache()
100+
cache.open(None)
101+
for name in self.removals:
102+
if name in cache and cache[name].is_installed:
103+
removals.append(name)
104+
if len(removals) > 0:
100105
self.client.set_finished_callback(self.on_removals_finished)
101-
self.client.remove_packages(self.removals)
106+
self.client.remove_packages(removals)
102107
else:
103108
self.on_removals_finished()
104109

0 commit comments

Comments
 (0)