Subject: Re: CVS commit: [pkgviews] src/usr.sbin/pkg_install
To: None <source-changes@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: source-changes
Date: 08/23/2003 13:40:59
On Thu, 21 Aug 2003, Johnny C. Lam wrote:
  [stuff about changing the meaning of PKG_DBDIR, and defining
  PKG_DBDIR_DFLT to mean what PKG_DBDIR used to mean]

> Now, this does screw people who've set PKG_DBDIR in their shell
> environment or in /etc/mk.conf in order to point the package database
> directory to somewhere else, e.g PKG_DBDIR=/usr/pkg/.pkgdb.  However,
> I think this is a tiny change that we can stomach instead of changing
> the way that the rest of the pkgsrc users have used the pkg_* tools in
> the past.  We just need to inform people to change the PKG_DBDIR
> setting into a PKG_DBDIR_DFLT setting.

Could you explain what you mean by "changing the way that the rest of
the pkgsrc users have used the pkg_* tools in the past"?  It seems to
me that you are making exactly the kind of change that you say would be
bad, so I am probably misunderstanding something.

Why is this change necessary at all?  I can see that pkgviews would want
two variables, one for the old meaning of PKG_DBDIR (where the default
"view" lives), and a new one for the new "depot".  But why can't the
new meaning get a new variable name (e.g. PKG_DEPOT_DBDIR) instead of
stealing the old variable name (PKG_DBDIR)?

> The only bad thing that can happen if a user fails to make this change
> is that when they try to pkg_add(1) a binary depoted package, the
> package metadata files will be stored in /var/db/pkg instead of
> wherever the user normally stores the package metadata files.

If you kept the old variable name with the old meaning, then this bad
effect would not arise.

Is pkg_add of a binary package really the only thing that exhibits a bad
effect?  I would have expected users of pkg_create and users of pkgsrc
"make install" to see similar bad effects.

> If anyone knows of a nice way to warn the user that this is happening,
> I'd love to know, so that I can modify pkg_view(1) to check for this
> case.

If the decision to steal the old variable name for a new purpose is
unchangeable, and you simply want to warn about it, then what about the
equivalent of

	if (getenv("PKG_DBDIR") && ! getenv("PKG_DBDIR_DFLT")) {
	    errx("PKG_DBDIR no longer means what it used to mean!");
	}

--apb (Alan Barrett)