diff --git a/pkgs/desktops/pantheon/apps/appcenter/default.nix b/pkgs/desktops/pantheon/apps/appcenter/default.nix index 556b67aeafe8..b88d8f5518ef 100644 --- a/pkgs/desktops/pantheon/apps/appcenter/default.nix +++ b/pkgs/desktops/pantheon/apps/appcenter/default.nix @@ -30,15 +30,21 @@ stdenv.mkDerivation rec { pname = "appcenter"; - version = "3.6.0"; + version = "3.7.1"; src = fetchFromGitHub { owner = "elementary"; repo = pname; rev = version; - sha256 = "0kwqgilhyrj2nbvw5y34nzch5h9jnrg1a1n333qdsx4ax6yrxh4j"; + sha256 = "1llkc0p47jcx992lkwics86vv622dmmvm5hxrdsq26j9crcd5dam"; }; + patches = [ + # Try to remove other backends to make flatpak backend work. + # https://github.com/NixOS/nixpkgs/issues/70214 + ./flatpak-only.patch + ]; + passthru = { updateScript = nix-update-script { attrPath = "pantheon.${pname}"; diff --git a/pkgs/desktops/pantheon/apps/appcenter/flatpak-only.patch b/pkgs/desktops/pantheon/apps/appcenter/flatpak-only.patch new file mode 100644 index 000000000000..857c13028857 --- /dev/null +++ b/pkgs/desktops/pantheon/apps/appcenter/flatpak-only.patch @@ -0,0 +1,196 @@ +From 63594caa1da772de504ab1d93b69aae148f29f64 Mon Sep 17 00:00:00 2001 +From: Bobby Rong +Date: Wed, 1 Sep 2021 12:25:09 +0800 +Subject: [PATCH] Drop PackageKitBackend and UbuntuDriversBackend + +--- + src/Application.vala | 14 --------- + src/Core/BackendAggregator.vala | 2 -- + src/Core/UpdateManager.vala | 56 --------------------------------- + src/MainWindow.vala | 17 ---------- + src/Views/Homepage.vala | 15 --------- + 5 files changed, 104 deletions(-) + +diff --git a/src/Application.vala b/src/Application.vala +index 65fae5aa..9d42b14f 100644 +--- a/src/Application.vala ++++ b/src/Application.vala +@@ -167,10 +167,6 @@ public class AppCenter.App : Gtk.Application { + + var client = AppCenterCore.Client.get_default (); + +- if (fake_update_packages != null) { +- AppCenterCore.PackageKitBackend.get_default ().fake_packages = fake_update_packages; +- } +- + if (silent) { + NetworkMonitor.get_default ().network_changed.connect ((available) => { + schedule_cache_update (!available); +@@ -183,16 +179,6 @@ public class AppCenter.App : Gtk.Application { + return; + } + +- if (local_path != null) { +- var file = File.new_for_commandline_arg (local_path); +- +- try { +- local_package = AppCenterCore.PackageKitBackend.get_default ().add_local_component_file (file); +- } catch (Error e) { +- warning ("Failed to load local AppStream XML file: %s", e.message); +- } +- } +- + if (main_window == null) { + main_window = new MainWindow (this); + +diff --git a/src/Core/BackendAggregator.vala b/src/Core/BackendAggregator.vala +index 2f8bdedf..b705ca87 100644 +--- a/src/Core/BackendAggregator.vala ++++ b/src/Core/BackendAggregator.vala +@@ -26,8 +26,6 @@ public class AppCenterCore.BackendAggregator : Backend, Object { + + construct { + backends = new Gee.ArrayList (); +- backends.add (PackageKitBackend.get_default ()); +- backends.add (UbuntuDriversBackend.get_default ()); + backends.add (FlatpakBackend.get_default ()); + + unowned Gtk.Application app = (Gtk.Application) GLib.Application.get_default (); +diff --git a/src/Core/UpdateManager.vala b/src/Core/UpdateManager.vala +index 29fa397a..ce42dd57 100644 +--- a/src/Core/UpdateManager.vala ++++ b/src/Core/UpdateManager.vala +@@ -53,42 +53,9 @@ public class AppCenterCore.UpdateManager : Object { + installed_package.update_state (); + } + +- Pk.Results pk_updates; +- unowned PackageKitBackend client = PackageKitBackend.get_default (); +- try { +- pk_updates = yield client.get_updates (cancellable); +- } catch (Error e) { +- warning ("Unable to get updates from PackageKit backend: %s", e.message); +- return 0; +- } +- + uint os_count = 0; + string os_desc = ""; + +- var package_array = pk_updates.get_package_array (); +- debug ("PackageKit backend reports %d updates", package_array.length); +- +- package_array.foreach ((pk_package) => { +- var pkg_name = pk_package.get_name (); +- var appcenter_package = client.lookup_package_by_id (pkg_name); +- if (appcenter_package != null) { +- debug ("Added %s to app updates", pkg_name); +- apps_with_updates.add (appcenter_package); +- appcenter_package.latest_version = pk_package.get_version (); +- } else { +- debug ("Added %s to OS updates", pkg_name); +- os_count++; +- unowned string pkg_summary = pk_package.get_summary (); +- unowned string pkg_version = pk_package.get_version (); +- os_desc += Markup.printf_escaped ( +- "
  • %s\n\t%s\n\t%s
  • \n", +- pkg_name, +- pkg_summary, +- _("Version: %s").printf (pkg_version) +- ); +- } +- }); +- + os_updates.component.set_pkgnames ({}); + os_updates.change_information.clear_update_info (); + +@@ -160,29 +127,6 @@ public class AppCenterCore.UpdateManager : Object { + count += 1; + } + +- pk_updates.get_details_array ().foreach ((pk_detail) => { +- var pk_package = new Pk.Package (); +- try { +- pk_package.set_id (pk_detail.get_package_id ()); +- var pkg_name = pk_package.get_name (); +- var appcenter_package = client.lookup_package_by_id (pkg_name); +- if (appcenter_package != null) { +- appcenter_package.change_information.updatable_packages.@set (client, pk_package.get_id ()); +- appcenter_package.change_information.size += pk_detail.size; +- appcenter_package.update_state (); +- } else { +- var pkgnames = os_updates.component.pkgnames; +- pkgnames += pkg_name; +- os_updates.component.pkgnames = pkgnames; +- +- os_updates.change_information.updatable_packages.@set (client, pk_package.get_id ()); +- os_updates.change_information.size += pk_detail.size; +- } +- } catch (Error e) { +- critical (e.message); +- } +- }); +- + os_updates.update_state (); + return count; + } +diff --git a/src/MainWindow.vala b/src/MainWindow.vala +index a32ce47b..b9f8594a 100644 +--- a/src/MainWindow.vala ++++ b/src/MainWindow.vala +@@ -292,23 +292,6 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow { + } + + public override bool delete_event (Gdk.EventAny event) { +- unowned AppCenterCore.PackageKitBackend client = AppCenterCore.PackageKitBackend.get_default (); +- if (client.working) { +- if (task_finished_connection != 0U) { +- client.disconnect (task_finished_connection); +- } +- +- hide (); +- task_finished_connection = client.notify["working"].connect (() => { +- if (!visible && !client.working) { +- destroy (); +- } +- }); +- +- AppCenterCore.Client.get_default ().cancel_updates (false); //Timeouts keep running +- return true; +- } +- + return false; + } + +diff --git a/src/Views/Homepage.vala b/src/Views/Homepage.vala +index 67d1e208..48af8f61 100644 +--- a/src/Views/Homepage.vala ++++ b/src/Views/Homepage.vala +@@ -212,7 +212,6 @@ public class AppCenter.Homepage : AbstractView { + recently_updated_revealer.reveal_child = recently_updated_carousel.get_children ().length () > 0; + + var houston = AppCenterCore.Houston.get_default (); +- var pk_client = AppCenterCore.PackageKitBackend.get_default (); + var packages_for_banner = new Gee.LinkedList (); + + var newest_ids = yield houston.get_app_ids ("/newest/project"); +@@ -220,20 +219,6 @@ public class AppCenter.Homepage : AbstractView { + Utils.shuffle_array (trending_ids); + + var packages = new Gee.HashMap (); +- packages.set_all (pk_client.get_packages_for_component_ids (newest_ids)); +- packages.set_all (pk_client.get_packages_for_component_ids (trending_ids)); +- +- if (!AppCenterCore.PackageKitBackend.supports_parallel_package_queries) { +- foreach (var package in packages.values) { +- package.update_state (); +- } +- } else { +- try { +- yield pk_client.update_multiple_package_state (packages.values); +- } catch (Error e) { +- warning ("Error while getting installed state of banner packages: %s", e.message); +- } +- } + + foreach (var package in newest_ids) { + if (packages_for_banner.size >= NUM_PACKAGES_IN_BANNER) {