From 3b1eba216a2719cc6c74439d2e2d31dd0c72e424 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 15 May 2025 16:01:27 -0700 Subject: [PATCH] uninstall: Use reverse order when uninstalling components Tests: - Functional tests for bepasty app work. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/app.py | 4 +++- plinth/tests/test_package.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plinth/app.py b/plinth/app.py index aa5db71f4..f9d562e91 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -147,7 +147,9 @@ class App: def uninstall(self): """De-configure and uninstall the app.""" - for component in self.components.values(): + # Remove components in the reverse order so that dependencies among + # components is properly satisfied. + for component in reversed(self.components.values()): component.uninstall() def get_setup_state(self) -> SetupState: diff --git a/plinth/tests/test_package.py b/plinth/tests/test_package.py index 8c27c3330..f220480a5 100644 --- a/plinth/tests/test_package.py +++ b/plinth/tests/test_package.py @@ -264,8 +264,8 @@ def test_packages_uninstall_exclusion(cache, uninstall, TestApp3() app1.uninstall() uninstall.assert_has_calls([ - call(['package11', 'package3', 'dep6'], purge=True), - call(['package12', 'package3'], purge=True) + call(['package12', 'package3'], purge=True), + call(['package11', 'package3', 'dep6'], purge=True) ])