-
-
Notifications
You must be signed in to change notification settings - Fork 655
Description
Currently spkg uninstallation is handled in an ad-hoc manner. Many packages contain some rough uninstallation steps in their spkg-install
scripts (to be run, for example, when upgrading/reinstalling a package). But these are often imprecise and not thorough (though maybe still worth keeping where they already exist, as I will explain below).
implementation
-
Install packages in temporary root before copying to $SAGE_LOCAL #22509 - most packages are now installed with staged installation (i.e. DESTDIR installation), which enables creating a manifest of all files installed by that package (minus files created by the package's
spkg-postinst
script). This is mostly working now for almost all packages (see Meta-ticket: Update other packages to using the sage-dist-helpers functions + DESTDIR where applicable #24024). -
Add sage-spkg-uninstall script and use it when possible to remove packages #25139 - add an spkg-uninstall script: this would read the file manifest for a package (if it exists) and remove those files from
$SAGE_LOCAL
--thus uninstalling the package thoroughly and precisely.- Add sage-spkg-uninstall script and use it when possible to remove packages #25139 - support legacy uninstallers: many existing spkgs have steps in their
spkg-install
for "uninstalling" that package--mostly just removing a few key files associated with the package (executables and libraries), but was rarely complete. However, some of these legacy uninstall steps are still necessary for properly building the package if the package has not already been uninstalled. This is an issue for the new system insofar as we want upgrades from older versions of Sage to work, so the legacy uninstallers are still needed at least for one upgrade, if uninstalling a package that doesn't have a proper file manifest. Since these steps are no longer needed in thespkg-install
(in fact ideallyspkg-install
should not modify$SAGE_LOCAL
at all, we move those steps into a separatespkg-legacy-uninstall
script which is run only when uninstalling a package that is missing its file manifest.- Add spkg-legacy-uninstall scripts for most standard packages #25140 - once this infrastructure is in place there are several packages with 'legacy uninstallers' that would need to be updated.
- Add sage-spkg-uninstall script and use it when possible to remove packages #25139 - also add support for an
spkg-postrm
script that would be the complement to aspkg-postinst
script, and may clean up files generated by a package that are not part of the package's file manifest
- Add sage-spkg-uninstall script and use it when possible to remove packages #25139 - support legacy uninstallers: many existing spkgs have steps in their
old design discussion
Here are a few proposals for improving package uninstallation (which is useful even for required packages, such as in the case of upgrading them):
-
For all installed packages, maintain lists of the files installed by those packages. For this, something like Install packages in temporary root before copying to $SAGE_LOCAL #22509 is a prerequisite. This list could even go into the
$SAGE_LOCAL/var/lib/sage/installed/
files we already have. Uninstalling a package would consist primarily of removing all files in this list. It would also remove directories that are left empty after all files are removed. -
Add support an optional
spkg-uninstall
script for any spkgs. This can be used to perform any additional uninstallation steps. For example, it is a place to remove files / data added specifically for Sage byspkg-install
(e.g. symlinks) that are not installed by the package'smake install
. This would be run before the full uninstall described in the previous bullet point (in case any files from the package are necessary to determine additional uninstall steps). So this would be sort of like a pre-uninstall. -
Add support for an optional
spkg-legacy-uninstall
script. This would contain whatever commands thespkg-install
scripts currently perform for uninstall. This would only be run when the installed file list described in the first bullet point is unavailable (e.g. for backwards compatibility when upgrading to this new system for the first time). This feature could maybe be removed entirely later, but would be good to add at first and keep around for a while.
The new process for upgrading / reinstalling a package could be (especially if more progress is made toward supporting #21726 in all spkgs):
- Build
- Install to temporary directory (Install packages in temporary root before copying to $SAGE_LOCAL #22509)
- Upon successful completion of 1. and 2., uninstall old package
- Install new package by copying from temp dir into
$SAGE_LOCAL
- Run post-install scripts, if any
This means a cleaner rollback from failed upgrades.
Component: build
Keywords: uninstall
Author: Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/22510