Subject: Re: CVS commit: pkgsrc/devel/zlib
To: grant beattie <grant@NetBSD.org>
From: Johnny C. Lam <jlam@buildlink.org>
List: tech-pkg
Date: 01/25/2004 11:24:47
On Mon, Jan 26, 2004 at 03:06:39AM +1100, grant beattie wrote:
> On Sun, Jan 25, 2004 at 12:47:48PM +0000, Johnny C. Lam wrote:
> 
> > > fixes a problem where a buildlink dependency would be added on both
> > > zlib>=1.1.4nb1 and zlib>=1.2.1, resulting in various buildlink
> > > breakage.
> > 
> > I don't understand what the problem here is.  Could you show me an
> > example?  pkgsrc always chooses the best available package for a
> > dependency, so "zlib>=1.1.4nb1, zlib>=1.2.1" should just match the
> > same zlib package.
> 
> bsd.buildlink3.mk calls:
> 
>     ${PKG_ADMIN} -s "" lsbest "${BUILDLINK_DEPENDS.${_pkg_}}"
> 
> but pkg_admin lsbest can only handle one word. this causes a warning
> from pkg_admin:
> 
>     pkg_admin: ` ' not recognised
>     pkg_admin: `>' not recognised
>     pkg_admin: `=' not recognised

This is fixed in the latest pkgsrc and was an oversight on my part.
I thought I had caught all instances in pkgsrc where the value of
BUILDLINK_DEPENDS.<pkg> was being checked, but I missed the most
important buildlink3.mk file of all!

> in 'make extract', zlib is listed twice:
> 
> ===> Required installed package zlib>=1.1.4nb1: zlib-1.2.1 found
> ===> Required installed package zlib>=1.2.1: zlib-1.2.1 found
> 
> it didn't seem to make sense to depend on an old version *and* a
> new version...

I think you're misunderstanding - it's _not_ depending on and old and
a new version.  It's depending on the same zlib-1.2.1 package.  The
package is just noting that at some point, zlib>=1.1.4nb1 was requested,
and that at another point, zlib>=1.2.1 was requested.  Dependencies are
_always_ satisfied by the "best" version of the package available.

The new standard for modifying BUILDLINK_DEPENDS.<pkg> will be to
append to the value instead of overriding.  The reason is so that the
most restrictive <pkg> dependency will always be a part of the
dependency list.  In the zlib example, suppose that the zlib package
is updated to 1.2.2, which adds a new function zfoo() to the API.  If
a package needs to use zfoo(), then it does:

	BUILDLINK_DEPENDS.zlib=	zlib>=1.2.2	# needs zfoo()
	.include "../../devel/zlib/buildlink3.mk"

If we use = instead of += to modify BUILDLINK_DEPENDS.zlib in
zlib/buildlink3.mk, then it the resulting dependency will be
zlib>=1.2.1, which is _not_ sufficient.  By using += to modify the
value of BUILDLINK_DEPENDS.zlib, we ensure that all of the listed
zlib dependency requirements end up in the dependency list so that
the rest of the pkgsrc machinery can do the right thing.

Can you please back out your change now that bsd.buildlink3.mk has
been fixed?

	Thanks,

	-- Johnny Lam <jlam@buildlink.org>