Subject: Re: pkgsrc dependency problem
To: Thomas devreese <thomasdevreese@hotmail.com>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 12/07/2003 11:18:00
In message <Sea1-F127WOiy54DgI60000a09d@hotmail.com>, "Thomas devreese" writes:
>Hi, I've got a rather annoying problem.
>
>I want to install psi from the latest pkgsrc.
>After a while:
>===> Installing for glu-5.0.2nb3
>===>  glu-5.0.2 is already installed - perhaps an older version?
>*** If so, you may use either of:
>***  - "pkg_delete glu-5.0.2" and "make reinstall" to upgrade properly
>***  - "make update" to rebuild the package and all of its dependencies
>***  - "make replace" to replace only the package without re-linking
>***    dependencies, risking various problems.
>*** Error code 1
>
>If I do pkg_delete glu-5.0.2, it says that it's needed by a ton of other 
>applications like kdebase-3.1.4.
>
>make update will update almost all installed programs, including kde. I'd 
>rather not do that to install a simple chat program.
>
>make replace will very likely screw a few programs dependent on it, so 
>that's not an alternative.
>
>Can I expect this every time I update pkgsrc?
>Wouldn't it be possible to maintain different versions of packages on a 
>system to prevent this situation? Why isn't it that way; are there problems 
>with that approach of should it still be done? What if anything is done on 
>other systems to prevent this?
>

Yes, this is a problem, a bit one.  No, I don't have great solutions.  
I don't even have good solutions...

There are some tools I use to ease such updates.  'pkgdepgraph -D -O foo'
will tell you what you have to delete to delete foo.  Using -R instead 
of -D will generate a rebuild script.  (Make sure you run that *before* 
you actually do the deletions.  Ask me how I learned this...)  'pkg_chk -u'
will bring everything up to date with your current pkgsrc; I recommend 
using the -k flag, since the odds that something won't rebuild 
successfully are non-trivial, and you want a log of what needs to be 
rebuilt.  One friend says the he rebuilds his pkg stuff from scratch, 
once a month or so, but that's a semi-manual process; there don't seem 
to be any good tools that are completely dependable to help with that.
(The -B option to pkg_info will display build variables, including 
PKGPATH; in theory, one could grep for those to get a list of 
directories one needs to 'cd' to do 'make install'.  But PKGPATH isn't 
always there, I've found, and the directory name isn't the package name 
so you can't easily see if something's been installed by a dependency 
before you try to reinstall it.  The disconnect between short package 
name, long package name with version number, and directory name is a 
major headache when building simple scripts, at least for those like me 
who don't fully understand the innards of pkgsrc.)

Part of an old American (and English?) children's rhyme applies to 
pkgsrc:  "when it is good, it is very, very good, and when it is bad, it 
is horrid".

		--Steve Bellovin, http://www.research.att.com/~smb