uninstall: Prevent uninstall of other apps due to a shared library
If a shared library such as python3-psycopg2 is listed in packages of an app (say tt-rss), then uninstalling that app could lead to removal of other apps' packages (such as matrix-synapse) that depend on the library. See #2298 (closed). A temporary workaround has been implemented by also listing the libraries in effected apps. A proper solution to prevent accidental removals is needed.
Some ideas discussed so far:
- Mark the packages libjs-bootstap and python3-psycopg2 not be removed when uninstalling.
- Or, during the uninstalling of an app, retrieve the list of packages that will be removed if remove operation proceeds and compare them against packages needed for installed apps. Then use this information to:
- Refuse uninstalling the app.
- Or, exhaustively find the list of packages that need to be excluded from removal in order to keep the packages needed by installed apps.