-
-
Notifications
You must be signed in to change notification settings - Fork 654
Description
This is a cleaned up an simplified version of a portion of the work originally done in #22510. This ticket adds a few new features that I felt were fundamentally inseparable (in part due to peculiarities of specific packages meaning that uninstallation could not be supported without some additional work).
-
Adds a new script
sage-spkg-uninstall
which is invoked likesage-spkg-uninstall <pkgname>
to uninstall a single package from$SAGE_LOCAL
(this also allows uninstalling standard packages, though we might prefer to prevent that by default). This script handles all matters of package uninstallation, including the final step of removing the package stamp file from under$SAGE_SPKG_INST
. There are two different ways a package can be uninstalled:a. "Modern" uninstallation: if a package has staged-installation support (i.e. has been updated to support Install packages in temporary root before copying to $SAGE_LOCAL #22509), this means that its stamp file contains a manifest of all files installed by that package (minus any files created by the package's
spkg-postinst
script). Therefore "modern" uninstallation consists mainly of looping over those files and removing them from$SAGE_LOCAL
. Any directories left empty by this process are also removed.b. "Legacy" uinstallation: many (though not all) packages have in their
spkg-install
script some code to perform an ad-hoc uninstallation of any previous versions of the package before installing the new version (this was sometimes necessary in particular for old versions of libraries). Support for this functionality is retained in order to properly support upgrades from older versions of Sage, where most packages may not support "modern" uninstallation.However, in order to support this properly, the legacy uninstall code for those packages should be moved out of their
spkg-install
scripts and into a newspkg-legacy-uninstall
script which is called bysage-spkg-uninstall
for these packages. This ticket includes one such example for demonstration purposes, adding anspkg-legacy-uninstall
forbrial
.In the future we may be able to deprecate, and ultimately remove these scripts. In the meantime all existing packages with uninstall code in their
spkg-install
should be updated (see followup ticket Add spkg-legacy-uninstall scripts for most standard packages #25140). -
Another feature this adds which is handled by
sage-spkg-uninstall
, but with some required support from thesage-spkg
script, are per-packagespkg-prerm
andspkg-postrm
scripts that are run just before and just after a package is uninstalled.This is needed in particular for some packages (namely
pkgconf
andwidgetsnbextension
) which really can't be removed properly without some pre/post-removal steps. Other packages will need this as well, but less crucially. I haven't found a specific use case yet forspkg-postrm
, but it's included for symmetry.Because these scripts are run during package uninstallation--of packages that are already installed--the scripts themselves need to be installed somewhere (e.g. Debian supports a similar feature, and keeps the scripts under
/var/lib/dpkg
somewhere). In this case a new pathSAGE_SPKG_SCRIPTS
is added under$SAGE_LOCAL/var/lib/sage/scripts
by default. Any package-specificprerm
andpostrm
scripts are stored there. After the package is uninstalled the scripts are removed as well. -
The Makefile is updated so that the
<pkgname>-clean
rules for most packages callsage-spkg-uninstall
, so that the packages are really thoroughly cleaned (rather than just removing their stamp files).
Depends on #24645
Depends on #25039
Component: build
Keywords: uninstall
Author: Erik Bray
Branch/Commit: 7a81e70
Reviewer: Julian Rüth
Issue created by migration from https://trac.sagemath.org/ticket/25139