Subject: adding upgrade to pkg_add
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 04/09/2003 15:44:27
As I had mentioned in January, it would be useful to allow package
upgrades. This is where the the package is not deinstalled first.

This is so an essential package like textutils, sh-utils, fileutils, or
glibc can be upgraded without deinstalling first. (The pkg_add -u switch
does a pkg_delete after moving the +REQUIRED_BY file aside.)

greywolf had an idea in 1999 here:
 http://mail-index.netbsd.org/tech-pkg/1999/03/08/0007.html

My idea would to be to add STAGE type for "UPGRADE" to use in the INSTALL
scripts.

Then the maintainer would be responsible for making sure that when the
package is upgraded, any leftover files (from old package but not in new)
are cleaned up, for example.

Also, a check could be done comparing old +CONTENTS with new, and maybe
remove files.

(An example of a package that cleans up already is lang/gcc where its
INSTALL fixes a corrupted "chill" info entry.)

I'd assume that very few packages would need this UPGRADE option, so it
should be easy.

Also, the @exec entries in the +CONTENTS would not be run -- if they are
really needed, then the maintainer would add to that UPGRADE in the
INSTALL script.

(Note that the @unexec would not be done, since the current package is
never deleted. If this was really needed, then the maintainer would add to
that UPGRADE in the INSTALL script.)

Maybe this could be a -r switch (for replace). Or maybe -u should be
upgrade and -r replace. I don't know. One for pkg_delete and one does not.

Also, it could be made smart to check all its +REQUIRED_BY packages to see
if the to-be-installed package is okay for the @pkgdep.

I'd prefer to not just -f to overwrite, because it doesn't seem like the
clean way to upgrade in-place.

Any comments?

   Jeremy C. Reed
   http://bsd.reedmedia.net/