mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
package: Prevent freedombox's deps from removal during app uninstall
- If an app declares dependency on package that is also a dependency for freedombox, then during the app's uninstall, the dependency is attempt to be removed and will fail (because freedombox package will be held state). - Add freedombox (and thus its dependencies) to the list packages that should be removed from list of packages to be removed during app uninstall. - In test case, update list of packages attempted removal as the 'freedombox' package is installed only in some environments. Tests: - Uninstall janus works. Log messages show that libjs-bootstrap5 and node-popper2 are in the list of packages originally set to removed during app uninstall but are later filtered out. - Run pytest with 'freedombox' package installed and ensure all tests pass. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
b6bade7d06
commit
6c3b2e1f82
@ -308,9 +308,9 @@ class Packages(app_module.FollowerComponent):
|
|||||||
"""
|
"""
|
||||||
packages_set: set[str] = set(packages)
|
packages_set: set[str] = set(packages)
|
||||||
|
|
||||||
# Get list of packages needed by other installed apps (packages to
|
# Get list of packages needed by other installed apps and by freedombox
|
||||||
# keep).
|
# itself (packages to keep).
|
||||||
keep_packages: set[str] = set()
|
keep_packages: set[str] = {'freedombox'}
|
||||||
for app in app_module.App.list():
|
for app in app_module.App.list():
|
||||||
# uninstall() will be called on Packages of this app separately
|
# uninstall() will be called on Packages of this app separately
|
||||||
# for uninstalling this app.
|
# for uninstalling this app.
|
||||||
|
|||||||
@ -178,11 +178,11 @@ def test_packages_uninstall(uninstall, _refresh_package_lists):
|
|||||||
"""Test app"""
|
"""Test app"""
|
||||||
app_id = 'test-app'
|
app_id = 'test-app'
|
||||||
|
|
||||||
component = Packages('test-component', ['python3', 'bash'])
|
component = Packages('test-component', ['bash', 'dash'])
|
||||||
app = TestApp()
|
app = TestApp()
|
||||||
app.add(component)
|
app.add(component)
|
||||||
app.uninstall()
|
app.uninstall()
|
||||||
uninstall.assert_has_calls([call(['python3', 'bash'], purge=True)])
|
uninstall.assert_has_calls([call(['bash', 'dash'], purge=True)])
|
||||||
|
|
||||||
|
|
||||||
@patch('plinth.package.refresh_package_lists')
|
@patch('plinth.package.refresh_package_lists')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user