uninstall: Use reverse order when uninstalling components

Tests:

- Functional tests for bepasty app work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-05-15 16:01:27 -07:00 committed by James Valleroy
parent ad2908630c
commit 3b1eba216a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 3 deletions

View File

@ -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:

View File

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