Skip to content

Commit

Permalink
_flatpak.py: Fix end-of-lifed-with-rebase handling.
Browse files Browse the repository at this point in the history
This was only marking the eol'd package for removal, but would
fail to add a replacement, as the arguments for add_rebase() were
incorrect.
  • Loading branch information
mtwebster committed Sep 21, 2023
1 parent 1fb5734 commit 8ddcdd2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions usr/lib/python3/dist-packages/mintcommon/installer/_flatpak.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def __init__(self, task):
self.transaction.connect("operation-done", self._operation_done)
self.transaction.connect("operation-error", self._operation_error)
self.transaction.connect("add-new-remote", self._transaction_add_new_remote)
self.transaction.connect("end-of-lifed", self._ref_eoled)
self.transaction.connect("end-of-lifed-with-rebase", self._ref_eoled_with_rebase)

# Runtimes explicitly installed are 'pinned' - which means they'll never be automatically
Expand Down Expand Up @@ -678,18 +679,24 @@ def _transaction_add_new_remote(self, transaction, reason_code, from_id, suggest
debug("Adding new remote '%s' (%s) for %s: %s" % (suggested_remote_name, url, from_id, reason))
return True

def _ref_eoled(self, transaction, ref, reason, rebase):
warn("%s is end-of-life (EOL) (%s)" % (ref, reason))

def _ref_eoled_with_rebase(self, transaction, remote, ref, reason, rebased_to_ref, prev_ids):
warn("%s is EOL (%s). Replacing with %s" % (ref, reason, rebased_to_ref))
warn("%s is end-of-life (EOL) (%s)" % (ref, reason))

try:
transaction.add_uninstall(ref)
except:
pass
try:
transaction.add_rebase(rebased_to_ref)
except:
debug("No new ref to rebase to, using the eol'd one")
return False

if rebased_to_ref is not None:
try:
warn("Replacing with %s" % rebased_to_ref)
transaction.add_rebase(remote, rebased_to_ref, None, prev_ids)
except GLib.Error as e:
debug("Problem adding replacement ref: %s" % e.message)
return False

return True

Expand Down

0 comments on commit 8ddcdd2

Please sign in to comment.