Subject: pkg/30928: bin-install fails to install depends via binaries when possible.
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <nbgnats@anastigmatix.net>
List: pkgsrc-bugs
Date: 08/06/2005 21:18:01
>Number:         30928
>Category:       pkg
>Synopsis:       bin-install fails to install depends via binaries when possible.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 06 21:18:00 +0000 2005
>Originator:     Chapman Flack
>Release:        2.0.0 (irrelevant to issue)
>Organization:
>Environment:
NetBSD lundestad.anastigmatix.net 2.0 NetBSD 2.0 (lundestad) #11: Sat Mar  5 14:01:49 EST 2005  xxx@xxx:/usr/src/sys/arch/i386/compile/lundestad i386 (irrelevant to issue, confirmed exists in CVS head)

>Description:
In 2002, hubertf committed this patch to bsd.pkg.mk:

> 1.969   ! hubertf  1130: .  elif make(bin-install)
>         !          1131: DEPENDS_TARGET=        bin-install

The purpose was as described in the log:

> bin-install: set DEPENDS_TARGET=bin-install, so depends are still
> installed via binaries (if possible), even if there is no binary
> pkg available for the current pkg.
>
> Implementation still allows overriding DEPENDS_TARGET=build (etc.)
> to force installation of dependencies by compiling if desired.

However, 1.5 years later in Oct 2003, agc added the real-su-bin-install
mechanism in order to address PR 17883:

> 1.1297  ! agc      3880:
>         !          3881: .PHONY: bin-install
>         !          3882: bin-install:
>         !          3883:        @${ECHO_MSG} "${_PKGSRC_IN}> Binary install for ${PKGNAME}"
>         !          3884:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
>         !          3885:        realtarget="real-su-bin-install";                                       \
>         !          3886:        action="binary install";                                        \
>         !          3887:        ${_SU_TARGET}
>         !          3888:

The result was that the earlier change became ineffective. DEPENDS_TARGET no
longer gets set to bin-install when it should be, because the effective target
at the time is not bin-install but rather real-su-bin-install.  The needed fix
is trivial:

1050:  .  elif make(bin-install)  ||  make(real-su-bin-install)
1051:  DEPENDS_TARGET=        bin-install

This problem is the underlying cause of PR 28764, in which cwr suggested
properly that "DEPENDS_TARGET should default to bin-install when bin-install
is the primary target" which, of course, has been the intent since 2002, but
hasn't worked since 2003.

The problem was also discussed, with patch, in
http://mail-index.netbsd.org/tech-pkg/2005/03/20/0023.html and
http://mail-index.netbsd.org/tech-pkg/2005/03/20/0025.html.
>How-To-Repeat:
make bin-install for package foo depending on bar, where foo must be built but an acceptable binary bar is available. do crossword puzzle while bar is built from source.
>Fix:
1050:  .  elif make(bin-install)  ||  make(real-su-bin-install)
1051:  DEPENDS_TARGET=        bin-install