From 8ddcdd27ce5417f285754ed4f268fbb62166f74d Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Thu, 21 Sep 2023 11:54:46 -0400 Subject: [PATCH] _flatpak.py: Fix end-of-lifed-with-rebase handling. 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. --- .../mintcommon/installer/_flatpak.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/usr/lib/python3/dist-packages/mintcommon/installer/_flatpak.py b/usr/lib/python3/dist-packages/mintcommon/installer/_flatpak.py index d08230a..7272ec3 100644 --- a/usr/lib/python3/dist-packages/mintcommon/installer/_flatpak.py +++ b/usr/lib/python3/dist-packages/mintcommon/installer/_flatpak.py @@ -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 @@ -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