Setup uninstall order

Chris January
Mon Sep 29 17:10:00 GMT 2003

> On Mon, 29 Sep 2003, Chris January wrote:
> > AFAICT uninstall of existing packages in Setup is done in an
> arbitrary (or
> > possible alphabetical) order. Uninstall needs to be done in the reverse
> > order of package dependancies (if that makes sense) if it is to succeed.
> > i.e. if you build a dependancy graph/tree of all the packages, then the
> > leaves should be uninstalled, then their parents and so on.
> > The problem is that, for example, if the cygwin package is
> uninstalled, and
> > then another package that has an uninstall script, the script can't run
> > because the cygwin DLL has already been uninstalled.
> >
> > Chris
> Chris,
> This has been proposed more than once, IIRC.  Unfortunately, this would
> involve radically changing the uninstall logic (right now the package
> object is asked to uninstall itself, and does all the necessary things).
> Further, many things aren't even defined during uninstall, e.g., suppose
> you have a circular dependence -- which package do you uninstall first?
> You can't choose an arbitrary order, of course.
> There are severe limitations on what a preremove script can do (and those
> should be documented, but aren't).  There are some kludges that will get a
> semblance of ordering the uninstalls without actually doing so (e.g., run
> all the preremove scripts in one big batch in reverse order of
> dependences), but they might create more problems than they solve.  If we
> do it at all, we should probably do it right.  Comments?

I have to admit I've not delved around in the setup internals here.
Re: the circular dependence problem. If we assume an uninstall script
reverses the actions of an install script then the circular dependency
problem must have been resolved in the install script for it to work and
hence this shouldn't be a problem with uninstall scripts. Install scripts
simply aren't going to work if they rely on a mutually dependent package to
be installed. Therefore if setup encounters a circular dependency it should
remove both packages, run both their uninstall scripts and not worry about
which order it uninstalls them in.

You mention documentation anove. Documentation is key, IMHO. A formal policy
should be drawn up for install and uninstall scripts that defines exactly
what they should and shouldn't do. A strict policy will lend itself to a
simpler uninstall procedure implementation.

For example:
      * Remember your package will depend upon every command called in your
install/uninstall scripts. You must include the packages that provide these
commands in your package's requires: line.
	* Don't use one command when a 'simpler' one will do instead. For example
don't use perl if sed will do as that will require your package to depend
upon perl.
      * If your package A is mutually dependant on another, say B, you may
not use any commands from B in the install/uninstall scripts of A and vice


More information about the Cygwin-apps mailing list