From fb073a5eae0423a32392e3724cd602d46c7a95a3 Mon Sep 17 00:00:00 2001 From: GloriousEggroll Date: Thu, 17 Apr 2025 00:28:01 -0600 Subject: [PATCH] fix issue with mismatch of app.id when installing/removing apps --- src/fp_turbo.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/fp_turbo.py b/src/fp_turbo.py index b065d4c..4e50bb6 100755 --- a/src/fp_turbo.py +++ b/src/fp_turbo.py @@ -891,7 +891,7 @@ def install_flatpak(app: AppStreamPackage, repo_name=None, system=False) -> tupl available_apps = installation.list_remote_refs_sync(repo_name) match_found = None for available_app in available_apps: - if app.id == available_app.get_name(): + if available_app.get_name() in app.id: match_found = 1 # Add the install operation transaction.add_install(repo_name, available_app.format_ref(), None) @@ -959,8 +959,9 @@ def remove_flatpak(app: AppStreamPackage, system=False) -> tuple[bool, str]: transaction = Flatpak.Transaction.new_for_installation(installation) match_found = None for installed_ref in installed: - if app.id in installed_ref.get_name(): + if installed_ref.get_name() in app.id: match_found = 1 + # Add the install operation transaction.add_uninstall(installed_ref.format_ref()) if not match_found: @@ -990,10 +991,12 @@ def update_flatpak(app: AppStreamPackage, system=False) -> tuple[bool, str]: transaction = Flatpak.Transaction.new_for_installation(installation) match_found = None for update in updates: - if app.id == update.get_name(): + if update.get_name() in app.id: match_found = 1 + # Add the install operation transaction.add_update(update.format_ref()) + if not match_found: return False, f"No updateable package named {app.id} found." # Run the transaction @@ -1128,6 +1131,11 @@ def repoadd(repofile, system=False): if title.casefold() in existing_titles: return False, "A repository with this title already exists." + if title == "flathub": + title = "Flatpak Official Flathub" + if title == "flathub-beta": + title = "Flatpak Official Flathub (Beta)" + # Read the repository file try: with open(repofile, 'rb') as f: