Subject: Re: Dependencies, including "make update" issues.
To: Richard Rauch <>
From: Todd Vierling <>
List: tech-pkg
Date: 07/03/2005 01:14:38
On Fri, 1 Jul 2005, Richard Rauch wrote:

> Suppose that I'm a student working on a semester project, and
> I need library A ( for my project.  Let's suppose that
> I install it via:
>   cd /usr/pkgsrc/devel/libA && make update
> I'm happily developing.
> Suppose then I take a weekend break and install /usr/pkgsrc/games/B.
> B requires libA.  I fool with the game B for a bit, get bored, or
> find it too addictive to keep it around, and pkg_delete (or
> "make deinstall") on it.
> libA's reference count drops to 0.  If I understand your proposal
> correctly, libA will go away, which I definitely do not want to
> have happening.

But what if you do it the other way round?

1. Install B
   [... time passes ...]
2. Start developing with libA, because it's installed
3. Deinstall B
   [... poof!, libA is gone ...]

You'd need to remember the status of libA and have another tool/option to
toggle it to non-auto-deinstall.

To address this concern, I have a pkgsrc/local tree containing my own
meta-pkgs for each system I have, including everything I need for that
system.  Basically, the meta-pkg depends on *everything* (directly or
indirectly) with a bunch of lines like:

DEPENDS+=	foo-[0-9]*:../../bar/foo

Coupled with the script below, which lists all packages with no dependents,
I know very quickly if a package is no longer needed.  I simply run the
script after modifying/rebuilding my meta-pkg, and anything (other than the
meta-pkg itself) that is listed is unneeded.


# pkgdepchk - list all packages on which nothing depends

: ${PKG_DBDIR:=/var/db/pkg}

dir=$(mktemp -d -t pkgdepchk)
test -n "$dir" || exit 1
trap 'rm -rf $dir' 0
trap 'exit 1' 1 2 3 5 15
cd $dir

(cd $PKG_DBDIR && find . -name +REQUIRED_BY -size +1c | sed 's,^./,,;s,/.*$,,') | sort >deps.registered
(cd $PKG_DBDIR && /bin/ls -1d *-*) | sort >deps.available

comm -13 deps.registered deps.available

-- Todd Vierling <> <> <>