Subject: Re: March patches re: bin-install
To: None <>
From: J Chapman Flack <>
List: tech-pkg
Date: 06/24/2005 21:45:27
Jeremy Reed wrote:
> On Fri, 24 Jun 2005, J Chapman Flack wrote:
> > 3. given DEPENDS+= foo>=1.2nb2:../../bar/foo
> >    and the bar/foo Makefile provides 1.2nb3
> >    even if a 1.2nb2 binary exists, which would satisfy the requirement,
> >    it is ignored and a source build of 1.2nb3 is done.
> Please see my simple idea (patch) in

It looks to me as if we both dealt with the same problem, but in
different ways.

Essentially, the depends target originally does this:

  if ( good enough package installed already )
    cd $pkg && make $DEPENDS_TARGET

If I understand your patch correctly, you have hooked that to say:

  if ( good enough package installed already )
  else {
    if ( do my own check for good-enough available version )
      pkg_add it
      cd $pkg && make $DEPENDS_TARGET

My approach was to see that the code you added is essentially the first
part of what the real-su-bin-install target *is supposed to do* - so if
it really did, the original code above would really be all that's needed:
the package isn't installed, so do a make bin-install on it, ought to work!
So I tried to figure out why the sub-make did the wrong thing. There turned
out to be two reasons.

1. DEPENDS_TARGET was not getting set properly; there's a reinvocation from
   bin-install to real-su-bin-install, and the latter was left out of the
   test that was supposed to set DEPENDS_TARGET to bin-install. Clear bug.
   Because of that, whenever a missing dependency proceeded to reinvoke make,
   it was not invoking bin-install at all, but regular install!

Even with that fixed, there was still a problem:

2. The line that invokes make DEPENDS_TARGET explicitly sets up the name/
   versionname the exact package that's needed in PKGNAME_REQD, which is enough
   information for the submake to recognize good-enough versions rather than
   requiring the latest version listed in the makefile. But the
   real-su-bin-install target didn't *use* the variable! It was easy to make
   it use the variable, so if it is set (which can "only" mean we are a
   submake working on a dependency), any good-enough version will be installed,
   but an ordinary 'make bin-install' from the command line has no change in
   behavior (because PKGNAME_REQD isn't set in that case).

The things I liked about the solution once I put the pieces together were that
the depends target didn't have to get more complicated or duplicate part of
bin-install, and real-su-bin-install got *simpler* while correcting one
clear bug and completing what seemed quite plausibly to have been intended
with (the otherwise mysteriously unused) PKGNAME_REQD in the first place.