pkg_upgrade (was Re: pkg_add does not backtrack, does it?)

Mike Meyer mwm-keyword-freebsdhackers2.e313df at mired.org
Wed Feb 7 06:17:13 UTC 2007


In <20070207020205.GC62321 at grummit.biaix.org>, Joan Picanyol i Puig <lists-freebsd-hackers at biaix.org> typed:
> * Mike Meyer <mwm-keyword-freebsdhackers2.e313df at mired.org> [20070207 01:05]:
> > If you let us know what your goals are, we might be able to help you
> > get there.
> 
> I know what I'd like: a utility in the base system for binary upgrading
> of packages. More flexible logic in how the '-r' option is handled would
> be nice (being able to fetch all packages from All/ even if you are
> on RELENG). Doesn't
> 
> freebsd-update fetch install && pkg_upgrade -a
> 
> look nice for keeping up to date?

Not particularly, but why does it have to be in the base system?
freebsd-update isn't. But if you insure the ports database is pristine
and want to blindly update all your installed packages at once, you
can do something like:

freebsd-udpate fetch install && (portversion -c -C P | /bin/sh)

I haven't tested it; in particular I'm not sure I got the syntax for
-C right, and there are probably other things that are broken as well.

> The obvious hairy details must be
> harder than it seems, I'm sure others have considered it (and would have
> done it) before.

The thing is, chances are pretty good that at some point or another,
you're *not* going to want to just update all the installed
packages. Some package may require external work, or you may want to
follow a different branch than the main port, or an update may include
a new bug that you can't live with, or you may have something
installed that's not in the ports tree that breaks if you update a
port, etc.

And of course, this doesn't work well if you've managed to corrupt the
ports database, which is all to easy to do. Or at least I've found
that to be the case. Maybe if I could only convince myself to *always*
use portinstall, and not just do a "make install" after I've read
through the package description, things wouldn't be so bad, but they
are.

People have tried this. portupgrade is the most complete solution I
know of, though there are others in the ports tree. It can do
binary-only upgrades, or can be set to try the binaries first, and
only build if the binaries aren't available. It also has flags to save
the old install, and a config file that lets you hold packages, or set
build options if you build.

	<mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.


More information about the freebsd-hackers mailing list