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) ])