Subject: Re: pkgsrc and update
To: Jukka Marin <jmarin@embedtronics.fi>
From: segv <segv@netctl.net>
List: netbsd-users
Date: 07/28/2005 01:22:58
On Sun, 24 Jul 2005 20:08:14 +0300
Jukka Marin <jmarin@embedtronics.fi> wrote:
> I have, say, 6-month-old packages installed on my system. One day, I
> decide I want to update, say, xine-ui.
>
> What (on earth) should I do?
>
> I tried "make update" (although I know it does NOT work - and it didn't)
> and sooner or later, the system complains "xxx is already installed -
> perhaps an older version?" - why doesn't it _update_ the package as I
> told it to do?
>
> So, HOW do I update installed packages without first removing all packages
> and then installing everything from scratch.
>
> Thank you.
>
> -jm
Well I haven't had time to write complete how to, but this is how I keep my
packages up to date:
Below is one of my scripts I use
#!/bin/sh
# The following packages must be installed before running this script
# pkgtools/pkglint
# pkgtools/pkgdepgraph
lintpkgsrc -i -P /opt/pkgsrc | tee ./pkglog_outdated \
&& pkgdepgraph -D ./pkglog_outdated | tee ./pkglog_delete \
&& pkgdepgraph -eLm package ./pkglog_outdated | tee ./pkglog_rebuild \
&& cat ./pkglog_delete | xargs pkg_delete \
&& /bin/sh ./pkglog_rebuild
I run this scripts inside chroot jail, so that it doesn't affect currently
installed packages on the main system, but there are a number of ways you could
do that, i.e. run the first two lines on the main system to get a list of
packages that need to be deleted, then chroot and use the output of the
previous commands as the input to the next ones, etc.
Anyway, what the script does is scan your packages, finds outdated compared to
the ones in the current pkgsrc tree, builds ordered lists of which packages to
delete and which packages to rebuild (this also takes care of dependancies),
deletes outdated packages and rebuilds them and their dependancies.
If you don't want to mess around setting up chroot jail, you can backup your
pkgsrc directories before building
cp -Rp /usr/pkg /usr/pkg.bak \
&& cp -Rp /var/db/pkg /var/db/pkg.bak
If some of the packages fail to build, you still have your backup pkgsrc
directories. The downside of upgrading packages on a live system is that you
have to wait for the build to finish before you can use those packages.