Subject: Re: make package but not if it's installed
To: None <tech-pkg@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-pkg
Date: 04/03/2003 09:57:37
On Wed, 02 Apr 2003, Andrew Brown wrote:
> consider that the fetch target does nothing if the distfiles are
> already present.
> 
> is there an analog to this that can be used to build/install/package a
> package, or does nothing if the package is already installed?

"make bin-install" is pretty close to what you want, provided you have
"BINPKG_SITES= #empty" in /etc/mk.conf.  With a non-empty BINPKG_SITES,
bin-install will:

  a) check whether the package (or an older version) is installed, and
     complain if so (I hacked my bsd.pkg.mk to split this into two
     separate cases, because I think it's not an error for the correct
     version to already be installed, but it is an error for a different
     version to already be installed.

  b) check whether a binary package exists on the local system, and install
     it via pkg_add.
  
  c) loop through all entries in BINPKG_SITES, trying to fetch and install
     a binary package.

  d) if all else fails, do the equivalent of "make package" and "make clean".

--apb (Alan Barrett)